public override bool PerformSave() { try { bool success = false; GoobizFrame.Windows.Public.OrderHashtable hashtableControls = new GoobizFrame.Windows.Public.OrderHashtable(); hashtableControls.Add(txtMa_Chungchi, lblMa_Chungchi.Text); hashtableControls.Add(txtTen_Chungchi, lblTen_Chungchi.Text); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls)) { return(false); } if (this.FormState == GoobizFrame.Windows.Forms.FormState.Add) { hashtableControls.Remove(txtTen_Chungchi); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistValues(hashtableControls, (DataSet)dgrex_Dm_Chungchi.DataSource, "Ma_Chungchi")) { return(false); } success = (bool)this.InsertObject(); } else if (this.FormState == GoobizFrame.Windows.Forms.FormState.Edit) { hashtableControls.Remove(txtTen_Chungchi); DataSet ds_Chungchi_filter = GoobizFrame.Windows.MdiUtils.Validator.datasetFillter(ds_Chungchi, "Id_Chungchi = " + gridView1.GetFocusedRowCellValue("Id_Chungchi")); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistValues(hashtableControls, ds_Chungchi_filter, "Ma_Chungchi")) { return(false); } success = (bool)this.UpdateObject(); } if (success) { this.DisplayInfo(); } return(success); } catch (Exception ex) { if (ex.ToString().IndexOf("exists") != -1) { GoobizFrame.Windows.Forms.UserMessage.Show("SYS_ALREADY_EXIST", new string[] { lblTen_Chungchi.Text, lblTen_Chungchi.Text }); } return(false); } }
public override bool PerformSaveChanges() { GoobizFrame.Windows.Public.OrderHashtable hashtableControls = new GoobizFrame.Windows.Public.OrderHashtable(); hashtableControls.Add(gridView1.Columns["Ma_Kynang_Chuyenmon"], ""); hashtableControls.Add(gridView1.Columns["Ten_Kynang_Chuyenmon"], ""); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullGrid(hashtableControls, gridView1)) { return(false); } hashtableControls.Remove(gridView1.Columns["Ten_Kynang_Chuyenmon"]); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistGrid(hashtableControls, gridView1)) { return(false); } try { dgrex_Dm_Kynang_Chuyenmon.EmbeddedNavigator.Buttons.DoClick(dgrex_Dm_Kynang_Chuyenmon.EmbeddedNavigator.Buttons.EndEdit); ds_Kynang_Chuyenmon.Tables[0].Columns["Ma_Kynang_Chuyenmon"].Unique = true; objMasterService.Update_Rex_Dm_Kynang_Chuyenmon_Collection(ds_Kynang_Chuyenmon); } catch (Exception ex) { if (ex.ToString().IndexOf("Unique") != -1) { GoobizFrame.Windows.Forms.UserMessage.Show("SYS_ALREADY_EXIST", new string[] { lblMa_Kynang_Chuyenmon.Text, lblTen_Kynang_Chuyenmon.Text }); return(false); } //MessageBox.Show(ex.ToString()); } this.DisplayInfo(); return(true); }
public override bool PerformSave() { try { bool success = false; GoobizFrame.Windows.Public.OrderHashtable hashtableControls = new GoobizFrame.Windows.Public.OrderHashtable(); hashtableControls.Add(txtMa_Ngoaingu, lblMa_Ngoaingu.Text); hashtableControls.Add(txtTen_Ngoaingu, lblTen_Ngoaingu.Text); hashtableControls.Add(txtTrinhdo, lblTrinhdo.Text); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls)) { return(false); } hashtableControls.Remove(txtTen_Ngoaingu); hashtableControls.Remove(txtTrinhdo); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistValues(hashtableControls, (DataSet)dgrex_Dm_Ngoaingu.DataSource, "Ma_Ngoaingu")) { return(false); } if (this.FormState == GoobizFrame.Windows.Forms.FormState.Add) { success = (bool)this.InsertObject(); } else if (this.FormState == GoobizFrame.Windows.Forms.FormState.Edit) { success = (bool)this.UpdateObject(); } if (success) { this.DisplayInfo(); } return(success); } catch (Exception ex) { if (ex.ToString().IndexOf("exists") != -1) { GoobizFrame.Windows.Forms.UserMessage.Show("SYS_ALREADY_EXIST", new string[] { lblTen_Ngoaingu.Text, lblTen_Ngoaingu.Text }); } return(false); } }
public override bool PerformSave() { try { bool success = false; GoobizFrame.Windows.Public.OrderHashtable hashtableControls = new GoobizFrame.Windows.Public.OrderHashtable(); hashtableControls.Add(txtMa_Donvitinh, lblMa_Donvitinh.Text); hashtableControls.Add(txtTen_Donvitinh, lblTen_Donvitinh.Text); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls)) { return(false); } hashtableControls.Remove(txtMa_Donvitinh); //if (!txtTen_Donvitinh.EditValue.Equals(ten_dovitinh)) //{ //if (! GoobizFrame.Windows.MdiUtils.Validator.CheckExistValues(htbTen_Donvitinh, ds_Collection, "Ten_Donvitinh")) // return false; //} if (this.FormState == GoobizFrame.Windows.Forms.FormState.Add) { if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistValues(hashtableControls, ds_Collection, "Ten_Donvitinh")) { return(false); } success = (bool)this.InsertObject(); } else if (this.FormState == GoobizFrame.Windows.Forms.FormState.Edit) { if (!txtTen_Donvitinh.EditValue.Equals(ten_dovitinh)) { if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistValues(hashtableControls, ds_Collection, "Ten_Donvitinh")) { return(false); } } success = (bool)this.UpdateObject(); } if (success) { ten_dovitinh = null; this.DisplayInfo(); } return(success); } catch (Exception ex) { if (ex.ToString().IndexOf("exists") != -1) { GoobizFrame.Windows.Forms.UserMessage.Show("SYS_ALREADY_EXIST", new string[] { lblMa_Donvitinh.Text, lblMa_Donvitinh.Text.ToLower() }); } return(false); } }
private bool SaveChangeHanghoaBan() { DataSet ds_All_Hanghoa_Ban = new DataSet(); ds_All_Hanghoa_Ban = objMasterService.Get_All_Ware_Dm_Hanghoa_Ban().ToDataSet(); this.DoClickEndEdit(dgware_Dm_Hanghoa_Ban); GoobizFrame.Windows.Public.OrderHashtable hashtableControls = new GoobizFrame.Windows.Public.OrderHashtable(); hashtableControls.Add(gvware_Dm_Hanghoa_Ban.Columns["Ma_Hanghoa_Ban"], ""); hashtableControls.Add(gvware_Dm_Hanghoa_Ban.Columns["Ten_Hanghoa_Ban"], ""); hashtableControls.Add(gvware_Dm_Hanghoa_Ban.Columns["Id_Donvitinh"], ""); //hashtableControls.Add(gvware_Dm_Hanghoa_Ban.Columns["Barcode_Txt"], ""); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullGrid(hashtableControls, gvware_Dm_Hanghoa_Ban)) { return(false); } int focus = gvware_Dm_Hanghoa_Ban.FocusedRowHandle; if (FormState == GoobizFrame.Windows.Forms.FormState.Add) { System.Collections.Hashtable htbBarCode = new System.Collections.Hashtable(); htbBarCode.Add(gvware_Dm_Hanghoa_Ban.Columns["Barcode_Txt"], ""); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistGrid(htbBarCode, gvware_Dm_Hanghoa_Ban)) { return(false); } } hashtableControls.Remove(gvware_Dm_Hanghoa_Ban.Columns["Id_Donvitinh"]); hashtableControls.Remove(gvware_Dm_Hanghoa_Ban.Columns["Ten_Hanghoa_Ban"]); if (!GoobizFrame.Windows.MdiUtils.Validator.CheckExistGrid(hashtableControls, gvware_Dm_Hanghoa_Ban)) { gvware_Dm_Hanghoa_Ban.FocusedRowHandle = focus; return(false); } DataRow[] dtr = null; DataRow[] dtr_Id = null; for (int i = 0; i < gvware_Dm_Hanghoa_Ban.RowCount; i++) { if (gvware_Dm_Hanghoa_Ban.GetDataRow(i).RowState == DataRowState.Modified) { dtr_Id = ds_All_Hanghoa_Ban.Tables[0].Select("Id_Hanghoa_Ban = '" + gvware_Dm_Hanghoa_Ban.GetRowCellValue(i, gvware_Dm_Hanghoa_Ban.Columns["Id_Hanghoa_Ban"]) + "'"); if (!dtr_Id[0]["Ma_Hanghoa_Ban"].Equals(gvware_Dm_Hanghoa_Ban.GetRowCellValue(i, gvware_Dm_Hanghoa_Ban.Columns["Ma_Hanghoa_Ban"]))) { dtr = ds_All_Hanghoa_Ban.Tables[0].Select("Ma_Hanghoa_Ban = '" + gvware_Dm_Hanghoa_Ban.GetRowCellValue(i, gvware_Dm_Hanghoa_Ban.Columns["Ma_Hanghoa_Ban"]) + "'"); if (dtr.Length >= 1) { GoobizFrame.Windows.Forms.MessageDialog.Show("Mã hàng " + gvware_Dm_Hanghoa_Ban.GetRowCellValue(i, gvware_Dm_Hanghoa_Ban.Columns["Ma_Hanghoa_Ban"]) + " đã tồn tại, nhập lại Mã hàng hóa"); return(false); } } } if (gvware_Dm_Hanghoa_Ban.GetDataRow(i).RowState == DataRowState.Added) { dtr = ds_All_Hanghoa_Ban.Tables[0].Select("Ma_Hanghoa_Ban = '" + gvware_Dm_Hanghoa_Ban.GetRowCellValue(i, gvware_Dm_Hanghoa_Ban.Columns["Ma_Hanghoa_Ban"]) + "'"); if (dtr.Length >= 1) { GoobizFrame.Windows.Forms.MessageDialog.Show("Mã hàng " + gvware_Dm_Hanghoa_Ban.GetRowCellValue(i, gvware_Dm_Hanghoa_Ban.Columns["Ma_Hanghoa_Ban"]) + " đã tồn tại, nhập lại Mã hàng hóa"); return(false); } } } try { //dgware_Dm_Hanghoa_Ban.EmbeddedNavigator.Buttons.EndEdit.DoClick(); //dsWare_Hanghoa_Ban_Dinhgia.Tables[0].Columns["Ma_Hanghoa_Ban"].Unique = true; //dsWare_Hanghoa_Ban_Dinhgia.Tables[0].Columns["Ten_Hanghoa_Ban"].Unique = true; objMasterService.Update_Ware_Dm_Hanghoa_Ban_Collection(this.dsDm_Hanghoa_Ban); } catch (Exception ex) { if (ex.ToString().IndexOf("Unique") != -1) { if (ex.ToString().IndexOf("Ma_Hanghoa_Ban") != -1) { GoobizFrame.Windows.Forms.UserMessage.Show("SYS_ALREADY_EXIST", new string[] { lblMa_Hanghoa_Ban.Text, lblMa_Hanghoa_Ban.Text.ToLower() }); } //else if (ex.ToString().IndexOf("Ten_Hanghoa_Ban") != -1) // GoobizFrame.Windows.Forms.UserMessage.Show("SYS_ALREADY_EXIST", new string[] { lblTen_Hanghoa_Ban.Text, lblTen_Hanghoa_Ban.Text.ToLower() }); return(false); } //MessageBox.Show(ex.ToString()); } DisplayInfo(); ChangeStatus(false); return(true); }