protected void kurumstore_AfterRecordUpdated(object sender, BeforeStoreChangedEventArgs e) { var result = false; string json = e.DataHandler.JsonData; if (json == "[]") { return; } StoreDataHandler dataHandler = new StoreDataHandler(json); List <KurumDto> list = dataHandler.ObjectData <KurumDto>(); foreach (var item in list) { switch (e.Action) { case StoreAction.Create: e.Cancel = true; break; case StoreAction.Update: guncelle(item); e.Cancel = true; break; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleChangesFamilyRelationship(object sender, BeforeStoreChangedEventArgs e) { var familyRelationshipModel = e.DataHandler.ObjectData <FamilyRelationshipModel>(); // insert foreach (var created in familyRelationshipModel.Created) { var info = new hr_FamilyRelationship { RecordId = Convert.ToInt32(hdfPrKeyHoSo.Text) }; EditFamilyRelationship(info, created); new FamilyRelationshipController().Insert(info); } // update foreach (var updated in familyRelationshipModel.Updated) { var info = new hr_FamilyRelationship(); EditFamilyRelationship(info, updated); new FamilyRelationshipController().Update(info); } // delete foreach (var deleted in familyRelationshipModel.Deleted) { new FamilyRelationshipController().Delete(deleted.Id); } }
//protected void btnSave_Click(object sender, DirectEventArgs e) //{ // List<string> lists = new List<string>(); // string[] nhanxet = hdfNhanXet.Text.Split('#'); // for (int i = nhanxet.Count() - 1; i >= 0; i--) // { // if (nhanxet[i].Trim() != "") // { // string[] tmp = nhanxet[i].Split('$'); // if (!lists.Contains(tmp[0].Trim())) // { // new KetQuaDanhGiaController().UpdateNhanXetByID(int.Parse("0" + tmp[0]), tmp[1]); // lists.Add(tmp[0].Trim()); // } // } // } // hdfNhanXet.Text = ""; // grp_TieuChiDanhGia.Reload(); // grp_CanBoBiDanhGia.Reload(); //} protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <TienHanhDanhGia> canbos = e.DataHandler.ObjectData <TienHanhDanhGia>(); foreach (TienHanhDanhGia updated in canbos.Updated) { DAL.TieuChi_DotDanhGia tc = new TieuChi_DotDanhGiaController().GetByMaDotDanhGiavaMaTieuChi(hdfMaDotDanhGia.Text, updated.MaNhom); KetQuaDanhGiaInfo kqua = new KetQuaDanhGiaInfo() { ID = updated.ID, CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, Diem = (float)Math.Round(updated.Diem, 2), IdTieuChi_DotDanhGia = tc.ID, MaCB = hdfMaCanBo.Text, NhanXet = updated.NhanXet }; if (isNguoiQL == true) { kqua.IsQuanLyDanhGia = true; } // update kết quả new KetQuaDanhGiaController().Update(kqua); } e.Cancel = true; Dialog.ShowNotification("Đã lưu kết quả đánh giá"); // cập nhật kết quả hàng tháng try { DataController.DataHandler.GetInstance().ExecuteNonQuery("DanhGia_UpdateDanhGiaTheoThang", "@MaCanBo", "@MaDotDanhGia", hdfMaCanBo.Text, hdfMaDotDanhGia.Text); } catch (Exception ex) { } }
protected void grpBangThanhToanTienLuongStoreChange(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <BangThanhToanTienLuongInfo> bangthanhtoan = e.DataHandler.ObjectData <BangThanhToanTienLuongInfo>(); foreach (var item in bangthanhtoan.Updated) { var change = new BangThanhToanTienLuongController().GetChiTietLuongByID(item.ID); change.LuongCoBan = item.LuongCoBan; change.LuongTrachNhiem = item.LuongTrachNhiem; change.PhuCapTienAn = item.PhuCapTienAn; change.PhuCapChucVu = item.PhuCapChucVu; change.PhuCapKiemNhiem = item.PhuCapKiemNhiem; change.PhuCapKhac = item.PhuCapKhac; change.LuongThoiGianNgayThuong = item.LuongThoiGianNgayThuong; change.LuongThemGio = item.LuongThemGio; change.LuongThuong = item.LuongThuong; change.LuongThang13 = item.LuongThang13; change.ATM = item.ATM; change.TienMat = item.TienMat; new BangThanhToanTienLuongController().UpdateChiTietTienLuong(change); grpBangThanhToanTienLuongStore.CommitChanges(); grpBangThanhToanTienLuong.Reload(); } }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <BangChamCongThangInfo> bangchamcongthang = e.DataHandler.ObjectData <BangChamCongThangInfo>(); foreach (BangChamCongThangInfo update in bangchamcongthang.Updated) { } }
protected void BeforeStroreChanged(object sender, BeforeStoreChangedEventArgs e) { var json = e.DataHandler.JsonData; var dataHandler = new StoreDataHandler(json); var data = dataHandler.ObjectData <DIC_MySecondDictionary>(); var edit = (DIC_MySecondDictionaryEdit)BaseMainPage.LoadControl(Page, "DIC_MySecondDictionaryEdit"); var reloadData = false; bool isValid = true; e.Cancel = true; BeforeSaveValidate(data, ref isValid); if (!isValid) { foreach (var row in data) { X.AddScript($"setTimeout(function(){{ #{{store}}.getById({row.id}).setDirty(); }}, 100);"); } X.AddScript("#{grid}.view.loadMask.hide();"); return; } foreach (var row in data) { switch (e.Action) { case StoreAction.Update: // todo: подумать о том как показать ошибки reloadData |= edit.EditRowFromGrid(row); break; case StoreAction.Create: // todo: подумать о том как показать ошибки edit.InsertRowFromGrid(row); break; default: throw new ArgumentOutOfRangeException(); } } var result = source.View.GetSelect() .Where(r => data.Contains(r.Item)) .Select(source.View.GetFullModelDataExpression); if (reloadData) { store.Reload(); } else { e.ResponseRecords.AddRange(result); } X.AddScript("#{grid}.view.loadMask.hide();"); AfterSave(data.Select(r => r.id)); }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <KEHOACH_DAOTAOInfo> records = e.DataHandler.ObjectData <KEHOACH_DAOTAOInfo>(); foreach (KEHOACH_DAOTAOInfo item in records.Deleted) { new DaoTaoController().Delete(item.MaKeHoach); } }
protected void SaveD(object sender, BeforeStoreChangedEventArgs e) { try { XmlNode xml = e.DataHandler.XmlData; XmlNode updated = xml.SelectSingleNode("records/Updated"); if (updated != null) { XmlNodeList uRecords = updated.SelectNodes("record"); if (uRecords.Count > 0) { foreach (XmlNode record in uRecords) { if (record != null) { DBSCMDataContext dc1 = new DBSCMDataContext(); if (record.SelectSingleNode("Mid").InnerText.Trim() == "-1") { if (record.SelectSingleNode("isCheck").InnerText.Trim() == "true") { SmsManagement ma = new SmsManagement { Coding = record.SelectSingleNode("Coding").InnerText, Deptnumber = SessionBox.GetUserSession().DeptNumber, Sendset = 1 }; dc1.SmsManagement.InsertOnSubmit(ma); dc1.SubmitChanges(); } } else { var ma = dc1.SmsManagement.First(p => p.Mid == decimal.Parse(record.SelectSingleNode("Mid").InnerText.Trim())); if (record.SelectSingleNode("isCheck").InnerText.Trim() == "true") { ma.Sendset = 1; } else { dc1.SmsManagement.DeleteOnSubmit(ma); } dc1.SubmitChanges(); } } } e.Cancel = true; StoreLoad(); Ext.Msg.Alert("提示", "保存成功!").Show(); } } } catch { Ext.Msg.Alert("提示", "数据处理异常,请刷新页面重新操作!").Show(); } }
protected void HandleChangesChiPhi(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <CacKhoanChiPhiInfo> records = e.DataHandler.ObjectData <CacKhoanChiPhiInfo>(); DaoTaoController controller = new DaoTaoController(); foreach (CacKhoanChiPhiInfo item in records.Deleted) { controller.DeleteChiPhi(item.ID); } }
protected void HandleChangesGiaoVien(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <GiaoVienThamGiaDaoTaoInfo> records = e.DataHandler.ObjectData <GiaoVienThamGiaDaoTaoInfo>(); DaoTaoController controller = new DaoTaoController(); foreach (GiaoVienThamGiaDaoTaoInfo item in records.Deleted) { controller.DeleteGiaoVien(item.MaGV, hdfRecordID.Text); } }
public void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { try { string error = string.Empty; ChangeRecords <BangTamUngInfo> tamUngs = e.DataHandler.ObjectData <BangTamUngInfo>(); foreach (BangTamUngInfo created in tamUngs.Created) { try { // create BangTamUng object BangTamUng tamUng = new BangTamUng(); tamUng.PrKeyHoSo = created.PrkeyHoSo; tamUng.SoTien = created.SoTien; tamUng.SoTienDaTra = created.SoTienDaTra; tamUng.LyDoTamUng = created.LyDoTamUng; if (created.NgayTamUng != null) { tamUng.NgayTamUng = created.NgayTamUng.Value; } if (created.NgayThanhToan != null) { tamUng.ThoiHanThanhToan = created.NgayThanhToan.Value; } tamUng.CreatedBy = CurrentUser.ID; tamUng.CreatedDate = DateTime.Now; tamUng.NgayThanhToan = null; // insert data to database new BangTamUngController().Insert(tamUng); } catch (Exception ex) { error += ex.Message + "\n"; } } // show error if valid if (!string.IsNullOrEmpty(error)) { X.Msg.Alert("Có lỗi xảy ra", error).Show(); } else { Dialog.ShowNotification("Thêm cán bộ tạm ứng thành công!"); wdCapNhatTamUngHangLoat.Hide(); } grpBangTamUng.GetGridPanel().Reload(); } catch (Exception ex) { X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message).Show(); } }
protected void SaveD(object sender, BeforeStoreChangedEventArgs e) { XmlNode xml = e.DataHandler.XmlData; XmlNode updated = xml.SelectSingleNode("records/Updated"); RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel; if (updated != null) { XmlNodeList uRecords = updated.SelectNodes("record"); if (uRecords.Count > 0) { foreach (XmlNode record in uRecords) { if (record != null) { DBSCMDataContext dc1 = new DBSCMDataContext(); foreach (var item in sm.SelectedRows) { var rd = dc1.SwexamineDetail.Where(p => p.Lid == decimal.Parse(record.SelectSingleNode("Lid").InnerText) && p.Swid == decimal.Parse(item.RecordID)); if (record.SelectSingleNode("isCheck").InnerText.Trim() == "false") { dc1.SwexamineDetail.DeleteOnSubmit(rd.First()); //dc1.SubmitChanges(); } else { if (rd.Count() == 0) { SwexamineDetail ra = new SwexamineDetail { Lid = decimal.Parse(record.SelectSingleNode("Lid").InnerText), Remark = record.SelectSingleNode("Remark").InnerText, Swid = decimal.Parse(item.RecordID) }; dc1.SwexamineDetail.InsertOnSubmit(ra); //dc1.SubmitChanges(); } } } dc1.SubmitChanges(); } } } } foreach (var item in sm.SelectedRows) { var se = dc.Swexamine.First(p => p.Swid == decimal.Parse(item.RecordID)); se.Result = tfResult.Text; } dc.SubmitChanges(); Ext.Msg.Alert("提示", "保存成功!").Show(); LearnStoreLoad(); }
protected void HandleChangesDaoTao(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <NhanVienThamGiaDaoTaoInfo> record = e.DataHandler.ObjectData <NhanVienThamGiaDaoTaoInfo>(); DaoTaoController controller = new DaoTaoController(); foreach (var item in record.Deleted) { controller.DeleteNhanVien(item.ID); } foreach (NhanVienThamGiaDaoTaoInfo item in record.Updated) { controller.UpdateNhanVien(item); } }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <Sjqd_Lan> list = e.DataHandler.ObjectData <Sjqd_Lan>(); foreach (Sjqd_Lan updated in list.Updated) { Sjqd_CpuService.UpdateLan(updated); if (Store3.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(updated.ID.ToString()); } } X.Msg.Alert("消息", "保存成功").Show(); e.Cancel = true; }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { try { ChangeRecords <DangKyLamThemGioHangLoatInfo> dky = e.DataHandler.ObjectData <DangKyLamThemGioHangLoatInfo>(); string error = string.Empty; foreach (DangKyLamThemGioHangLoatInfo created in dky.Created) { DAL.DangKyLamThemGio lamtg = new DangKyLamThemGio { MaCB = created.MA_CB, FrkeyMaCa = int.Parse(cbxChonCaHL.SelectedItem.Value), TuNgay = dfTuNgayHL.SelectedDate, DenNgay = dfDenNgayHL.SelectedDate, GioBatDauSauCa = GetTime(tfGioBatDauHL.Text), GioKetThucSauCa = GetTime(tfGioKetThucHL.Text), CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, GhiChu = txtGhiChuHL.Text, }; List <DAL.DangKyLamThemGio> tmp = new DangKyLamThemGioController().GetByMaCanBoAndFrkeyCa(lamtg.MaCB, lamtg.FrkeyMaCa); if (CheckGiaoNhau(tmp, lamtg) == false) { new DangKyLamThemGioController().Insert(lamtg); } else { error += lamtg.MaCB + ", "; } } grpDangKyLamThemGio.Reload(); if (string.IsNullOrEmpty(error)) { Dialog.ShowNotification("Đăng ký thành công!"); } else { error = error.Remove(error.LastIndexOf(',')); X.Msg.Alert("Thông báo từ hệ thống", "Các cán bộ có mã " + error + " đã đăng ký trùng giờ làm thêm").Show(); } wdThemCanBoHangLoat.Hide(); } catch (Exception ex) { X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message).Show(); } }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <SimpleProjectource> list = e.DataHandler.ObjectData <SimpleProjectource>(); foreach (SimpleProjectource updated1 in list.Updated) { var updated = ConvertToProject(updated1); biService.UpdateProjectSource(updated); if (Store4.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(updated.ProjectSourceID.ToString()); } } X.Msg.Alert("消息", "保存修改成功").Show(); e.Cancel = true; }
protected void HandleChangesTuDien(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <MathRule> mathRule = e.DataHandler.ObjectData <MathRule>(); XMLProcess xmlProcess = new XMLProcess(); foreach (var item in mathRule.Updated) { xmlProcess.UpdateTuDien(Server.MapPath(MathRuleXmlUrl), item); GridPanel2.UpdateCell(item.ColumnInDB, "MathStatus", "true"); if (Store3.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(item.ColumnInDB.ToString()); } hdfMathStatus.Text = hdfMathStatus.Text.Replace(item.ColumnInDB + ",", ""); } }
/// <summary> /// autosave cho store chứa thông tin cột /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleColumnChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <OneManyFormInfo> columns = e.DataHandler.ObjectData <OneManyFormInfo>(); foreach (OneManyFormInfo item in columns.Updated) { lock (lockObj) { OneManyFormController.GetInstance().Update(item); } if (StoreTableDetailInfo.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(item.ID.ToString()); } } e.Cancel = true; }
/// <summary> /// autosave cho store chứa thông tin cột /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleColumnChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <GridPanelColumnInfo> columns = e.DataHandler.ObjectData <GridPanelColumnInfo>(); foreach (GridPanelColumnInfo item in columns.Updated) { lock (lockObj) { item.TableName = this.TableName; GridController.GetInstance().UpdateColumnInformation(item); } if (StoreColumnInfo.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(item.ID.ToString()); } } foreach (GridPanelColumnInfo item in columns.Created) { lock (lockObj) { item.TableName = this.TableName; item.GridName = this.ID; GridController.GetInstance().InsertColumnInformation(item); } if (StoreColumnInfo.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(item.ID.ToString()); } // StoreColumnInfo. } foreach (GridPanelColumnInfo item in columns.Deleted) { lock (lockObj) { GridController.GetInstance().DeleteColumnInformation(item); LoadColumnTable(); } } e.Cancel = true; }
protected void HandleFieldChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <FormElementInfo> elements = e.DataHandler.ObjectData <FormElementInfo>(); foreach (FormElementInfo item in elements.Updated) { lock (lockObj) { if (item.GroupID == null) { item.GroupID = 0; } FormElementController.GetInstance().Update(item); } if (StoreFieldInfo.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(item.ID.ToString()); } } }
protected virtual void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <T> persons = e.DataHandler.ObjectData <T>(); foreach (T created in persons.Created) { string tempId = getID(created); string newId = this.AddPerson(created); if (Store1.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(tempId.ToString(), newId.ToString()); } else { Store1.UpdateRecordId(tempId, newId); } } foreach (T deleted in persons.Deleted) { string id = getID(deleted); this.DeletePerson(id); if (Store1.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(id); } } foreach (T updated in persons.Updated) { this.UpdatePerson(updated); if (Store1.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(getID(updated)); } } e.Cancel = true; }
protected void SaveJ(object sender, BeforeStoreChangedEventArgs e) { XmlNode xml = e.DataHandler.XmlData; XmlNode updated = xml.SelectSingleNode("records/Updated"); if (updated != null) { XmlNodeList uRecords = updated.SelectNodes("record"); if (uRecords.Count > 0) { foreach (XmlNode record in uRecords) { if (record != null) { DBSCMDataContext dc1 = new DBSCMDataContext(); var rd = dc1.SqsResultDetail.Where(p => p.Jcid == decimal.Parse(record.SelectSingleNode("Jcid").InnerText) && p.Rid == decimal.Parse(hdnId.Value.ToString())); if (rd.Count() == 0) { SqsResultDetail rk = new SqsResultDetail { Jcid = decimal.Parse(record.SelectSingleNode("Jcid").InnerText.Trim().Substring(1)), Jeom = record.SelectSingleNode("Jeom").InnerText.Trim() == "" ? 0 : decimal.Parse(record.SelectSingleNode("Jeom").InnerText), Remark = record.SelectSingleNode("Remark").InnerText.Trim(), Rid = decimal.Parse(hdnId.Value.ToString()) }; dc1.SqsResultDetail.InsertOnSubmit(rk); dc1.SubmitChanges(); } else { var r = rd.First(); r.Jeom = record.SelectSingleNode("Jeom").InnerText.Trim() == "" ? 0 : decimal.Parse(record.SelectSingleNode("Jeom").InnerText); r.Remark = record.SelectSingleNode("Remark").InnerText.Trim(); dc1.SubmitChanges(); } } } e.Cancel = true; } } }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { try { ChangeRecords <SelectCustomerAction> persons = e.DataHandler.ObjectData <SelectCustomerAction>(); foreach (SelectCustomerAction updated in persons.Updated) { var acl = base.ACLService.GetAllAcl(updated.CustomerActionID, this._CustomerRoleID, null).FirstOrDefault(); if (acl == null) { base.ACLService.InsertAcl(new ACL() { CustomerActionID = updated.CustomerActionID , CustomerRoleID = this._CustomerRoleID , Allow = updated.Allow }); } else { acl.Allow = updated.Allow; base.ACLService.UpdateAcl(acl); } try { e.ConfirmationList.ConfirmRecord(updated.CustomerActionID.ToString()); } catch { } } e.Cancel = true; } catch (Exception err) { base.ProcessException(err); } }
protected void SaveD(object sender, BeforeStoreChangedEventArgs e) { XmlNode xml = e.DataHandler.XmlData; XmlNode updated = xml.SelectSingleNode("records/Updated"); if (updated != null) { XmlNodeList uRecords = updated.SelectNodes("record"); if (uRecords.Count > 0) { foreach (XmlNode record in uRecords) { if (record != null) { DBSCMDataContext dc1 = new DBSCMDataContext(); var rd = dc1.SqsDemotiondetail.Where(p => p.Deid == decimal.Parse(record.SelectSingleNode("Deid").InnerText) && p.Rid == decimal.Parse(hdnId.Value.ToString())); if (record.SelectSingleNode("isCheck").InnerText.Trim() == "false") { dc1.SqsDemotiondetail.DeleteOnSubmit(rd.First()); dc1.SubmitChanges(); } else { if (rd.Count() == 0) { SqsDemotiondetail ra = new SqsDemotiondetail { Deid = decimal.Parse(record.SelectSingleNode("Deid").InnerText), Rid = decimal.Parse(hdnId.Value.ToString()) }; dc1.SqsDemotiondetail.InsertOnSubmit(ra); dc1.SubmitChanges(); } } } } } } }
protected void SaveHandler(object sender, BeforeStoreChangedEventArgs e) { if (cbbCheckDept.SelectedIndex == -1 || cbbforcheckDept.SelectedIndex == -1) { Ext.Msg.Alert("提示", "请填写完整信息!").Show(); return; } XmlNode xml = e.DataHandler.XmlData; XmlNode updated = xml.SelectSingleNode("records/Updated"); if (Check(updated)) { string type = Request.QueryString["Type"].Trim(); decimal strrid = 0; if (type == "new") { ParResult pr = new ParResult { Checkdate = dfDate.SelectedDate, Checkdept = cbbCheckDept.SelectedItem.Value, Checkfordept = cbbforcheckDept.SelectedItem.Value, Pkindid = decimal.Parse(Request.QueryString["Pkindid"]), Rstatus = "1", Total = 0 }; try { pr.Banci = cbbBanci.SelectedItem.Value; } catch { } if (fb_zrr.SelectedIndex > -1) { pr.Bkhperson = fb_zrr.SelectedItem.Value; } if (cbb_khr.SelectedIndex > -1) { pr.Khperson = cbb_khr.SelectedItem.Value; } if (cbbplace.SelectedIndex > -1) { pr.Placeid = cbbplace.SelectedItem.Value; } dc.ParResult.InsertOnSubmit(pr); dc.SubmitChanges(); strrid = dc.ParResult.Max(p => p.Rid); } else { var result = dc.ParResult.First(p => p.Rid == decimal.Parse(Request.QueryString["Rid"])); result.Checkfordept = cbbforcheckDept.SelectedItem.Value; result.Placeid = cbbplace.SelectedItem.Value; result.Checkdate = dfDate.SelectedDate; if (fb_zrr.SelectedIndex > -1) { result.Bkhperson = fb_zrr.SelectedItem.Value; } if (cbb_khr.SelectedIndex > -1) { result.Khperson = cbb_khr.SelectedItem.Value; } dc.SubmitChanges(); strrid = result.Rid; } if (updated != null) { XmlNodeList uRecords = updated.SelectNodes("record"); decimal total = 0; if (uRecords.Count > 0) { foreach (XmlNode record in uRecords) { if (record != null) { total += record.SelectSingleNode("Jeom").InnerText.Trim() == "" ? 0 : decimal.Parse(record.SelectSingleNode("Jeom").InnerText); if (type == "new") { if (record.SelectSingleNode("Jcid").InnerText.Trim().Substring(0, 1) == "j") { AddDetail(record, strrid); } else { AddRAdetail(record, strrid); } } else { if (record.SelectSingleNode("Jcid").InnerText.Trim().Substring(0, 1) == "j") { if (record.SelectSingleNode("Rdid").InnerText.Trim() == "-1") { AddDetail(record, strrid); } else { UpdateDetail(record); } } else { if (record.SelectSingleNode("Rdid").InnerText.Trim() == "-1") { AddRAdetail(record, strrid); } else { UpdateRADetail(record); } } } } } var res = dc.ParResult.First(p => p.Rid == strrid); res.Total = dc.ParKind.First(p => p.Pkindid == res.Pkindid).Fullscore.Value - total; dc.SubmitChanges(); } e.Cancel = true; GVLoad(strrid.ToString()); } Ext.Msg.Alert("提示", "保存成功").Show(); } else { Ext.Msg.Alert("提示", "扣分超过最大值").Show(); } }
/// <summary> /// Lưu thông tin chấm công vào CSDL /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <BangChamCongThangInfo> bangluong = e.DataHandler.ObjectData <BangChamCongThangInfo>(); ChamCongThangController chamcong = new ChamCongThangController(); //khai báo các tham số string[] param = new string[34]; param[0] = "@PR_KEY"; for (int i = 1; i <= 31; i++) { if (i <= 9) { param[i] = "@NGAY0" + i; } else { param[i] = "@NGAY" + i; } } param[32] = "@DIEM_THUONG"; param[33] = "@DIEM_PHAT"; string MaDonVi = Session["MaDonVi"].ToString(); foreach (BangChamCongThangInfo update in bangluong.Updated) { update.NGAY01 = GetEmptyStringFromNullObject(update.NGAY01); update.NGAY02 = GetEmptyStringFromNullObject(update.NGAY02); update.NGAY03 = GetEmptyStringFromNullObject(update.NGAY03); update.NGAY04 = GetEmptyStringFromNullObject(update.NGAY04); update.NGAY05 = GetEmptyStringFromNullObject(update.NGAY05); update.NGAY06 = GetEmptyStringFromNullObject(update.NGAY06); update.NGAY07 = GetEmptyStringFromNullObject(update.NGAY07); update.NGAY08 = GetEmptyStringFromNullObject(update.NGAY08); update.NGAY09 = GetEmptyStringFromNullObject(update.NGAY09); update.NGAY10 = GetEmptyStringFromNullObject(update.NGAY10); update.NGAY11 = GetEmptyStringFromNullObject(update.NGAY11); update.NGAY12 = GetEmptyStringFromNullObject(update.NGAY12); update.NGAY13 = GetEmptyStringFromNullObject(update.NGAY13); update.NGAY14 = GetEmptyStringFromNullObject(update.NGAY14); update.NGAY15 = GetEmptyStringFromNullObject(update.NGAY15); update.NGAY16 = GetEmptyStringFromNullObject(update.NGAY16); update.NGAY17 = GetEmptyStringFromNullObject(update.NGAY17); update.NGAY18 = GetEmptyStringFromNullObject(update.NGAY18); update.NGAY19 = GetEmptyStringFromNullObject(update.NGAY19); update.NGAY20 = GetEmptyStringFromNullObject(update.NGAY20); update.NGAY21 = GetEmptyStringFromNullObject(update.NGAY21); update.NGAY22 = GetEmptyStringFromNullObject(update.NGAY22); update.NGAY23 = GetEmptyStringFromNullObject(update.NGAY23); update.NGAY24 = GetEmptyStringFromNullObject(update.NGAY24); update.NGAY25 = GetEmptyStringFromNullObject(update.NGAY25); update.NGAY26 = GetEmptyStringFromNullObject(update.NGAY26); update.NGAY27 = GetEmptyStringFromNullObject(update.NGAY27); update.NGAY28 = GetEmptyStringFromNullObject(update.NGAY28); update.NGAY29 = GetEmptyStringFromNullObject(update.NGAY29); update.NGAY30 = GetEmptyStringFromNullObject(update.NGAY30); update.NGAY31 = GetEmptyStringFromNullObject(update.NGAY31); DataHandler.GetInstance().ExecuteNonQuery("UpdateBangChamCongExcelThang", param, update.PRKEY, update.NGAY01, update.NGAY02, update.NGAY03, update.NGAY04, update.NGAY05, update.NGAY06, update.NGAY07, update.NGAY08, update.NGAY09, update.NGAY10, update.NGAY11, update.NGAY12, update.NGAY13, update.NGAY14, update.NGAY15, update.NGAY16, update.NGAY17, update.NGAY18, update.NGAY19, update.NGAY20, update.NGAY21, update.NGAY22, update.NGAY23, update.NGAY24, update.NGAY25, update.NGAY26, update.NGAY27, update.NGAY28, update.NGAY29, update.NGAY30, update.NGAY31, update.DIEMTHUONG, update.DIEMPHAT); } foreach (BangChamCongThangInfo deleted in bangluong.Deleted) { DataHandler.GetInstance().ExecuteNonQuery("ChamCong_DeleteEmployee", "@Prkey", deleted.PRKEY); if (Store1.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(deleted.PRKEY.ToString()); } } }
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e) { try { TracNghiemController tracNghiemController = new TracNghiemController(); ChangeRecords <TracNghiemInfo> tracNghiems = e.DataHandler.ObjectData <TracNghiemInfo>(); // insert foreach (TracNghiemInfo created in tracNghiems.Created) { try { DAL.TracNghiem info = new DAL.TracNghiem(); info.CriterionID = hdfInsertedID.Text; info.ExplainName = created.ExplainName; info.MaxPoint = created.MaxPoint; info.MinPoint = created.MinPoint; info.Order = created.Order; tracNghiemController.Insert(info); } catch (Exception ex) { } } // update foreach (TracNghiemInfo updated in tracNghiems.Updated) { try { DAL.TracNghiem info = new DAL.TracNghiem(); info.CriterionID = hdfInsertedID.Text; info.ExplainName = updated.ExplainName; info.MaxPoint = updated.MaxPoint; info.MinPoint = updated.MinPoint; info.Order = updated.Order; tracNghiemController.Update(info); } catch (Exception ex) { } } // delete foreach (TracNghiemInfo deleted in tracNghiems.Deleted) { try { tracNghiemController.Delete(deleted.ID); } catch (Exception ex) { } } if (hdfTypeCommand.Text == "Insert") { Dialog.ShowNotification("Thêm mới thành công tiêu chí đánh giá"); if (hdfClose.Text == "True") { wdAddNewEstimateCriterion.Hide(); } else { RM.RegisterClientScriptBlock("rsform", "ResetCriterionWindow();"); } } else if (hdfTypeCommand.Text == "Edit") { Dialog.ShowNotification("Cập nhật thông tin tiêu chí đánh giá thành công"); wdAddNewEstimateCriterion.Hide(); } GridPanel1.Reload(); } catch (Exception ex) { Dialog.ShowError("Có lỗi xảy ra: " + ex.Message); } }