protected virtual bool BarButtonNew_Click() { if (EnumPermission.Edit == StatusUse || EnumPermission.New == StatusUse) { if (CheckEmty(ControlCheckEmty)) { DelMessageBox.DelMessageBoxOk(StringMessage.CompelInput); return(false); } if (EnumPermission.New == StatusUse) { if (CheckExitValue(ControlCheckExit)) { DelMessageBox.DelMessageBoxOk(StringMessage.InfomationExistsObject); return(false); } VoucherID = functionsGUIService.GetGUID(); string tableNameHeader = ("Header" + ModelName + VoucherID.Replace("-", "")).ToUpper(); string tableNameDetail = ("Detail" + ModelName + VoucherID.Replace("-", "")).ToUpper(); if (CreateTableHeaderTemp(TableHeader, tableNameHeader)) { if (functionsGUIService.InsertIntoTable(LoadListControlAndField(groHeader), tableNameHeader, "VoucherID", VoucherID)) { if (CreateTableHeaderTemp(TableDetail, tableNameDetail, GetlistColumnTableDetail(grvDetail))) { if (functionsGUIService.dataBase.bulkcopy(((DataTable)grcDetai.DataSource), tableNameDetail, GetlistColumnTableDetail(grvDetail).ToArray())) { functionsGUIService.dataBase.ExecuteProcedure("PROPOSTVOUCHER", new string[] { "model", "VoucherID" }, new string[] { ModelName, VoucherID }); } } } } LoadData(); } else if (EnumPermission.Edit == StatusUse) { if (CheckExitValue(ControlCheckExit)) { DelMessageBox.DelMessageBoxOk(StringMessage.InfomationExistsObject); return(false); } functionsGUIService.UpdateTable(LoadListControlAndField(groHeader), TableHeader, "VoucherID", VoucherID); LoadData(); } } else { SetNullControl(groHeader); ((Control)DeveloverControlsFocus).Focus(); } return(true); }
protected virtual bool BarButtonNew_Click() { if (EnumPermission.Edit == StatusUse || EnumPermission.New == StatusUse) { if (CheckEmty(ControlCheckEmty)) { DelMessageBox.DelMessageBoxOk(StringMessage.CompelInput); return(false); } if (EnumPermission.New == StatusUse) { if (CheckDuplicate(ControlCheckDuplicate, Table, NameFieldCodePrimary)) { DelMessageBox.DelMessageBoxOk(StringMessage.InfomationExistsObject); return(false); } CodePrimary = functionsGUIService.GetGUID(); functionsGUIService.InsertIntoTable(LoadListControlAndField(gro_general), Table, NameFieldCodePrimary, CodePrimary); LoadData(); } else if (EnumPermission.Edit == StatusUse) { if (CheckDuplicate(ControlCheckDuplicate, Table, NameFieldCodePrimary, CodePrimary)) { DelMessageBox.DelMessageBoxOk(StringMessage.InfomationExistsObject); return(false); } functionsGUIService.UpdateTable(LoadListControlAndField(gro_general), Table, NameFieldCodePrimary, CodePrimary); LoadData(); } SetStatus("Lưu thành công"); } else { SetStatus("Đang thêm mới"); SetNullControl(gro_general); ((Control)DeveloverControlsFocus).Focus(); } return(true); }