Exemplo n.º 1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                daLoaiCV = new DALoaiCongViec();
                DataSet ds1 = daLoaiCV.Load();
                int i = 0;
                foreach (DataRow row in ((DataTable)gridControl1.DataSource).Rows)
                {
                    if (row.RowState == DataRowState.Modified)
                    {
                        doLoaiCV = new DOLoaiCongViec();
                        doLoaiCV.LCV_ID = long.Parse(row["LCV_ID"].ToString());
                        doLoaiCV.MA_LCV = row["MA_LCV"].ToString();
                        doLoaiCV.NAME = row["NAME"].ToString();
                        doLoaiCV.MO_TA = row["MO_TA"].ToString();
                        doLoaiCV.VISIBLE_BIT = row["VISIBLE_BIT"].ToString();
                        daLoaiCV.Them(false, doLoaiCV);
                    }
                    if (row.RowState == DataRowState.Added)
                    {
                        doLoaiCV = new DOLoaiCongViec();
                        doLoaiCV.LCV_ID = long.Parse(row["LCV_ID"].ToString());
                        doLoaiCV.MA_LCV = row["MA_LCV"].ToString();
                        doLoaiCV.NAME = row["NAME"].ToString();
                        doLoaiCV.MO_TA = row["MO_TA"].ToString();
                        doLoaiCV.VISIBLE_BIT = row["VISIBLE_BIT"].ToString();

                        daLoaiCV.Them(true, doLoaiCV);
                    }
                    if (row.RowState == DataRowState.Deleted)
                    {
                        doLoaiCV = new DOLoaiCongViec();
                        doLoaiCV.LCV_ID = long.Parse(ds1.Tables[0].Rows[i]["LCV_ID"].ToString());
                        daLoaiCV.Xoa(doLoaiCV);
                    }
                    i++;
                }

                Load();

                btnLuu.Enabled = false;
                btnKhongLuu.Enabled = false;
            }
            catch (Exception ex)
            {
                PLMessageBox.ShowNotificationMessage(ex.Message);
            }
        }
Exemplo n.º 2
0
 private void Load()
 {
     daLoaiCV = new DALoaiCongViec();
     ds = daLoaiCV.Load();
     gridControl1.DataSource = ds.Tables[0];
 }