private void btnShowĐNNKkhacPhuc_Click(object sender, EventArgs e) { string importId = TextUtils.ToString(grvData.GetFocusedRowCellValue(colImportId)); string proposalCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colProposalCode)); string partsCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colCode)); string dateCreate = TextUtils.ToDate(grvData.GetFocusedRowCellValue(colDateCreate).ToString()).ToString("yyyy/MM/dd"); string projectCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colProjectCode)); string projectModuleCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colModuleCode)); // '"++"' string sql = "select * from vImportMaterial b with(nolock) where b.ImportId <> '" + importId + "' " + " and b.ProposalCode = '" + proposalCode + "' and b.PartsCode = '" + partsCode + "' and b.DateCreate > convert(datetime,'" + dateCreate + "') " + " and b.ProjectCode = '" + projectCode + "' and b.ProjectModuleCode = '" + projectModuleCode + "' "; //and b.Status >= 3"; DataTable dt = LibQLSX.Select(sql); if (dt.Rows.Count == 0) { return; } frmShowDNNKkhacPhuc frm = new frmShowDNNKkhacPhuc(); frm.DtData = dt; frm.Show(); }
void loadData() { if (txtEndDate.Text == "" || txtStartDate.Text == "") { MessageBox.Show("Hãy chọn một tuần trong năm!", TextUtils.Caption); return; } grdData.DataSource = null; try { string[] paraName = new string[2]; object[] paraValue = new object[2]; paraName[0] = "@FromDate"; paraValue[0] = TextUtils.ToDate(txtStartDate.Text).ToString("yyyy/MM/dd"); paraName[1] = "@ToDate"; paraValue[1] = TextUtils.ToDate(txtEndDate.Text).ToString("yyyy/MM/dd"); DataTable Source = WorksBO.Instance.LoadDataFromSP("spGetAllTimeOfUserInWeek", "Source", paraName, paraValue); grdData.DataSource = Source; } catch (Exception ex) { TextUtils.ShowError(ex); } }
void loadData() { using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load nhật ký công việc...")) { try { string[] paraName = new string[3]; object[] paraValue = new object[3]; paraName[0] = "@StartDate"; paraValue[0] = TextUtils.ToDate(dtpStartDate.EditValue.ToString()).ToString("yyyy/MM/dd"); paraName[1] = "@EndDate"; paraValue[1] = TextUtils.ToDate(dtpEndDate.EditValue.ToString()).ToString("yyyy/MM/dd"); paraName[2] = "@UserId"; paraValue[2] = TextUtils.ToString(cboUser.EditValue); DataTable Source = OrdersBO.Instance.LoadDataFromSP("spGetWorkHistoryKCS", "Source", paraName, paraValue); grdData.DataSource = Source; //if (_rownIndex >= grvData.RowCount) // _rownIndex = 0; //if (_rownIndex > 0) // grvData.FocusedRowHandle = _rownIndex; //grvData.SelectRow(_rownIndex); //grvData.BestFitColumns(); } catch { return; } } }
private void repositoryItemHyperLinkEdit1_Click_1(object sender, EventArgs e) { try { string action = grvData.GetFocusedRowCellValue(colAction).ToString(); string path = ""; File3DModel model = (File3DModel)File3DBO.Instance.FindByPK(ID); DateTime date = TextUtils.ToDate(grvData.GetFocusedRowCellValue(colDate).ToString()); if (action == "Thêm mới") { path = model.Path; } else { path = model.Path.Replace(model.Name, date.ToString("dd-MM-yyyy") + @"\" + model.Name).Trim(); } FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Chọn nơi lưu trữ"; if (fbd.ShowDialog() == DialogResult.OK) { _hu = fbd.SelectedPath + @"\" + Path.GetFileName(path); File.Copy(path, _hu, true); MessageBox.Show("Tải file xuống thành công!"); } } catch (Exception ex) { TextUtils.ShowError(ex); } }
private void treeData_NodeCellStyle(object sender, GetCustomNodeCellStyleEventArgs e) { //if (_isStyle) return; decimal percentVT = TextUtils.ToDecimal(e.Node.GetValue(colPercentVT)); decimal qty = TextUtils.ToDecimal(e.Node.GetValue(colQty)); if (e.Column == colPercentExport || e.Column == colPercentVT) { decimal percentExport = TextUtils.ToDecimal(e.Node.GetValue(colPercentExport)); if (percentVT >= 100 && percentExport >= 100) { e.Appearance.BackColor = Color.GreenYellow; } if (percentVT >= 100 && percentExport < 100) { e.Appearance.BackColor = Color.Yellow; } //if (percentVT == 0 && qty == 0) //{ // e.Appearance.BackColor = Color.MediumTurquoise; //} } if (e.Column == colDateAboutE && percentVT < 100) { if (qty == 0) { return; } if (TextUtils.ToDate3(e.Node.GetValue(colDateAboutE)).Date > TextUtils.ToDate3(dtpSXLRDeadline.EditValue).Date) { e.Appearance.BackColor = Color.Red; } else { if (TextUtils.ToInt(e.Node.GetValue(colTotalDateAboutENull)) > 0) { e.Appearance.BackColor = Color.Orange; } } } if (e.Column == colIN || e.Column == colCNC || e.Column == colPCB || e.Column == colGCAL || e.Column == colLR) { string date = TextUtils.ToString(e.Node.GetValue(e.Column)); if (date.Contains("-")) { DateTime dateDK = TextUtils.ToDate(date); if (DateTime.Now.Date > dateDK.Date) { e.Appearance.BackColor = Color.Red; } } } //_isStyle = true; }
public void Save(ref DataTable dt) { if (searchLookUpEdit1.EditValue == null) { XtraMessageBox.Show("Xin mời bạn chọn dự án"); return; } grvData.FocusedRowHandle = -1; if (kt == false) { return; } DataTable dtRemine; dtRemine = grdData.DataSource as DataTable; { for (int i = 0; i < dtRemine.Rows.Count; i++) { SanPhamDAModel model = new SanPhamDAModel(); model.ProjectsID = searchLookUpEdit1.EditValue.ToString(); model.TenTheoHopDong = dtRemine.Rows[i]["TenTheoHopDong"].ToString(); model.MaTheoHopDong = dtRemine.Rows[i]["MaTheoHopDong"].ToString(); model.TenTheoThietKe = dtRemine.Rows[i]["TenTheoThietKe"].ToString(); model.MaTheoThietKe = dtRemine.Rows[i]["MaTheoThietKe"].ToString(); model.ThoiGianThietKe = TextUtils.ToInt(dtRemine.Rows[i]["ThoiGianThietKe"].ToString()); model.ThoiGianBDDuKien = TextUtils.ToDate(dtRemine.Rows[i]["ThoiGianBDDuKien"].ToString()); model.ThoiGianBDThucTe = (dtRemine.Rows[i]["ThoiGianBDThucTe"].ToString()); model.ThoiGianKTDuKien = TextUtils.ToDate(dtRemine.Rows[i]["ThoiGianKTDuKien"].ToString()); model.ThoiGianKTThucTe = (dtRemine.Rows[i]["ThoiGianKTThucTe"].ToString()); model.TinhTrang = dtRemine.Rows[i]["TinhTrang"].ToString();; model.NhomPhuTrach = dtRemine.Rows[i]["NhomPhuTrach"].ToString();; model.MucDoUuTien = dtRemine.Rows[i]["MucDoUuTien"].ToString();; model.LoaiCongViec = dtRemine.Rows[i]["LoaiCongViec"].ToString();; if (dtRemine.Rows[i][colID.FieldName] == DBNull.Value) //add new) { //if (XtraMessageBox.Show("Dữ liệu đã bị thay đổi\nBạn có muốn lưu vào cơ sở dữ liệu không?","Xác nhận",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes) { SanPhamDABO.Instance.Insert(model); } { } } else { //if (XtraMessageBox.Show("Dữ liệu đã bị thay đổi\nBạn có muốn lưu vào cơ sở dữ liệu không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { model.ID = Convert.ToInt32(dtRemine.Rows[i]["ID"].ToString()); SanPhamDABO.Instance.Update(model); } //XtraMessageBox.Show("U thành công!", "Thông báo"); } } XtraMessageBox.Show("Xử lý thành công!", "Thông báo"); } }
private void grvData_RowCellStyle(object sender, RowCellStyleEventArgs e) { if (e.RowHandle < 0) { return; } GridView View = sender as GridView; DateTime completeDateDK = TextUtils.ToDate(View.GetRowCellValue(e.RowHandle, colCompletedDateDK).ToString()); string completeDate = TextUtils.ToString(View.GetRowCellValue(e.RowHandle, colCompletedDate)); if (completeDateDK.Date <= DateTime.Now.Date && completeDate == "") { e.Appearance.BackColor = Color.Yellow; } }
private void btnSaveDateDK_Click(object sender, EventArgs e) { grvDebt.FocusedRowHandle = -1; for (int i = 0; i < grvDebt.RowCount; i++) { try { long id = TextUtils.ToInt64(grvDebt.GetRowCellValue(i, colDebtID)); PayVoucherDebtModel model = (PayVoucherDebtModel)PayVoucherDebtBO.Instance.FindByPK(id); model.CompletedDateDK = TextUtils.ToDate(grvDebt.GetFocusedRowCellValue(colDebtCompletedDateDK).ToString()); PayVoucherDebtBO.Instance.Update(model); } catch (Exception) { } } MessageBox.Show("Lưu trữ ngày trả dự kiến thànhg công!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void grvDebt_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.RowHandle < 0) { return; } GridView View = sender as GridView; string completeDate = TextUtils.ToString(View.GetRowCellValue(e.RowHandle, colDebtCompletedDate)); DateTime completeDateDK = TextUtils.ToDate(View.GetRowCellValue(e.RowHandle, colDebtCompletedDateDK).ToString()); if (completeDate == "") { if (completeDateDK.Date <= DateTime.Now.Date) { e.Appearance.BackColor = Color.Red; } else { e.Appearance.BackColor = Color.Yellow; } } }
public void Save(ref DataTable dt) { grvData.FocusedRowHandle = -1; DataTable dtRemine; dtRemine = dt.GetChanges(); if (dtRemine != null) { foreach (DataRow item in dtRemine.Rows) { ProjectSynModel model = new ProjectSynModel(); model.ProjectId = item["ProjectId"].ToString(); // model.CustomerId = item["CustomerId"].ToString(); model.ProjectName = item["ProjectName"].ToString(); model.ProjectCode = item["ProjectCode"].ToString(); model.TimeMake = TextUtils.ToInt(item["TimeMake"].ToString()); model.DateFinishE = TextUtils.ToDate(item["DateFinishE"].ToString()); model.DateFinishF = TextUtils.ToDate(item["DateFinishF"].ToString()); model.Note = item["Note"].ToString(); model.Status = TextUtils.ToInt(item["Status"].ToString()); //model.ProjectType = null; //model.DateCreate = TextUtils.ToDate(item["DateCreate"].ToString()); //model.StatusDisable = item["StatusDisable"].ToString(); // model.UserId = item["UserId"].ToString(); model.DateSingingContract = TextUtils.ToDate(item["DateSingingContract"].ToString()); // model.ID = item["ID"].ToString(); if (item["ID"] == DBNull.Value) //add new) { ProjectSynBO.Instance.Insert(model); } else { model.ID = Convert.ToInt32(item["ID"].ToString()); ProjectSynBO.Instance.Update(model); } } } }
private void btnSave_Click(object sender, EventArgs e) { ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); progressBar1.Visible = true; progressBar1.Minimum = 0; progressBar1.Maximum = grvData.RowCount; progressBar1.Value = 0; for (int i = 0; i < grvData.RowCount; i++) { try { string filePath = Path.Combine(_dPath, grvData.GetRowCellValue(i, colName).ToString()); if (filePath != grvData.GetRowCellValue(i, colPath).ToString()) { FileInfo fi = new FileInfo(filePath); if (File.Exists(filePath)) { DialogResult result = MessageBox.Show("Đã tồn tại file: [" + grvData.GetRowCellValue(i, colName).ToString() + "] trên thư viện." + Environment.NewLine + "Bạn có muốn upload file không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { //Tạo một folder chứa file cũ string folderPath = Path.GetDirectoryName(filePath) + @"\" + DateTime.Now.ToString("dd-MM-yyyy"); Directory.CreateDirectory(folderPath); File.Copy(filePath, folderPath + @"\" + fi.Name, true); File.Delete(filePath); File.Copy(grvData.GetRowCellValue(i, colPath).ToString(), filePath, true); } } else { File.Copy(grvData.GetRowCellValue(i, colPath).ToString(), Path.Combine(_dPath, grvData.GetRowCellValue(i, colName).ToString())); } } //Kiểm tra đã có trong cơ sở dữ liệu hay chưa ArrayList listFile = new ArrayList(); try { listFile = File3DBO.Instance.FindByExpression(new Expression("Name", Path.GetFileName(filePath)) .And(new Expression("ProductGroupID", _gModel.ID))); } catch (Exception) { } if (listFile.Count == 0) { File3DModel model = new File3DModel(); model.Datemodified = TextUtils.ToDate(grvData.GetRowCellValue(i, colDatemodified).ToString()); model.Length = TextUtils.ToDecimal(grvData.GetRowCellValue(i, colLength)); model.Name = Path.GetFileName(grvData.GetRowCellValue(i, colPath).ToString()); model.ProductGroupID = CatID; model.Path = @"" + filePath; pt.Insert(model); } else { File3DModel model1 = (File3DModel)listFile[0]; model1.Length = TextUtils.ToDecimal(grvData.GetRowCellValue(i, colLength)); model1.Datemodified = TextUtils.ToDate(grvData.GetRowCellValue(i, colDatemodified).ToString()); pt.Update(model1); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi"); continue; } progressBar1.Value += i; } progressBar1.Visible = false; pt.CommitTransaction(); pt.CloseConnection(); MessageBox.Show("Lưu trữ thành công.", "Thông báo"); DialogResult = DialogResult.OK; }
private void grvData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { try { GridView view = sender as GridView; int l = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colThoiGianDuKien)); int k = l / 8; int lp = l % 8; if (lp == 0 && k != 0) { k--; } //set tinh trang mac dinh if (view.GetRowCellValue(e.RowHandle, colTinhTrang).ToString() == string.Empty || view.GetRowCellValue(e.RowHandle, colTinhTrang) == null) { view.SetRowCellValue(e.RowHandle, colTinhTrang, 0); } //set thoi gian bat dau neu bo trong if (view.GetRowCellValue(e.RowHandle, colThoiGianBD).ToString() == string.Empty) { view.SetRowCellValue(e.RowHandle, colThoiGianBD, Convert.ToDateTime(DateTime.Now)); } DateTime op = DateTime.Now; if (l <= 8) { op = (Convert.ToDateTime(view.GetRowCellValue(e.RowHandle, colThoiGianBD)).AddHours(TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colThoiGianDuKien)))); } else { op = (Convert.ToDateTime(view.GetRowCellValue(e.RowHandle, colThoiGianBD)).AddDays(k)); } DateTime df = TextUtils.ToDate(TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBD).ToString()).ToString("dd/MM/yyyy") + " 12:00:00"); if (op.ToString("dd/MM/yyyy") == df.ToString("dd/MM/yyyy")) { if (op.Hour >= 17 && op.Minute > 0) { int du = op.Hour; int mi = op.Minute; op = op.AddDays(1); op = TextUtils.ToDate(op.ToString("dd/MM/yyyy") + " 8:00:00"); op = op.AddHours(du - 17).AddMinutes(mi); view.SetRowCellValue(e.RowHandle, colThoiGianKT, op); } else if (TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBD).ToString()) <= df && op > df) { view.SetRowCellValue(e.RowHandle, colThoiGianKT, op.AddHours(1)); } else { view.SetRowCellValue(e.RowHandle, colThoiGianKT, op); } } else { l = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colThoiGianDuKien)); int kl = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBD).ToString()).Hour; l = l - ThoiGianConLai(kl); k = l / 8; lp = l % 8; op = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBD).ToString()); op = TextUtils.ToDate(op.ToString("dd/MM/yyyy") + " 8:00:00"); DateTime kh = op.AddDays(k + 1).AddHours(lp); if (kh.Hour > 12) { kh.AddHours(1); } view.SetRowCellValue(e.RowHandle, colThoiGianKT, kh); } #region Add and update { TheoDoiModel model = new TheoDoiModel(); //model.ID =TextUtils.ToInt(item["ID"]); //model.TenCV = view.GetRowCellValue(e.RowHandle, colTenCV).ToString();// //model.MaDA = view.GetRowCellValue(e.RowHandle, colMaDA).ToString();//Convert.ToString(item["MaDA"]); //model.MaTB = view.GetRowCellValue(e.RowHandle, colMaTB).ToString();//Convert.ToString(item["MaTB"]); //model.NguoiPhuTrach = TextUtils.ToInt(Global.UserID);//item["NguoiPhuTrach"]); //model.ThoiGianBD = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBD).ToString());//item["ThoiGianBD"].ToString()); //model.ThoiGianKT = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianKT).ToString());//item["ThoiGianKT"].ToString()); //model.TinhTrang = view.GetRowCellValue(e.RowHandle, colTinhTrang).ToString();// Convert.ToString(item["TinhTrang"]); //model.GhiChu = view.GetRowCellValue(e.RowHandle, colGhiChu).ToString();// Convert.ToString(item["GhiChu"]); //model.GioBD = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colGioBD).ToString());//item["GioBD"]); model.ThoiGianDuKien = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colThoiGianDuKien).ToString()); //item["ThoiGianDuKien"]); //model.GioKT = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colGioKT).ToString());//item["GioKT"]); if (view.GetRowCellValue(e.RowHandle, colID) == DBNull.Value) //add new { TheoDoiBO.Instance.Insert(model); } else //Update { if (view.GetRowCellValue(e.RowHandle, colNguoiPhuTrach).ToString() == Global.UserID.ToString()) { model.ID = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colID).ToString()); TheoDoiBO.Instance.Update(model); } else { e.Valid = true; XtraMessageBox.Show("Bạn không thể sửa dữ liệu của người khác"); } } } #endregion } catch (Exception ex) { MessageBox.Show(ex.Message); } SelectAll(ref m_DataSource, grdData); }
void gggggggg() { DataTable dt = new DataTable(); foreach (GridColumn colum in grvNhanVien.Columns) { dt.Columns.Add(colum.FieldName, colum.ColumnType); } for (int i = 0; i < grvNhanVien.DataRowCount; i++) { DataRow row = dt.NewRow(); foreach (GridColumn colum in grvNhanVien.Columns) { row[colum.FieldName] = grvNhanVien.GetRowCellValue(i, colum); } dt.Rows.Add(row); } foreach (DataRow item1 in df.Rows) { DateTime Tomau = TextUtils.ToDate(item1["ThoiGianBDDuKien"].ToString()); foreach (DataRow item in dt.Rows) { if (item1["FullName"] == item["FullName"]) { if (item["ff"] == "Dự kiến") { foreach (DataColumn item2 in dt.Columns) { if (item2.ColumnName == Tomau.ToString("dd/MM/yyyy")) { item[item2.ColumnName] = item1["tongtg"].ToString(); } } } } else { } } //foreach (DataColumn item2 in dt.Columns) //{ // if (item.ColumnName == Tomau.ToString("dd/MM/yyyy")) // { //if (item == item1["FullName"].ToString()) //{ // if (View.GetRowCellValue(e.RowHandle, colThoiGian).ToString() == "Dự kiến") // { // if (e.Column == item) // { // int tongh = Convert.ToInt32(item1["tongtg"].ToString()); // if (tongh <= 8) // { // e.DisplayText = item1["tongtg"].ToString(); // } // else // { // int giat = tongh / 8; // int thua = tongh % 8; // e.DisplayText = "8"; // grvNhanVien.SetFocusedRowCellValue("thu2", thua); // } // } // } //} // } //} } }
private void grvData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView view = sender as GridView; try { #region checkvailidate if (view.GetRowCellValue(e.RowHandle, colTenHangMuc).ToString() == string.Empty) { e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colThoiGianTK).ToString() == string.Empty) { e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString() == string.Empty) { e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colUserTK).ToString() == string.Empty) { e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colThuTuUuTien).ToString() == string.Empty) { e.Valid = false; return; } int l = Convert.ToInt32(view.GetRowCellValue(e.RowHandle, colThoiGianTK)); int k = l / 8; int lp = l % 8; if (lp == 0) { k--; } if (view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString() != string.Empty) { view.SetRowCellValue(e.RowHandle, colThoiGianKTDuKien, Convert.ToDateTime(view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien)).AddDays(k)); } #endregion HangMucCongViecModel model = new HangMucCongViecModel(); model.TenHangMuc = view.GetRowCellValue(e.RowHandle, colTenHangMuc).ToString(); // dtRemine.Rows[i]["TenHangMuc"].ToString(); model.ThoiGianTK = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colThoiGianTK).ToString()); //dtRemine.Rows[i]["ThoiGianTK"].ToString()); model.ThoiGianBDDuKien = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString()); //dtRemine.Rows[i]["ThoiGianBDDuKien"].ToString()); model.ThoiGianKTDuKien = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianKTDuKien).ToString()); //dtRemine.Rows[i]["ThoiGianKTDuKien"].ToString()); model.TinhTrang = view.GetRowCellValue(e.RowHandle, colTinhTrang).ToString(); // dtRemine.Rows[i]["TinhTrang"].ToString(); model.NguoiThietKe = view.GetRowCellValue(e.RowHandle, colUserTK).ToString(); // dtRemine.Rows[i]["NguoiThietKe"].ToString(); model.MucDoUuTien = view.GetRowCellValue(e.RowHandle, colMucDoUuTien).ToString(); // dtRemine.Rows[i]["MucDoUuTien"].ToString(); model.KieuCongViec = view.GetRowCellValue(e.RowHandle, colKieuCongViec).ToString(); //dtRemine.Rows[i]["KieuCongViec"].ToString(); model.Loi = view.GetRowCellValue(e.RowHandle, colLoi).ToString(); //dtRemine.Rows[i]["Loi"].ToString(); if (XtraMessageBox.Show("Dữ liệu đã bị thay đổi\nBạn có muốn lưu vào cơ sở dữ liệu không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { model.SanPhamDAID = Convert.ToInt32(grvDataSP.GetRowCellValue(grvDataSP.FocusedRowHandle, colID).ToString()); if (view.GetRowCellValue(e.RowHandle, colID) == DBNull.Value) //add new { //insert HangMucCongViecBO.Instance.Insert(model); } else { model.ID = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colID).ToString()); //update HangMucCongViecBO.Instance.Update(model); } } else { e.Valid = false; } lookUpEdit1_EditValueChanged(null, null); tinhgio(); grvNhanVien_CustomDrawCell(null, null); //grvNhanVien.FocusedRowHandle = -1; grvNhanVien.FocusedRowHandle = 0; ////DataTable hu = grdNhanVien.DataSource as DataTable; } catch (Exception) { throw; } }
private void grvNhanVien_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { try { GridView View = sender as GridView; if (df != null) { foreach (DataRow item1 in df.Rows) { if (View.GetRowCellValue(e.RowHandle, colNhanVien).ToString() == item1["FullName"].ToString()) { if (View.GetRowCellValue(e.RowHandle, colThoiGian).ToString() == "Dự kiến") { DateTime Tomau = TextUtils.ToDate(item1["ThoiGianBDDuKien"].ToString()); DateTime Tomau1 = TextUtils.ToDate(item1["ThoiGianKTDuKien"].ToString()); _paraName[0] = "@NgayBD"; _paraValue[0] = Tomau; _paraName[1] = "@NgayKT"; _paraValue[1] = Tomau1; //DataTable hu = TextUtils.Select("select distinct ThoiGianBDDuKienSP as ThoiGianBDDuKien,ThoiGianKTDuKienSP as ThoiGianKTDuKien,Name from vHangMucCongViec where ThoiGianKTDuKien between " + NgayBD + " and " + NgayKT); DataTable Source2 = ModulesBO.Instance.LoadDataFromSP("sp_ThongKeTHeoNhom1", "Source", _paraName, _paraValue); if (Source2 != null) { if (Source2.Rows.Count > 0) { Tomau1 = Tomau1.AddDays(Source2.Rows.Count); } } if (TextUtils.DateDiff("d", Tomau1, Tomau) >= 0) { foreach (GridColumn item in View.Columns) { for (int i = 0; i <= TextUtils.DateDiff("d", Tomau1, Tomau); i++) { DateTime tBNgay = Tomau.AddDays(i); if (TextUtils.DateDiff("d", Tomau1, tBNgay) > 0) { if (tBNgay.ToString("dd/MM/yyyy") == item.ToolTip) { if (e.Column == item) { { e.DisplayText = "8"; e.Appearance.BackColor = Color.Orange; } break; } } } else if (TextUtils.DateDiff("d", Tomau1, tBNgay) == 0) { if (tBNgay.ToString("dd/MM/yyyy") == item.ToolTip) { if (e.Column == item) { { e.DisplayText = item1["du"].ToString(); e.Appearance.BackColor = Color.Orange; } break; } } } else { return; } } } } } } } } } catch (Exception) { return; throw; } //try //{ // GridView View = sender as GridView; // if (df != null) // { // foreach (DataRow item1 in df.Rows) // { // if (View.GetRowCellValue(e.RowHandle, colNhanVien).ToString() == item1["FullName"].ToString()) // { // if (View.GetRowCellValue(e.RowHandle, colThoiGian).ToString() == "Dự kiến") // { // DateTime Tomau = TextUtils.ToDate(item1["ThoiGianBDDuKien"].ToString()); // DateTime Tomau1 = TextUtils.ToDate(item1["ThoiGianKTDuKien"].ToString()); // if (TextUtils.DateDiff("d", Tomau1, Tomau) > 0) // { // for (int i = 0; i <= TextUtils.DateDiff("d", Tomau1, Tomau); i++) // { // DateTime tBNgay = Tomau.AddDays(i); // if (TextUtils.DateDiff("d", Tomau1, tBNgay) > 0) // { // foreach (GridColumn item in View.Columns) // { // if (tBNgay.ToString("dd/MM/yyyy") == item.ToolTip) // { // if (e.Column == item) // { // e.Appearance.BackColor = Color.Orange; // e.DisplayText = "8"; // break; // } // } // } // } // if (TextUtils.DateDiff("d", Tomau1, tBNgay) == 0) // { // foreach (GridColumn item in View.Columns) // { // if (tBNgay.ToString("dd/MM/yyyy") == item.ToolTip) // { // if (e.Column == item) // { // { // e.Appearance.BackColor = Color.Orange; // e.DisplayText = item1["du"].ToString(); // } // break; // } // } // } // } // } // } // } // } // } // } //} //catch (Exception) //{ // return; // throw; //} //try //{ // GridView View = sender as GridView; // if (df != null) // { // foreach (GridColumn item in View.Columns) // { // foreach (DataRow item1 in df.Rows) // { // DateTime Tomau = TextUtils.ToDate(item1["ThoiGianBDDuKien"].ToString()); // if (Tomau.ToString("dd/MM/yyyy") == item.ToolTip) // { // if (View.GetRowCellValue(e.RowHandle, colNhanVien).ToString() == item1["FullName"].ToString()) // { // if (View.GetRowCellValue(e.RowHandle, colThoiGian).ToString() == "Dự kiến") // { // if (e.Column == item) // { // int tongh = Convert.ToInt32(item1["tongtg"].ToString()); // if (tongh <= 8) // { // e.DisplayText = item1["tongtg"].ToString(); // } // else // { // int giat = tongh / 8; // int thua = tongh % 8; // e.DisplayText = tongh.ToString(); // grvNhanVien.SetFocusedRowCellValue("thu2", thua); // } // } // } // } // } // else // continue; // } // } // } //} //catch (Exception) //{ // return; // throw; //} }
private void grvData_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { try { GridView View = sender as GridView; if (e.RowHandle >= 0) { if (View.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString().Trim() != "") { if (View.GetRowCellValue(e.RowHandle, colThoiGianKTDuKien).ToString().Trim() != "") { DateTime Tomau = TextUtils.ToDate(View.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString().Trim()); DateTime Tomau1 = TextUtils.ToDate(View.GetRowCellValue(e.RowHandle, colThoiGianKTDuKien).ToString().Trim()); if (TextUtils.DateDiff("d", Tomau1, Tomau) < 0) { return; } else if (TextUtils.DateDiff("d", Tomau1, Tomau) > 0) { foreach (GridColumn item in View.Columns) { for (int i = 0; i < 55; i++) { DateTime tBNgay = Tomau.AddDays(i); if (TextUtils.DateDiff("d", Tomau1, tBNgay) > 0) { if (tBNgay.ToString("dd/MM/yyyy") == item.ToolTip) { if (e.Column == item) { e.Appearance.BackColor = Color.Orange; break; } } } else { break; } } } } foreach (GridColumn item in View.Columns) { if (Tomau1.ToString("dd/MM/yyyy") == item.ToolTip) { if (e.Column == item) { e.Appearance.BackColor = Color.Orange; } } } } } } } catch (Exception) { return; throw; } }
private void btnSave_Click(object sender, EventArgs e) { for (int i = 1; i < grvData.RowCount; i++) { try { if (grvData.GetRowCellValue(i, "1") == null) { continue; } string code = grvData.GetRowCellValue(i, "1").ToString(); if (code == "") { continue; } DepartmentModel department = null; DepartmentModel departmentKP = null; UsersModel userFind = null; try { department = (DepartmentModel)DepartmentBO.Instance.FindByAttribute("Code", grvData.GetRowCellValue(i, "7").ToString())[0]; } catch { } try { departmentKP = (DepartmentModel)DepartmentBO.Instance.FindByAttribute("Code", grvData.GetRowCellValue(i, "10").ToString())[0]; } catch { } try { userFind = (UsersModel)UsersBO.Instance.FindByAttribute("LoginName", grvData.GetRowCellValue(i, "16").ToString())[0]; } catch { } ModulesModel module = null; string moduleCode = ""; try { moduleCode = grvData.GetRowCellValue(i, "5").ToString(); module = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", grvData.GetRowCellValue(i, "5").ToString().Substring(0, 10))[0]; } catch { } ModuleErrorModel error; if (!ModuleErrorBO.Instance.CheckExist("Code", code)) { error = new ModuleErrorModel(); } else { error = (ModuleErrorModel)ModuleErrorBO.Instance.FindByAttribute("Code", code)[0]; } //error.Description = moduleCode.Length == 10 ? grvData.GetRowCellValue(i, "6").ToString() : moduleCode + ": " // + grvData.GetRowCellValue(i, "6").ToString(); //error.HuongKhacPhucTamThoi = grvData.GetRowCellValue(i, "9").ToString(); //error.Status = grvData.GetRowCellValue(i, "12").ToString().Trim().ToLower() == "ok" ? 1 : 0; //error.StatusTK = grvData.GetRowCellValue(i, "12").ToString().Trim().ToLower() == "ok" ? 1 : 0; //error.DepartmentID = department == null ? 0 : department.ID; //error.DepartmentKPID = departmentKP == null ? 0 : departmentKP.ID; //error.Reason = grvData.GetRowCellValue(i, "8") == null ? "" : grvData.GetRowCellValue(i, "8").ToString(); //error.UserFindID = userFind == null ? 0 : userFind.ID; //error.CreatedBy = "thao.nv"; error.UpdatedDate = TextUtils.ToDate(grvData.GetRowCellValue(i, "2").ToString()); error.CreatedDate = TextUtils.ToDate(grvData.GetRowCellValue(i, "2").ToString()); error.CompleteTimeTK = TextUtils.ToDate(grvData.GetRowCellValue(i, "11").ToString()); if (error.ID == 0) { error.Code = code; error.ModuleID = module == null ? 0 : module.ID; ModuleErrorBO.Instance.Insert(error); } else { ModuleErrorBO.Instance.Update(error); } } catch (Exception) { } } MessageBox.Show("Thêm lỗi thành công!"); }
private void btnSave_Click(object sender, EventArgs e) { for (int i = 0; i < grvData.RowCount; i++) { string departmentCode = grvData.GetRowCellValue(i, "colPB").ToString(); if (departmentCode == "TK") { continue; } ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); try { UsersModel Model = new UsersModel(); try { Model.BirthOfDate = TextUtils.ToDate(grvData.GetRowCellValue(i, "colBirdDate").ToString()); } catch { Model.BirthOfDate = DateTime.Now; } Model.CMTND = grvData.GetRowCellValue(i, "colCMT").ToString(); Model.Code = grvData.GetRowCellValue(i, "colCode").ToString(); Model.DepartmentID = ((DepartmentModel)DepartmentBO.Instance.FindByAttribute("Code", departmentCode)[0]).ID; Model.FullName = grvData.GetRowCellValue(i, "colName").ToString(); Model.Qualifications = grvData.GetRowCellValue(i, "colTrinhDo").ToString(); try { Model.StartWorking = TextUtils.ToDate(grvData.GetRowCellValue(i, "colStartDate").ToString()); } catch { Model.StartWorking = DateTime.Now; } Model.Status = 0; if (grvData.GetRowCellValue(i, "colLogin").ToString() != "") { Model.LoginName = grvData.GetRowCellValue(i, "colLogin").ToString(); Model.PasswordHash = MD5.EncryptPassword("123456"); } else { Model.LoginName = ""; Model.PasswordHash = ""; } if (Model.ID == 0) { Model.CreatedDate = TextUtils.GetSystemDate(); Model.CreatedBy = Global.AppUserName; Model.UpdatedDate = Model.CreatedDate; Model.UpdatedBy = Global.AppUserName; Model.ID = (int)pt.Insert(Model); } else { Model.UpdatedDate = TextUtils.GetSystemDate(); Model.UpdatedBy = Global.AppUserName; pt.Update(Model); } pt.CommitTransaction(); } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } } }
private void grvData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView view = sender as GridView; ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); VatTuThayTheModel Model = new VatTuThayTheModel(); Model.STT = TextUtils.ToInt(grvData.GetRowCellValue(e.RowHandle, "STT").ToString()); Model.Ngay = TextUtils.ToDate(grvData.GetRowCellValue(e.RowHandle, "Ngay").ToString()); Model.NameTK = grvData.GetRowCellValue(e.RowHandle, "NameTK").ToString(); Model.NameTT = grvData.GetRowCellValue(e.RowHandle, "NameTT").ToString(); Model.CodeTK = grvData.GetRowCellValue(e.RowHandle, "CodeTK").ToString(); Model.CodeTT = grvData.GetRowCellValue(e.RowHandle, "CodeTT").ToString(); Model.HangTK = grvData.GetRowCellValue(e.RowHandle, "HangTK").ToString(); Model.HangTT = grvData.GetRowCellValue(e.RowHandle, "HangTT").ToString(); Model.ThuocThietBi = grvData.GetRowCellValue(e.RowHandle, "ThuocThietBi").ToString(); Model.ChiTietLienQuan = grvData.GetRowCellValue(e.RowHandle, "ChiTietLienQuan").ToString(); Model.Status = grvData.GetRowCellValue(e.RowHandle, "Status").ToString(); Model.CodeAfter = grvData.GetRowCellValue(e.RowHandle, "CodeAfter").ToString(); Model.Note = grvData.GetRowCellValue(e.RowHandle, "Note").ToString(); Model.Type = _type; //Kiểm tra đây là dòng dữ liệu mới hay cũ, nếu là mới thì mình insert if (view.IsNewItemRow(e.RowHandle)) { try { Model.CreatedDate = TextUtils.GetSystemDate(); Model.CreatedBy = Global.AppUserName; Model.UpdatedDate = Model.CreatedDate; Model.UpdatedBy = Global.AppUserName; Model.ID = (int)pt.Insert(Model); pt.CommitTransaction(); } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } } //Cũ thì update else { if (MessageBox.Show("Bạn có chắc chắn muốn cập nhật?", TextUtils.Caption, MessageBoxButtons.YesNo) == DialogResult.Yes) { try { int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); Model.ID = id; Model.UpdatedDate = TextUtils.GetSystemDate(); Model.UpdatedBy = Global.AppUserName; pt.Update(Model); pt.CommitTransaction(); } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } } } LoadGrid(); }
private void btnSave_Click(object sender, EventArgs e) { ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); try { if (checkValid()) { ModuleFilmModel dModel; if (_isAdd) { dModel = new ModuleFilmModel(); } else { int ID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); dModel = (ModuleFilmModel)ModuleFilmBO.Instance.FindByPK(ID); } dModel.Code = txtCode.Text.ToUpper().Trim(); dModel.LastDateChange = TextUtils.ToDate(deUpdatedDate.EditValue.ToString()); dModel.LastTimeChange = TextUtils.ToInt(txtTime.Text.Trim()); dModel.ModuleID = ModuleID; if (_isAdd) { pt.Insert(dModel); } else { pt.Update(dModel); if (txtReason.Enabled) { ModuleFilmHistoryModel hModel = new ModuleFilmHistoryModel(); hModel.ModuleFilmID = dModel.ID; hModel.LastTimeChange = dModel.LastTimeChange; hModel.LastDateChange = dModel.LastDateChange; hModel.Reason = txtReason.Text.Trim(); hModel.UpdatedDate = TextUtils.GetSystemDate(); hModel.UpdatedBy = Global.AppUserName; hModel.Code = dModel.Code; pt.Insert(hModel); } } pt.CommitTransaction(); LoadData(); setInterface(false); clearInterface(); } } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } }
private void bandedGridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { try { GridView View = sender as GridView; if (Source != null) { foreach (DataRow item1 in Source.Rows) { if (View.GetRowCellValue(e.RowHandle, colNhom).ToString() == item1["Name"].ToString()) { DateTime Tomau = TextUtils.ToDate(item1["ThoiGianBDDuKien"].ToString()); DateTime Tomau1 = TextUtils.ToDate(item1["ThoiGianKTDuKien"].ToString()); _paraName[0] = "@NgayBD"; _paraValue[0] = Tomau; _paraName[1] = "@NgayKT"; _paraValue[1] = Tomau1; //DataTable hu = TextUtils.Select("select distinct ThoiGianBDDuKienSP as ThoiGianBDDuKien,ThoiGianKTDuKienSP as ThoiGianKTDuKien,Name from vHangMucCongViec where ThoiGianKTDuKien between " + NgayBD + " and " + NgayKT); DataTable Source2 = ModulesBO.Instance.LoadDataFromSP("sp_ThongKeTHeoNhom1", "Source", _paraName, _paraValue); if (Source2 != null) { if (Source2.Rows.Count > 0) { Tomau1 = Tomau1.AddDays(Source2.Rows.Count); } } if (TextUtils.DateDiff("d", Tomau1, Tomau) >= 0) { foreach (GridColumn item in View.Columns) { for (int i = 0; i <= TextUtils.DateDiff("d", Tomau1, Tomau); i++) { DateTime tBNgay = Tomau.AddDays(i); if (TextUtils.DateDiff("d", Tomau1, tBNgay) >= 0) { if (tBNgay.ToString("dd/MM/yyyy") == item.ToolTip) { if (e.Column == item) { if (e.Appearance.BackColor == Color.Orange) { e.Appearance.BackColor = Color.Red; } else { e.Appearance.BackColor = Color.Orange; } break; } } } else { return; } } } } } } } } catch (Exception) { return; throw; } }
private void btnSave_Click(object sender, EventArgs e) { ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); try { if (!ValidateForm()) { return; } Model.BankAccount = txtBankAccount.Text.Trim(); Model.BHXH = txtBHXH.Text.Trim(); Model.BHYT = txtBHYT.Text.Trim(); try { Model.BirthOfDate = TextUtils.ToDate(dtpBirthOfDate.EditValue.ToString()); } catch { Model.BirthOfDate = DateTime.Now; } Model.CMTND = txtCMTND.Text.Trim(); Model.Code = txtCode.Text.Trim(); Model.DepartmentID = TextUtils.ToInt(cboDepartment.SelectedValue); Model.Email = txtEmail.Text.Trim(); Model.EmailCom = txtEmailCom.Text.Trim(); Model.FullName = txtFullName.Text; Model.HandPhone = txtTelephone.Text; Model.HomeAddress = txtHomeAddress.Text; Model.JobDescription = txtJobDescription.Text.Trim(); Model.MST = txtMST.Text.Trim(); Model.Position = txtPosition.Text; Model.Qualifications = txtQualifications.Text.Trim(); Model.Sex = cboSex.SelectedIndex; Model.UserGroupID = TextUtils.ToInt(lookUpEdit1.EditValue); try { Model.StartWorking = TextUtils.ToDate(dtpStartWorking.EditValue.ToString()); } catch { Model.StartWorking = DateTime.Now; } Model.ImagePath = pictureBox1.ImageLocation; Model.Status = cboStatus.SelectedIndex; if (chkHasUser.Checked) { Model.LoginName = txtLoginName.Text.Trim(); Model.PasswordHash = MD5.EncryptPassword(txtPasswordHash.Text.Trim()); } else { Model.LoginName = ""; Model.PasswordHash = ""; } Model.UpdatedDate = Model.CreatedDate; Model.UpdatedBy = Global.AppUserName; if (Model.ID == 0) { Model.CreatedDate = TextUtils.GetSystemDate(); Model.CreatedBy = Global.AppUserName; Model.ID = (int)pt.Insert(Model); } else { pt.Update(Model); } pt.CommitTransaction(); //this.DialogResult = DialogResult.OK; MessageBox.Show("Lưu trữ thành công!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.LoadDataChange != null) { this.LoadDataChange(null, null); } } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } }
private void grvData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView view = sender as GridView; try { kt = true; #region check vailidate //string gg=Convert.ToDateTime(view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien)).ToString("yyyy/MM/dd"); //if (SanPhamDABO.Instance.CheckExist("ThoiGianBDDuKien",gg)) //{ // e.Valid = false; // return; //}else //{ //} if (view.GetRowCellValue(e.RowHandle, colTenTheoHopDong).ToString() == string.Empty) { e.Valid = false; kt = false; return; } else if (view.GetRowCellValue(e.RowHandle, colMaTheoThietKe).ToString() == string.Empty) { e.Valid = false; kt = false; return; } else if (view.GetRowCellValue(e.RowHandle, colThoiGianThietKe).ToString() == string.Empty) { kt = false; e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString() == string.Empty) { kt = false; e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colNhomPhuTrach).ToString() == string.Empty) { kt = false; e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colMucDoUuTien).ToString() == string.Empty) { kt = false; e.Valid = false; return; } else if (view.GetRowCellValue(e.RowHandle, colLoaiCongViec).ToString() == string.Empty) { kt = false; e.Valid = false; return; } int l = Convert.ToInt32(view.GetRowCellValue(e.RowHandle, colThoiGianThietKe)); int k = l / 8; int lp = l % 8; if (lp == 0) { k--; } if (view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString() != string.Empty) { view.SetRowCellValue(e.RowHandle, colThoiGianKTDuKien, Convert.ToDateTime(view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien)).AddDays(k)); } #endregion SanPhamDAModel model = new SanPhamDAModel(); model.ProjectsID = searchLookUpEdit1.EditValue.ToString(); model.TenTheoHopDong = view.GetRowCellValue(e.RowHandle, colTenTheoHopDong).ToString(); //dtRemine.Rows[i]["TenTheoHopDong"].ToString(); model.MaTheoHopDong = view.GetRowCellValue(e.RowHandle, colMaTheoHopDong).ToString(); //dtRemine.Rows[i]["MaTheoHopDong"].ToString(); model.TenTheoThietKe = view.GetRowCellValue(e.RowHandle, colTenTheoThietKe).ToString(); //dtRemine.Rows[i]["TenTheoThietKe"].ToString(); model.MaTheoThietKe = view.GetRowCellValue(e.RowHandle, colMaTheoThietKe).ToString(); //dtRemine.Rows[i]["MaTheoThietKe"].ToString(); model.ThoiGianThietKe = TextUtils.ToInt(view.GetRowCellValue(e.RowHandle, colThoiGianThietKe).ToString()); //dtRemine.Rows[i]["ThoiGianThietKe"].ToString()); model.ThoiGianBDDuKien = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianBDDuKien).ToString()); //dtRemine.Rows[i]["ThoiGianBDDuKien"].ToString()); model.ThoiGianBDThucTe = view.GetRowCellValue(e.RowHandle, colThoiGianBDThucTe).ToString(); //(dtRemine.Rows[i]["ThoiGianBDThucTe"].ToString()); model.ThoiGianKTDuKien = TextUtils.ToDate(view.GetRowCellValue(e.RowHandle, colThoiGianKTDuKien).ToString()); //dtRemine.Rows[i]["ThoiGianKTDuKien"].ToString()); model.ThoiGianKTThucTe = view.GetRowCellValue(e.RowHandle, colThoiGianKTThucTe).ToString(); //(dtRemine.Rows[i]["ThoiGianKTThucTe"].ToString()); model.TinhTrang = view.GetRowCellValue(e.RowHandle, colTinhTrang).ToString(); //dtRemine.Rows[i]["TinhTrang"].ToString(); ; model.NhomPhuTrach = view.GetRowCellValue(e.RowHandle, colNhomPhuTrach).ToString(); //dtRemine.Rows[i]["NhomPhuTrach"].ToString(); ; model.MucDoUuTien = view.GetRowCellValue(e.RowHandle, colMucDoUuTien).ToString(); //dtRemine.Rows[i]["MucDoUuTien"].ToString(); ; model.LoaiCongViec = view.GetRowCellValue(e.RowHandle, colLoaiCongViec).ToString(); //dtRemine.Rows[i]["LoaiCongViec"].ToString(); ; if (view.GetRowCellValue(e.RowHandle, colID) == DBNull.Value) //add new) { if (XtraMessageBox.Show("Dữ liệu đã bị thay đổi\nBạn có muốn lưu vào cơ sở dữ liệu không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SanPhamDABO.Instance.Insert(model); } else { e.Valid = true; } } else { if (XtraMessageBox.Show("Dữ liệu đã bị thay đổi\nBạn có muốn lưu vào cơ sở dữ liệu không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { model.ID = Convert.ToInt32(view.GetRowCellValue(e.RowHandle, colID).ToString()); SanPhamDABO.Instance.Update(model); } else { e.Valid = true; } } HienThi(); bandedGridView1.FocusedRowHandle = -1; bandedGridView1.FocusedRowHandle = 0; } catch (Exception) { throw; } }