MemberManagement/FrmRechargeCumulative.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MemberManagement
{
    public partial class FrmRechargeCumulative : Form
    {
        public FrmRechargeCumulative()
        {
            InitializeComponent();
            //设置窗体的双缓冲
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
            this.UpdateStyles();
            //利用反射设置DataGridView的双缓冲
            Type dgvType = this.dataGridView1.GetType();
            PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
            pi.SetValue(this.dataGridView1, true, null);
        }

        private void FrmRecharge_Load(object sender, EventArgs e)
        {
            this.txtCard1.Focus();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            ((Button)sender).Enabled = false;
            this.Search();
            ((Button)sender).Enabled = true;
        }

        private bool Search()
        {
            try
            {
                using (var db = new MemberManagementEntities())
                {
                    var ret = db.CumulativeRecharge;

                    this.dataGridView1.AutoGenerateColumns = false;
                    this.dataGridView1.DataSource = db.CumulativeRecharge.ToList();
                    this.toolStripStatusLabel1.Text = $"共{ret.Count()}个客户,累计充值总额:{ret.Sum(o => o.cumulativeBalance).Value.ToString("F2")}元";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "操作数据失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
后面还有 34 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。