Beispiel #1
0
 public frmKPIThem(O_KPI tb, int diem)
 {
     InitializeComponent();
     Text     += " sửa";
     kpi       = tb;
     _NhanVien = tb.NhanVien;
     _Diem     = diem;
 }
        private void iAC1_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
        {
            BindingSource bs        = (BindingSource)GVKPI.DataSource;
            List <O_KPI>  dt        = bs.DataSource as List <O_KPI>;
            int           sumObject = 0;

            if (dt != null)
            {
                sumObject = dt.Select(w => w.Diem).Sum();
            }
            else
            {
                sumObject = 0;
            }

            switch (int.Parse(e.Button.Properties.Tag.ToString()))
            {
            case 1:
                new frmKPIThem(_KhachHangO.ID, sumObject).ShowDialog(this);
                break;

            case 2:
                if (dt.Count > 0)
                {
                    O_KPI SignInOz = GVKPI.GetRow(GVKPI.GetSelectedRows()[0]) as O_KPI;
                    if (SignInOz != null)
                    {
                        new frmKPIThem(SignInOz, sumObject).ShowDialog(this);
                    }
                }
                break;

            case 3:
                if (dt.Count > 0)
                {
                    O_KPI SignInOz = GVKPI.GetRow(GVKPI.GetSelectedRows()[0]) as O_KPI;
                    XuLyGiaoDien.ThongBao(Text, new D_KPI().Xoa(SignInOz.ID) > 0, true);
                    TaiLaiKPI();
                }
                break;
            }
        }