/// <summary> /// 保存 /// </summary> public override void SaveAction() { //1.前端检查-保存 if (!ClientCheckForSave()) { return; } //2.将【详情】Tab内控件的值赋值给基类的DetailDS SetCardCtrlsToDetailDS(); gdGridWarehouseBin.UpdateData(); //3.执行保存(含服务端检查) bool saveResult = _bll.SaveDetailDS(HeadDS, _warehouseBinList); if (!saveResult) { //保存失败 MessageBoxs.Show(Trans.PIS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //保存成功 MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.SAVE }), MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新列表 RefreshList(); //设置详情是否可编辑 SetDetailControl(); _warehouseBinList.StartMonitChanges(); //4.将DetailDS数据赋值给【详情】Tab内的对应控件 SetDetailDSToCardCtrls(); //将最新的值Copy到初始UIModel this.AcceptUIModelChanges(); }
/// <summary> /// 前端检查-保存 /// </summary> /// <returns></returns> private bool ClientCheckForSave() { //判断【配件类别名称】是否为空 if (string.IsNullOrEmpty(txtAPT_Name.Text)) { MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.E_0001, new object[] { SystemTableColumnEnums.BS_AutoPartsType.Name.APT_Name }), MessageBoxButtons.OK, MessageBoxIcon.Information); txtAPT_Name.Focus(); return(false); } //判断【顺序】是否超过超过9个 if (txtAPT_Index.Text.Length > 9) { //“顺序”字数不能超过9个 MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.E_0029, new object[] { SystemTableColumnEnums.BS_AutoPartsType.Name.APT_Index, MsgParam.NINE }), MessageBoxButtons.OK, MessageBoxIcon.Information); txtAPT_Index.Focus(); return(false); } //检查配件类别是否存在 var userdCount = _bll.QueryForObject <int>(SQLID.BS_AutoPartsTypeManager_SQL02, new MDLBS_AutoPartsType { WHERE_APT_ID = txtAPT_ID.Text.Trim(), WHERE_APT_Name = txtAPT_Name.Text.Trim(), }); if (userdCount > 0) { //配件名称已存在 MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.E_0006, new object[] { SystemTableColumnEnums.BS_AutoPartsName.Name.APN_Name }), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } return(true); }
/// <summary> /// Method to update a list of AclGroup entities into the database. /// </summary> /// <param name="newItems">Thee list of items to update.</param> /// <param name="oldItems"></param> public static async void DbUpdateAsync(List <AclGroupEntity> newItems, List <AclGroupEntity> oldItems) { log.Info("Replacing AclGroup. Please wait..."); try { if (newItems != null && newItems.Count > 0) { foreach (AclGroupEntity entity in newItems) { await Db.AclGroups.UpdateAsync(entity); if (entity.IsDefault) { Db.AclGroups.SetDefault(entity.PrimaryKey); } log.Info(string.Format("AclGroup [{0}:{1}] updated.", entity.PrimaryKey, entity.Name)); } } AppNavigatorBase.Clear(); log.Info("Replacing AclGroup(s). Done !"); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Fatal(ex, "Replacing AclGroup(s) failed !"); } }
/// <summary> /// Method called on delete click to delete an AclGroup. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Routed event arguments.</param> public override void DeleteItems_Click(object sender, RoutedEventArgs e) { // Check if an AclGroup is founded. if (SelectedItem != null && SelectedItem.IsDefault == false) { // Alert user for acceptation. MessageBoxResult result = MessageBox.Show ( String.Format( Dialogs.Properties.Translations.MessageBox_Acceptation_DeleteGeneric, Local.Properties.Translations.Group, SelectedItem.Name ), Local.Properties.Translations.ApplicationName, MessageBoxButton.YesNoCancel ); // If accepted, try to update page model AclGroup collection. if (result == MessageBoxResult.Yes) { NotifyDeleted(SelectedItem); } } else if (SelectedItem != null && SelectedItem.IsDefault == true) { log.Info("Default User Group cannot be delete !"); } else { log.Error("User not found !"); MessageBoxs.Warning("User not found !"); } }
/// <summary> /// 新增 /// </summary> public override void NewAction() { #region 检查详情是否已保存 SetCardCtrlsToDetailDS(); base.NewUIModel = DetailDS; if (ViewHasChanged()) { //信息尚未保存,确定进行当前操作? DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0001), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } } #endregion //1.执行基类方法 base.NewAction(); //2.初始化【详情】Tab内控件 InitializeDetailTabControls(); //3.设置【详情】Tab为选中状态 tabControlFull.Tabs[SysConst.EN_DETAIL].Selected = true; SetCardCtrlsToDetailDS(); //将最新的值Copy到初始UIModel this.AcceptUIModelChanges(); }
/// <summary> /// 保存 /// </summary> public override void SaveAction() { //1.前端检查 if (!ClientCheck()) { return; } //保存数据 bool saveResult = _bll.SaveUserMenu(mcbUserName.SelectedValue, _userMenuAuthoritiyList, _userActionAuthoritiyList, _userJobAuthoritiyList); if (!saveResult) { //保存失败 MessageBoxs.Show(Trans.SM, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //保存成功 MessageBoxs.Show(Trans.SM, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.SAVE }), MessageBoxButtons.OK, MessageBoxIcon.Information); _userMenuAuthoritiyList.StartMonitChanges(); _userActionAuthoritiyList.StartMonitChanges(); _userJobAuthoritiyList.StartMonitChanges(); //获取最新的用户菜单明细授权和用户菜单明细动作授权进行绑定 SetUserMenuAndActionInfo(); //获取最新的用户作业授权进行绑定 SetUserJobInfo(); }
private void btn_add_borclu_Click(object sender, EventArgs e) { try { if (tBoxTCNo.Text != "" && tBoxTCNo.TextLength == 11) { DataTable dt = (DataTable)dgvBorclular.DataSource; DataRow dr = dt.NewRow(); dt.PrimaryKey = new DataColumn[] { dt.Columns[0] }; dr[0] = tbox_borclu_kisino.Text; dr[1] = tBoxTCNo.Text; dr[2] = tBoxAdi.Text; dr[3] = tBoxSoyadi.Text; if (!dt.Rows.Contains(dr)) { dt.Rows.Add(dr); dt.AcceptChanges(); } dgvBorclular.DataSource = dt; clearBorcluTbox(); } } catch (Exception ex) { MessageBoxs.WarningMessage("Hata: Bu Kayıt Zaten Ekli"); } }
/// <summary> /// Method to update a list of Section entities into the database. /// </summary> /// <param name="newItems">Thee list of items to update.</param> /// <param name="oldItems"></param> public static async void DbUpdateAsync(List <SectionEntity> newItems, List <SectionEntity> oldItems) { log.Info("Replacing Section. Please wait..."); try { if (newItems != null && newItems.Count > 0) { foreach (SectionEntity entity in newItems) { FormatAlias(entity); await Db.Sections.UpdateAsync(entity); log.Info(string.Format("Section [{0}:{1}] updated.", entity.PrimaryKey, entity.Name)); } } AppNavigatorBase.Clear(); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Fatal(ex, "Replacing Section(s) failed !"); } }
/// <summary> /// Method called on delete click to delete a Section. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Routed event arguments.</param> public override void DeleteItems_Click(object sender, RoutedEventArgs e) { // Check if an AclGroup is founded. if (SelectedItem != null) { // Alert user for acceptation. MessageBoxResult result = MessageBox.Show ( String.Format( Dialogs.Properties.Translations.MessageBox_Acceptation_DeleteGeneric, Local.Properties.Translations.Section, SelectedItem.Name ), Local.Properties.Translations.ApplicationName, MessageBoxButton.YesNoCancel ); // If accepted, try to update page model collection. if (result == MessageBoxResult.Yes) { NotifyDeleted(SelectedItem); } } else { string message = Exceptions.GetReferenceNull(nameof(SelectedItem), typeof(SectionEntity)).Message; log.Warn(message); MessageBoxs.Warning(message); } }
/// <summary> /// Method called on <see cref="FrameworkElement"/> size changed event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">The size changed event arguments <see cref="SizeChangedEventArgs"/>.</param> public override void Layout_SizeChanged(object sender, SizeChangedEventArgs e) { try { // Initialize some variables var blockContent = FindName <FrameworkElement>("BlockMiddleContentName"); var topContent = FindName <FrameworkElement>("BlockTopControlsName"); var tabContentW = ((Frame)MainBlockContentTabs.SelectedContent).ActualWidth; var tabContentH = ((Frame)MainBlockContentTabs.SelectedContent).ActualHeight; // Arrange this height & width Width = Math.Max(tabContentW, 0); Height = Math.Max(tabContentH, 0); blockContent.Width = Width; blockContent.Height = UcTreeViewDirectories.Height = UcListViewStoragesServer.Height = Math.Max(Height - topContent.RenderSize.Height, 0); TraceSize(MainBlockContent); TraceSize(this); TraceSize(topContent); TraceSize(blockContent); TraceSize(UcTreeViewDirectories); TraceSize(UcListViewStoragesServer); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Error(ex); } }
/// <summary> /// Method called on edit click to navigate to a Album edit window. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Routed event arguments.</param> public override void EditItem_Click(object sender, RoutedEventArgs e) { MessageBoxs.NotImplemented(); return; // Check if an AclGroup is founded. //if (SelectedItem != null) //{ // // Show open file dialog box // WindowFormAlbumLayout dlg = new WindowFormAlbumLayout(SelectedItem.PrimaryKey); // bool? result = dlg.ShowDialog(); // // Process open file dialog box results // if (result == true) // { // NotifyChanged(dlg.NewForm); // } // else // { // NotifyCanceled(dlg.NewForm); // } //} //else //{ // string message = string.Format("{0} not found !", typeof(AlbumEntity).Name); // log.Warn(message); // MessageBoxs.Warning(message); //} }
/// <summary> /// Method to start the server. /// </summary> public static void Start() { // Check if the server is started. if (!HttpWebServerApplication.IsStarted) { try { // Try to get server informations ServerData server = ApplicationBase.Options.Remote.Servers.FindDefaultFirst(); if (server != null) { HttpWebServerApplication.Start(server.Host, server.Port); log.Info(Properties.Logs.ServerStarted); } NotifyServerStarted(); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Warning(ex.Output(), ex.GetType().Name); NotifyServerFailed(); } } else { log.Warn("Server is already started."); } }
/// <summary> /// 前端检查-保存 /// </summary> /// <returns></returns> private bool ClientCheckForSave() { if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected) { //验证配件名称是否为空 if (string.IsNullOrEmpty(txtSI_Name.Text.Trim())) { //配件名称不能为空 MessageBoxs.Show(Trans.IS, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0001, new object[] { SystemTableColumnEnums.PIS_ShareInventory.Name.SI_Name }), MessageBoxButtons.OK, MessageBoxIcon.Information); txtSI_Name.Focus(); return(false); } } else { if (_detailGridDS.Count == 0) { //请至少添加一条共享库存信息 MessageBoxs.Show(Trans.IS, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0014, new object[] { SystemTableEnums.Name.PIS_ShareInventory }), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } return(true); }
/// <summary> /// 充值 /// </summary> public override void RechargeAction() { //1.前端检查-充值 if (!ClientCheckForRecharge()) { return; } //2.将【详情】Tab内控件的值赋值给基类的DetailDS SetCardCtrlsToDetailDS(); //3.执行保存(含服务端检查) bool saveResult = _bll.SaveDetailDS(DetailDS, _depositDetailList); if (!saveResult) { //充值失败 MessageBoxs.Show(Trans.RIA, ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //充值成功 MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information); //初始化详情 InitializeDetailTabControls(); SetCardCtrlsToDetailDS(); //将最新的值Copy到初始UIModel this.AcceptUIModelChanges(); }
/// <summary> /// Method to update a list of AclAction entities into the database. /// </summary> /// <param name="newItems">Thee list of items to update.</param> /// <param name="oldItems"></param> public static void DbUpdate(List <AclActionEntity> newItems, List <AclActionEntity> oldItems) { log.Info("Replacing AclAction. Please wait..."); try { if (newItems != null && newItems.Count > 0) { foreach (AclActionEntity entity in newItems) { //await Db.AclActions.Update(entity); MessageBoxs.NotImplemented(); log.Info($"AclAction [{entity.PrimaryKey}:{entity.Action}] updated."); } } AppNavigatorBase.Clear(); log.Info("Replacing AclAction(s). Done !"); } catch (Exception ex) { log.Error(ex); MessageBoxs.Fatal(ex, "Replacing AclAction(s) failed !"); } }
/// <summary> /// Method called on edit click to navigate to a Section edit window. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Routed event arguments.</param> public override void EditItem_Click(object sender, RoutedEventArgs e) { // Check if an AclGroup is founded. if (SelectedItem != null) { // Show open file dialog box using (WindowFormSectionLayout dlg = new WindowFormSectionLayout(SelectedItem)) { bool?result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { NotifyChanged(dlg.NewForm); } else { NotifyCanceled(dlg.NewForm); } } } else { string message = Exceptions.GetReferenceNull(nameof(SelectedItem), typeof(SectionEntity)).Message; log.Warn(message); MessageBoxs.Warning(message); } }
/// <summary> /// 前端检查-保存 /// </summary> /// <returns></returns> private bool ClientCheckForSave() { if (!string.IsNullOrEmpty(txtGC_ID.Text.Trim())) { //验证普通客户是否已被使用 StringBuilder customerIDs = new StringBuilder(); customerIDs.Append(SysConst.Semicolon_DBC + txtGC_ID.Text + SysConst.Semicolon_DBC); //查询普通客户是否被引用过 List <MDLPIS_GeneralCustomer> generalCustomerList = new List <MDLPIS_GeneralCustomer>(); _bll.QueryForList(SQLID.PIS_GeneralCustomerManager_SQL02, new MDLPIS_GeneralCustomer { WHERE_GC_ID = customerIDs.ToString() }, generalCustomerList); if (generalCustomerList.Count > 0) { MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, MsgParam.APPLY, SystemActionEnum.Name.SAVE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } //验证姓名 if (string.IsNullOrEmpty(txtGC_Name.Text)) { MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0001, new object[] { SystemTableColumnEnums.PIS_GeneralCustomer.Name.GC_Name }), MessageBoxButtons.OK, MessageBoxIcon.Information); txtGC_Name.Focus(); return(false); } //验证手机号码 if (string.IsNullOrEmpty(txtGC_PhoneNo.Text)) { MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0001, new object[] { SystemTableColumnEnums.PIS_GeneralCustomer.Name.GC_PhoneNo }), MessageBoxButtons.OK, MessageBoxIcon.Information); txtGC_PhoneNo.Focus(); return(false); } return(true); }
/// <summary> /// Method called on language changed click event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">The routed event arguments <see cref="RoutedEventArgs"/>.</param> private void LanguageChanged_Click(object sender, RoutedEventArgs e) { // Ask for user confirmation. var result = MessageBoxs.YesNo(Layouts.Dialogs.Properties.Translations.ApplicationRestartRequired, Local.Properties.Translations.Language); if (result != MessageBoxResult.Yes) { return; } // Get culture parameters. MenuItem menu = (MenuItem)sender; string culture = (string)menu.Tag; CultureInfo before = Thread.CurrentThread.CurrentCulture; // Change application culture info. try { Thread.CurrentThread.CurrentCulture = new CultureInfo(culture); } catch { Thread.CurrentThread.CurrentUICulture = before; } // Save language to the application preferences. ApplicationBase.Language = Thread.CurrentThread.CurrentCulture.ToString(); ApplicationBase.Save(); // Restart the application. System.Windows.Forms.Application.Restart(); Application.Current.Shutdown(); }
/// <summary> /// /// </summary> /// <param name="pk"></param> /// <param name="email"></param> public bool IsUniqueEmail(int pk, string email) { try { var usr = SQLiteSvc.GetInstance().Users.SingleOrNull(new UserOptionsSelect { Email = email }); if (usr == null) { return(true); } else if (usr.PrimaryKey == pk) { return(true); } } catch (Exception ex) { log.Error(ex.Output()); MessageBoxs.Error(ex.Output()); } return(false); }
private void btnSave_Click(object sender, EventArgs e) { try { SaveFileDialog save = new SaveFileDialog(); save.Filter = "PDF Dosyası | *.pdf"; if (save.ShowDialog() == DialogResult.OK) { MemoryStream stream = new MemoryStream(); pdfViewer.SaveToFile(stream); byte[] bytesInStream = new byte[stream.Length]; bytesInStream = stream.ToArray(); FileStream fileStream = new FileStream(save.FileName, FileMode.Create, FileAccess.Write); stream.CopyTo(fileStream); fileStream.Write(bytesInStream, 0, bytesInStream.Length); fileStream.Close(); } MessageBoxs.SuccessMessage("Dosya Kaydedildi"); } catch (Exception ex) { MessageBoxs.ErrorMessage(ex); } }
private void addIcra2DB() { try { decimal bakiye = parayaCevir(tBoxBakiye.Text); if (bakiye > 0) { NpgsqlCommand command = new NpgsqlCommand(); command.CommandText = "select addIcra(@esasno , @tarih , @icra_dairesi, @tutar_ , @icraturu, @borclu , @alacak, @oncelik, @sabit_kesinti);"; command.Parameters.AddWithValue("@esasno", NpgsqlTypes.NpgsqlDbType.Text, tBoxEsasNo.Text); command.Parameters.AddWithValue("@tarih", NpgsqlTypes.NpgsqlDbType.Date, Date_date.Value); command.Parameters.AddWithValue("@icra_dairesi", NpgsqlTypes.NpgsqlDbType.Integer, Convert.ToInt32(cBox_İcraDairesi.SelectedValue)); command.Parameters.AddWithValue("@tutar_", NpgsqlTypes.NpgsqlDbType.Money, bakiye); command.Parameters.AddWithValue("@sabit_kesinti", NpgsqlTypes.NpgsqlDbType.Money, parayaCevir(tBox_sabit_kesinti.Text)); command.Parameters.AddWithValue("@icraturu", NpgsqlTypes.NpgsqlDbType.Integer, Convert.ToInt32(cBox_IcraTuru.SelectedValue)); command.Parameters.AddWithValue("@oncelik", NpgsqlTypes.NpgsqlDbType.Boolean, cBox_Oncelik.Checked); command.Parameters.AddWithValue("@borclu", NpgsqlTypes.NpgsqlDbType.Array | NpgsqlTypes.NpgsqlDbType.Integer, getBorclu()); command.Parameters.AddWithValue("@alacak", NpgsqlTypes.NpgsqlDbType.Array | NpgsqlTypes.NpgsqlDbType.Integer, getAlacak()); // command.CommandType = CommandType.StoredProcedure; dbConnection.sendQuery(command); MessageBoxs.SuccessMessage("İcra Dosyası Oluşturma Başarılı"); clear(); } } catch (Exception) { throw; } }
/// <summary> /// 添加前检查 /// </summary> private bool CheckForAdd() { //第三方编码 string thirdNo = txtVBPI_ThirdNo.Text.Trim(); //配件名称 string autoPartsName = mcbVTPI_AutoPartsName.SelectedValue; //配件品牌 string autoPartsBrand = txtVBPI_AutoPartsBrand.Text.Trim(); if (string.IsNullOrEmpty(thirdNo)) { MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, "请输入第三方编码"), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (string.IsNullOrEmpty(autoPartsName)) { MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, "请选择配件名称"), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (string.IsNullOrEmpty(autoPartsBrand)) { MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, "请选择配件品牌"), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } _brandPartsInfo.VTPI_ThirdNo = thirdNo; _brandPartsInfo.VTPI_AutoPartsName = autoPartsName; _brandPartsInfo.VTPI_AutoPartsBrand = autoPartsBrand; _brandPartsInfo.VTPI_Remark = txtVBPI_Remark.Text.Trim(); return(true); }
/// <summary> /// Method called on edit click event to navigate to an AclGroup edit window. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Routed event arguments.</param> public override void EditItem_Click(object sender, RoutedEventArgs e) { // Check if an AclGroup is founded. if (SelectedItem != null) { // Show open file dialog box WindowFormAclGroupLayout dlg = new WindowFormAclGroupLayout(SelectedItem); bool?result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { NotifyChanged(dlg.NewFormData); } else { NotifyCanceled(dlg.NewFormData); } } else { string message = string.Format("{0} not found !", nameof(AclGroupEntity)); log.Warn(message); MessageBoxs.Warning(message); } }
/// <summary> /// Method to update a list of Picture entities into the database. /// </summary> /// <param name="newItems">The list of items to update.</param> /// <param name="oldItems"></param> public static async void DbUpdateAsync(List <PictureEntity> newItems, List <PictureEntity> oldItems) { // Check for Replace | Edit items. try { log.Info("Replacing Picture. Please wait..."); if (newItems != null && newItems.Count > 0) { foreach (PictureEntity entity in newItems) { await Db.Pictures.UpdateAsync(entity); log.Info(string.Format("Picture [{0}:{1}] updated.", entity.PrimaryKey, entity.Name)); } } AppNavigatorBase.Clear(); log.Info("Replacing Picture(s). Done !"); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Fatal(ex, "Replacing Picture(s) failed !"); } }
/// <summary> /// 保存 /// </summary> public override void SaveAction() { //1.前端检查-保存 if (!ClientCheckForSave()) { return; } //2.将【详情】Tab内控件的值赋值给基类的DetailDS SetCardCtrlsToDetailDS(); //3.执行保存(含服务端检查) if (!_bll.SaveDetailDS(DetailDS)) { MessageBoxs.Show(Trans.BS, ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //保存成功 MessageBoxs.Show(Trans.SM, ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.SAVE }), MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新列表 RefreshList(); //4.将DetailDS数据赋值给【详情】Tab内的对应控件 SetDetailDSToCardCtrls(); //将最新的值Copy到初始UIModel this.AcceptUIModelChanges(); }
/// <summary> /// 删除 /// </summary> public override void DeleteAction() { //1.前端检查-删除 if (!ClientCheckForDelete()) { return; } var argsDetail = new List <MDLPIS_PurchaseForecastOrderDetail>(); //将HeadDS转换为TBModel对象 var argsHead = base.HeadDS.ToTBModelForSaveAndDelete <MDLPIS_PurchaseForecastOrder>(); //将当前DetailGridDS转换为指定类型的TBModelList _detailGridDS.ToTBModelListForUpdateAndDelete <MDLPIS_PurchaseForecastOrderDetail>(argsDetail); //过滤明细列表中未保存的数据 argsDetail = argsDetail.Where(x => !string.IsNullOrEmpty(x.WHERE_PFOD_ID)).ToList(); //2.执行删除 if (!_bll.UnityDelete <MDLPIS_PurchaseForecastOrder, MDLPIS_PurchaseForecastOrderDetail>(argsHead, argsDetail)) { MessageBoxs.Show(Trans.PIS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); //3.清空【详情】画面数据 InitializeDetailTabControls(); //4.执行查询 QueryAction(); }
/// <summary> /// Method to delete a list of AclGroup entities from the database. /// </summary> /// <param name="oldItems">The list of items to remove.</param> public static void DbDelete(List <AclGroupEntity> oldItems) { log.Info("Deleting AclGroup(s). Please wait..."); try { if (oldItems != null && oldItems.Count > 0) { foreach (AclGroupEntity entity in oldItems) { if (!entity.IsDefault) { Db.AclGroups.Delete(entity.PrimaryKey); } log.Info(string.Format("AclGroup [{0}:{1}] deleted.", entity.PrimaryKey, entity.Name)); } } AppNavigatorBase.Clear(); log.Info("Deleting AclGroup(s). Done !"); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Fatal(ex, "Deleting AclGroup(s) list failed !"); } }
/// <summary> /// Method called on delete click to delete a User. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Routed event arguments.</param> public override void DeleteItems_Click(object sender, RoutedEventArgs e) { if (SelectedItem != null) { // Alert user for acceptation. MessageBoxResult result = MessageBox.Show ( String.Format( Dialogs.Properties.Translations.MessageBox_Acceptation_DeleteGeneric, Local.Properties.Translations.User, SelectedItem.Name ), Local.Properties.Translations.ApplicationName, MessageBoxButton.YesNoCancel ); // If accepted, try to update page model collection. if (result == MessageBoxResult.Yes) { NotifyDeleted(SelectedItem); } } else { string message = string.Format("{0} not found !", nameof(UserEntity)); log.Warn(message); MessageBoxs.Warning(message); } }
/// <summary> /// Method to insert a list of AclGroup entities into the database. /// </summary> /// <param name="newItems">Thee list of items to add.</param> public static void DbInsert(List <AclGroupEntity> newItems) { log.Info("Adding AclGroup(s). Please wait..."); try { if (newItems != null && newItems.Count > 0) { foreach (AclGroupEntity entity in newItems) { Db.AclGroups.Add(entity); log.Info($"AclGroup [{entity.PrimaryKey}:{entity.Name}] added."); } } AppNavigatorBase.Clear(); log.Info("Adding AclGroup(s). Done !"); } catch (Exception e) { log.Error(e.Output(), e); MessageBoxs.Fatal(e, "Adding AclGroup(s) failed !"); } }
/// <summary> /// 前端检查-保存 /// </summary> private bool ClientCheckForSave() { #region 验证 if (string.IsNullOrEmpty(numThisPayAmount.Text.Trim())) { MessageBoxs.Show(Trans.FM, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0001, new object[] { MsgParam.THIS_PAYAMOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information); numThisPayAmount.Focus(); return(false); } decimal payAmount = Convert.ToDecimal(numThisPayAmount.Value ?? 0); decimal unPayAmount = Convert.ToDecimal(txtAPB_UnpaidAmount.Text.Trim() == "" ? "0" : txtAPB_UnpaidAmount.Text.Trim()); if (payAmount > unPayAmount) { //本次付款金额大于未付金额,是否确认支付?\r\n单击【确定】支付单据,【取消】返回。 DialogResult isPay = MessageBoxs.Show(Trans.FM, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0037, new object[] { MsgParam.THIS_PAYAMOUNT, SystemTableColumnEnums.FM_AccountPayableBill.Name.APB_UnpaidAmount, MsgParam.PAY }), MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (isPay != DialogResult.OK) { return(false); } } #endregion return(true); }