private void btnRecover_Click(object sender, EventArgs e) { string title = "恢复工具组"; if (dgvGroups.SelectedRows.Count > 0) { if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要恢复这些工具组数据吗?") == DialogResult.Yes) { //获取要恢复的Id List <int> tgIds = new List <int>(); foreach (DataGridViewRow row in dgvGroups.SelectedRows) { ToolGroupInfoModel tgInfo = row.DataBoundItem as ToolGroupInfoModel; tgIds.Add(tgInfo.TGroupId); } bool bl = RequestStar.RecoverToolGroups(tgIds); if (bl) { MsgBoxHelper.MsgBoxShow(title, "这些工具组恢复成功!"); LoadToolGroups(); } else { MsgBoxHelper.MsgErrorShow("这些工具组恢复失败!"); return; } } } }
/// <summary> /// 单个或多个删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { if (dgvRoles.SelectedRows.Count > 0) { string titleMsg = "删除角色"; if (MsgBoxHelper.MsgBoxConfirm(titleMsg, "您确定要删除选择的角色吗?会连同与角色相关的数据一并删除?") == DialogResult.Yes) { List <int> roleIds = new List <int>(); foreach (DataGridViewRow row in dgvRoles.SelectedRows) { RoleInfoModel roleInfo = row.DataBoundItem as RoleInfoModel; roleIds.Add(roleInfo.RoleId); } bool bl = RequestStar.DeleteRoles(roleIds, 0); if (bl) { MsgBoxHelper.MsgBoxShow(titleMsg, $"选择角色信息删除成功!"); LoadAllRoles(); } else { MsgBoxHelper.MsgErrorShow($"选择角色信息删除失败!"); return; } } } else { MsgBoxHelper.MsgErrorShow("请选择要删除的角色信息!"); return; } }
/// <summary> /// 删除工具组 /// </summary> /// <param name="tgInfo"></param> private void DeleteToolGroupInfo(ToolGroupInfoModel tgInfo) { string title = "删除工具组"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要删除该工具组数据吗?") == DialogResult.Yes) { //先检查是否已添加工具菜单数据 List <int> tgIds = new List <int>(); tgIds.Add(tgInfo.TGroupId); if (!RequestStar.HasToolMenus(tgIds)) { bool bl = RequestStar.LogicDeleteToolGroup(tgInfo.TGroupId); if (bl) { MsgBoxHelper.MsgBoxShow(title, $"工具组:{tgInfo.TGroupName} 删除成功!"); LoadToolGroups(); } else { MsgBoxHelper.MsgErrorShow($"工具组:{tgInfo.TGroupName} 删除失败!"); return; } } else { MsgBoxHelper.MsgErrorShow($"工具组:{tgInfo.TGroupName} 已添加工具菜单项,不能删除!"); return; } } }
/// <summary> /// 红冲 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiRedChecked_Click(object sender, EventArgs e) { Action act = () => { if (actType == 1) { MsgBoxHelper.MsgErrorShow("期初入库单还未保存,不能红冲!"); return; } if (actType == 2 && lblCheckState.Text.Trim() == "待审核") { MsgBoxHelper.MsgErrorShow("期初入库单还未审核,不能红冲!"); return; } if (MsgBoxHelper.MsgBoxConfirm("期初入库单审核", "你确定要红冲该入库单吗?") == DialogResult.Yes) { bool bl = RequestStar.RedCheckStockInfo(stockId, store.StoreId); if (bl) { lblCheckState.Text = "已红冲"; lblCheckState.ForeColor = Color.Green; SetBtnsEnabled(3); } } }; act.TryCatch("红冲入库单出现异常!"); }
/// <summary> /// 启用或停用用户 /// </summary> /// <param name="type"></param> /// <param name="userId"></param> private void UpdateUserState(int type, int userId) { string msg = ""; if (type == 1) { msg = "启用"; } else { msg = "停用"; } if (MsgBoxHelper.MsgBoxConfirm($"用户{msg}", $"您确定要{msg}该账号吗?") == DialogResult.Yes) { bool bl = false; if (type == 1) { bl = RequestStar.EnableUser(userId); } else { bl = RequestStar.StopUser(userId); } if (bl) { MsgBoxHelper.MsgBoxShow($"用户{msg}", $"该用户{msg}成功!"); LoadUserList(); } else { MsgBoxHelper.MsgErrorShow($"该用户{msg}失败!"); return; } } }
/// <summary> /// 删除菜单信息 一条或多条都可以 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnDelete_Click(object sender, EventArgs e) { if (dgvMenus.SelectedRows.Count == 0) { MsgBoxHelper.MsgErrorShow("请选择要删除的菜单信息!"); return; } if (MsgBoxHelper.MsgBoxConfirm("菜单删除", "您确定要删除选择的菜单信息吗?删除菜单会连同菜单及其角色菜单关系数据一并删除?") == DialogResult.Yes) { List <int> menuIds = new List <int>(); foreach (DataGridViewRow row in dgvMenus.SelectedRows) { MenuInfoModel menuInfo = row.DataBoundItem as MenuInfoModel; menuIds.Add(menuInfo.MId); } bool bl = RequestStar.DeleteMenu(menuIds, 0); if (bl) { MsgBoxHelper.MsgBoxShow("删除菜单", "选择的菜单信息删除成功!"); LoadMenuList(); } else { MsgBoxHelper.MsgErrorShow("选择的菜单信息删除失败!"); return; } } }
/// <summary> /// 打开批量设置页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnSetMore_Click(object sender, EventArgs e) { Action act = () => { if (dgvList.SelectedRows.Count == 0) { MsgBoxHelper.MsgErrorShow("请选择要设置库存上下限的商品!"); return; } else { if (MsgBoxHelper.MsgBoxConfirm("设置上下限", $"您确定设置这{dgvList.SelectedRows.Count}个商品的库存上下限吗?") == DialogResult.Yes) { //要进行统一设置的商品列表 List <ViewStoreStockUpDownModel> list = new List <ViewStoreStockUpDownModel>(); foreach (DataGridViewRow row in dgvList.SelectedRows) { var info = row.DataBoundItem as ViewStoreStockUpDownModel; list.Add(info); } //打开批量设置页面 list storeName 刷新列表 订阅事件 FrmSetMore fSetMore = new FrmSetMore(); fSetMore.Tag = new StockSetMoreModel() { StoreUpDownList = list, StoreName = cboStores.Text.Trim() }; fSetMore.ReloadList += LoadGoodsStockUpDownList; fSetMore.ShowDialog(); } } }; act.TryCatch("批量设置库存上下限出现异常!"); }
/// <summary> /// 恢复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnRecover_Click(object sender, EventArgs e) { if (dgvTMenus.SelectedRows.Count == 0) { MsgBoxHelper.MsgErrorShow("您没有选择要恢复的工具菜单项!"); return; } string title = "恢复工具菜单项"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要恢复这些工具菜单项数据吗?会连同角色工具菜单关系数据一并恢复?") == DialogResult.Yes) { //获取要恢复的工具菜单编号 List <int> delIds = new List <int>(); foreach (DataGridViewRow row in dgvTMenus.SelectedRows) { ToolMenuInfoModel tmInfo = row.DataBoundItem as ToolMenuInfoModel; delIds.Add(tmInfo.TMenuId); } //恢复操作 bool bl = RequestStar.RecoverToolMenus(delIds); if (bl) { MsgBoxHelper.MsgBoxShow(title, "选择的工具菜单项恢复成功!"); LoadTMenuList(); } else { MsgBoxHelper.MsgErrorShow("选择的工具菜单项恢复失败!"); return; } } }
/// <summary> /// 处理行删除 恢复 永久删除 /// </summary> /// <param name="guInfo"></param> /// <param name="actType">0--恢复 1--假删除 2---真删除</param> private void DeleteUnit(GoodsUnitInfoModel guInfo, int actType) { string actMsg = ""; switch (actType) { case 0: actMsg = "恢复"; break; case 1: actMsg = "删除"; break; case 2: actMsg = "永久删除"; break; } string title = actMsg + "单位"; if (MsgBoxHelper.MsgBoxConfirm(title, $"您确定要{actMsg}该计量单位吗?") == DialogResult.Yes) { bool bl = false; switch (actType) { case 0: bl = RequestStar.GoodsUnitRecover(guInfo.GUnitId); break; case 1: if (!RequestStar.GetGoodsUnitUse(guInfo.GUnitName)) { bl = RequestStar.GoodsUnitLogicDelete(guInfo.GUnitId); } else { MsgBoxHelper.MsgErrorShow($"计量单位:{guInfo.GUnitName} 已经应用,不能删除!"); return; } break; case 2: bl = RequestStar.GoodsUnitDelete(guInfo.GUnitId); break; } string sucMsg = bl ? "成功" : "失败"; string msg = $"计量单位:{guInfo.GUnitName} {actMsg}{sucMsg}!"; if (bl) { MsgBoxHelper.MsgBoxShow(title, msg); LoadGUnitList(); } else { MsgBoxHelper.MsgErrorShow(msg); return; } } }
//isdeleted 1-LogicDelete 0 Recover 2 Delete private void DeleteGType(int isDeleted, GoodsTypeInfoModel gt) { string delTypeName = FormUtility.GetDeleteTypeName(isDeleted); string msgTitle = $"商品类别{delTypeName}"; if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该商品类别?") == DialogResult.Yes) { bool bl = false; switch (isDeleted) { case 1: //删除 //如果该类别添加了商品,不允许删除 bool hasAddGoods = RequestStar.CheckIsAddGoods(gt.GTypeId); //如果该类别添加了子类别,不允许删除 bool hasChilds = RequestStar.HasChildTypes(gt.GTypeId); if (!hasAddGoods && !hasChilds) { bl = RequestStar.GoodsTypeLogicDelete(gt.GTypeId); } else if (hasAddGoods) { MsgBoxHelper.MsgErrorShow($"该类别:{gt.GTypeName} 已经添加商品,不能删除!"); return; } else if (hasChilds) { MsgBoxHelper.MsgErrorShow($"该类别:{gt.GTypeName} 已经添加了子类别,不能删除!"); return; } break; case 0: //恢复 bl = RequestStar.GoodsTypeRecover(gt.GTypeId); break; case 2: //移除 bl = RequestStar.GoodsTypeDelete(gt.GTypeId); break; } string sucType = bl ? "成功" : "失败"; string delMsg = $"商品类别:{gt.GTypeName} {delTypeName} {sucType}"; if (bl) { MsgBoxHelper.MsgBoxShow(msgTitle, delMsg); LoadGoodsTypeList(); if (isDeleted != 2) { ReloadCboParents(gt, true, isDeleted); } } else { MsgBoxHelper.MsgErrorShow(delMsg); return; } } }
/// <summary> /// 删除、恢复、移除处理 /// </summary> /// <param name="isDeleted"></param> /// <param name="utInfo"></param> private void DeleteUnitType(int isDeleted, UnitTypeInfoModel utInfo) { string delTypeName = FormUtility.GetDeleteTypeName(isDeleted); string msgTitle = $"往来单位类别{delTypeName}"; if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该往来单位类别?") == DialogResult.Yes) { bool bl = false; switch (isDeleted) { case 1: //删除 //如果该类别添加了单位,不允许删除 bool hasAddUnits = RequestStar.IsAddUnits(utInfo.UTypeId); //如果该类别添加了子类别,不允许删除 bool hasChilds = RequestStar.IsAddChilds(utInfo.UTypeId); if (!hasAddUnits && !hasChilds) { bl = RequestStar.UnitTypeLogicDelete(utInfo.UTypeId); } else if (hasAddUnits) { MsgBoxHelper.MsgErrorShow($"该类别:{utInfo.UTypeName} 已经添加了单位,不能删除!"); return; } else if (hasChilds) { MsgBoxHelper.MsgErrorShow($"该类别:{utInfo.UTypeName} 已经添加了子类别,不能删除!"); return; } break; case 0: //恢复 bl = RequestStar.UnitTypeRecover(utInfo.UTypeId); break; case 2: //移除 bl = RequestStar.UnitTypeDelete(utInfo.UTypeId); break; } string sucType = bl ? "成功" : "失败"; string delMsg = $"往来单位类别:{utInfo.UTypeName} {delTypeName} {sucType}"; if (bl) { MsgBoxHelper.MsgBoxShow(msgTitle, delMsg); LoadUnitTypeList(); if (isDeleted != 2) { ReloadCboParents(utInfo, true, isDeleted); } } else { MsgBoxHelper.MsgErrorShow(delMsg); return; } } }
/// <summary> /// 提交权限设置数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { int rId = cboRoles.SelectedValue.GetInt(); CheckIsAdmin(rId); if (rId == 0) { MsgBoxHelper.MsgErrorShow("请选择要设置权限的角色!"); return; } else { //1.获取菜单编号,工具栏菜单编号 List <int> tMenuIds = GetToolMenuIds(rId); List <int> menuIds = new List <int>(); menuIds = GetMenuIds(rId, menuIds, tvMenus.Nodes[0]); bool bl = false;//执行结果 if (menuIds.Count == 0 && tMenuIds.Count == 0) { MsgBoxHelper.MsgErrorShow("请设置该角色的菜单和工具栏权限!"); return; } else if (menuIds.Count == 0 && tMenuIds.Count > 0) { if (MsgBoxHelper.MsgBoxConfirm("权限设置", "您没有设置系统菜单权限,将会无法使用系统菜单功能!是否继续?") == DialogResult.Yes) { //设置工具栏权限 bl = RequestStar.SetRoleRight(rId, null, tMenuIds, uName); } } else if (menuIds.Count > 0 && tMenuIds.Count == 0) { if (MsgBoxHelper.MsgBoxConfirm("权限设置", "您没有设置工具菜单权限,将会无法使用工具栏菜单功能!是否继续?") == DialogResult.Yes) { //设置菜单权限 bl = RequestStar.SetRoleRight(rId, menuIds, null, uName); } } else { //设置菜单和工具栏权限 bl = RequestStar.SetRoleRight(rId, menuIds, tMenuIds, uName); } if (bl) { MsgBoxHelper.MsgBoxShow("权限设置", "权限设置保存成功!"); } else { MsgBoxHelper.MsgErrorShow("权限设置保存失败!"); return; } } }
private void MainIndex_FormClosing(object sender, FormClosingEventArgs e) { if (MsgBoxHelper.MsgBoxConfirm("提示", "是否退出?") == DialogResult.Yes) { Application.ExitThread(); } else { e.Cancel = true; } }
private void tsbtnClose_Click(object sender, EventArgs e) { if (actType == 1) { if (MsgBoxHelper.MsgBoxConfirm("期初入库单", "该单据并未保存,你确定要关闭期初入库单页面吗?") == DialogResult.Yes) { this.CloseForm(); } } else { this.CloseForm(); } }
private void tsbtnCheck_Click(object sender, EventArgs e) { Action act = () => { if (actType == 1) { MsgBoxHelper.MsgErrorShow("销售单还未保存,不能审核!"); return; } if (MsgBoxHelper.MsgBoxConfirm("销售单审核", "你确定要审核该销售单吗?") == DialogResult.Yes) { List <ViewSaleGoodsInfoModel> listGoods = dgvGoods.DataSource as List <ViewSaleGoodsInfoModel>; //检查库存 string reStr = RequestStar.CheckGoodsCurCount(listGoods, store.StoreId); if (!string.IsNullOrEmpty(reStr)) { string[] arrStock = reStr.Split(';'); string[] noStockArr = arrStock.Where(s => s.Contains("0")).ToArray(); string[] notStockArr = arrStock.Where(s => s.Contains("1")).ToArray(); //库存不足 if (noStockArr.Length == 0 && notStockArr.Length == 0) //所有商品的库存足够 { bool bl = RequestStar.CheckSaleInfo(saleId, uName, store.StoreId); if (bl) { lblCheckState.Text = "已审核"; lblCheckState.ForeColor = Color.Red; SetBtnsEnabled(1);//更新页面按钮的可用 } } else if (noStockArr.Length > 0) { string goodsNames = string.Join(",", noStockArr.Select(s => s.Split('-')[0])); MsgBoxHelper.MsgErrorShow($"当前销售单中:{goodsNames} 的没有库存,不能进行审核!"); return; } else if (notStockArr.Length > 0) { string goodsNames = string.Join(",", notStockArr.Select(s => s.Split('-')[0])); MsgBoxHelper.MsgErrorShow($"当前销售单中:{goodsNames} 的库存不足,不能进行审核!"); return; } } } }; act.TryCatch("审核销售单出现异常!"); }
/// <summary> /// 删除单位信息(删除、恢复、移除) /// </summary> /// <param name="isDeleted"></param> /// <param name="unitInfo"></param> private void DeleteUnitInfo(int isDeleted, ViewUnitInfoModel unitInfo) { string delTypeName = FormUtility.GetDeleteTypeName(isDeleted); string msgTitle = $"单位信息{delTypeName}"; if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该单位信息?") == DialogResult.Yes) { bool bl = false; switch (isDeleted) { case 1: //删除 //如果单位在使用中,不允许删除 bool isUnitUse = RequestStar.CheckUnitUse(unitInfo.UnitId); if (!isUnitUse) { bl = RequestStar.UnitLogicDelete(unitInfo.UnitId); } else { MsgBoxHelper.MsgErrorShow($"该单位:{unitInfo.UnitName} 在使用中,不能删除!"); return; } break; case 0: //恢复 bl = RequestStar.UnitRecover(unitInfo.UnitId); break; case 2: //移除 bl = RequestStar.UnitDelete(unitInfo.UnitId); break; } string sucType = bl ? "成功" : "失败"; string delMsg = $"单位信息:{unitInfo.UnitName} {delTypeName} {sucType}"; if (bl) { MsgBoxHelper.MsgBoxShow(msgTitle, delMsg); LoadUnitList(); } else { MsgBoxHelper.MsgErrorShow(delMsg); return; } } }
/// <summary> /// 仓库信息删除处理(删除、恢复、移除) /// </summary> /// <param name="v"></param> /// <param name="storeInfo"></param> private void DeleteStoreInfo(int isDeleted, ViewStoreInfoModel storeInfo) { string delTypeName = FormUtility.GetDeleteTypeName(isDeleted); string msgTitle = $"仓库信息{delTypeName}"; if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该仓库信息?") == DialogResult.Yes) { bool bl = false; switch (isDeleted) { case 1: //删除 //如果仓库在使用中,不允许删除 bool isStoreUse = RequestStar.CheckStoreUse(storeInfo.StoreId); if (!isStoreUse) { bl = RequestStar.DeleteStoreInfo(storeInfo.StoreId); } else { MsgBoxHelper.MsgErrorShow($"该仓库:{storeInfo.StoreName} 在使用中,不能删除!"); return; } break; case 0: //恢复 bl = RequestStar.RecoverStoreInfo(storeInfo.StoreId, uName); break; case 2: //移除 bl = RequestStar.RemoveStoreInfo(storeInfo.StoreId); break; } string sucType = bl ? "成功" : "失败"; string delMsg = $"仓库信息:{storeInfo.StoreName} {delTypeName} {sucType}"; if (bl) { MsgBoxHelper.MsgBoxShow(msgTitle, delMsg); LoadStoreList(); } else { MsgBoxHelper.MsgErrorShow(delMsg); return; } } }
/// <summary> /// 删除商品信息处理(删除、恢复、移除) /// </summary> /// <param name="isDeleted"></param> /// <param name="goodsInfo"></param> private void DeleteGoodsInfo(int isDeleted, ViewGoodsInfoModel goodsInfo) { string delTypeName = FormUtility.GetDeleteTypeName(isDeleted); string msgTitle = $"商品信息{delTypeName}"; if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该商品信息?") == DialogResult.Yes) { bool bl = false; switch (isDeleted) { case 1: //删除 //如果商品在使用中,不允许删除 bool IsGoodsUse = RequestStar.CheckIsGoodsUse(goodsInfo.GoodsId); if (!IsGoodsUse) { bl = RequestStar.DeleteGoodsInfo(goodsInfo.GoodsId); } else { MsgBoxHelper.MsgErrorShow($"该商品:{goodsInfo.GoodsName}在使用中,不能删除!"); return; } break; case 0: //恢复 bl = RequestStar.RecoverGoodsInfo(goodsInfo.GoodsId, uName); break; case 2: //移除 bl = RequestStar.RemoveGoodsInfo(goodsInfo.GoodsId); break; } string sucType = bl ? "成功" : "失败"; string delMsg = $"商品信息:{goodsInfo.GoodsName} {delTypeName} {sucType}"; if (bl) { MsgBoxHelper.MsgBoxShow(msgTitle, delMsg); LoadGoodsList(); } else { MsgBoxHelper.MsgErrorShow(delMsg); return; } } }
/// <summary> /// 删除类别信息处理(删除、恢复、移除) /// </summary> /// <param name="isDeleted"></param> /// <param name="st"></param> private void DeleteStoreType(int isDeleted, StoreTypeInfoModel st) { string delTypeName = FormUtility.GetDeleteTypeName(isDeleted); string msgTitle = $"仓库类别{delTypeName}"; if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该仓库类别?") == DialogResult.Yes) { bool bl = false; switch (isDeleted) { case 1: //删除 //如果该类别添加了仓库,不允许删除 bool hasAddStores = RequestStar.IsAddStores(st.STypeId); if (!hasAddStores) { bl = RequestStar.StoreTypeLogicDelete(st.STypeId); } else { MsgBoxHelper.MsgErrorShow($"该类别:{st.STypeName} 已经添加了仓库,不能删除!"); return; } break; case 0: //恢复 bl = RequestStar.StoreTypeRecover(st.STypeId); break; case 2: //移除 bl = RequestStar.StoreTypeDelete(st.STypeId); break; } string sucType = bl ? "成功" : "失败"; string delMsg = $"仓库类别:{st.STypeName} {delTypeName} {sucType}"; if (bl) { MsgBoxHelper.MsgBoxShow(msgTitle, delMsg); LoadStoreTypeList(); } else { MsgBoxHelper.MsgErrorShow(delMsg); return; } } }
private void dgvMenus_CellContentClick(object sender, DataGridViewCellEventArgs e) { Action act = () => { if (e.RowIndex >= 0) { DataGridViewCell curCell = dgvMenus.Rows[e.RowIndex].Cells[e.ColumnIndex]; string cellVal = curCell.FormattedValue.ToString(); MenuInfoModel menuInfo = dgvMenus.Rows[e.RowIndex].DataBoundItem as MenuInfoModel; switch (cellVal) { case "添加子菜单": ShowMenuInfoPage(3, menuInfo.MId); break; case "修改": ShowMenuInfoPage(2, menuInfo.MId); break; case "删除": if (MsgBoxHelper.MsgBoxConfirm("删除菜单", "您确定要删除该菜单信息吗?删除菜单会连同菜单及其角色菜单关系数据一并删除?") == DialogResult.Yes) { //删除 List <int> menuIds = new List <int>(); menuIds.Add(menuInfo.MId); bool bl = RequestStar.DeleteMenu(menuIds, 0); if (bl) { MsgBoxHelper.MsgBoxShow("删除菜单", $"菜单:{menuInfo.MName} 删除成功!"); LoadMenuList(); } else { MsgBoxHelper.MsgErrorShow($"菜单:{menuInfo.MName} 删除失败!"); return; } } break; } } }; act.TryCatch("菜单数据操作异常!"); }
/// <summary> /// 单个角色信息删除 /// </summary> /// <param name="roleInfo"></param> private void DeleteRole(RoleInfoModel roleInfo) { string titleMsg = "删除角色"; if (MsgBoxHelper.MsgBoxConfirm(titleMsg, "您确定要删除该角色吗?会连同与角色相关的数据一并删除?") == DialogResult.Yes) { bool bl = RequestStar.DeleteRoleLogic(roleInfo.RoleId); if (bl) { MsgBoxHelper.MsgBoxShow(titleMsg, $"角色:{roleInfo.RoleName} 信息删除成功!"); LoadAllRoles(); } else { MsgBoxHelper.MsgErrorShow($"角色:{roleInfo.RoleName} 信息删除失败!"); return; } } }
/// <summary> /// 删除(批量) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnDelete_Click(object sender, EventArgs e) { Action act = () => { if (dgvGUnitList.SelectedRows.Count == 0) { MsgBoxHelper.MsgErrorShow("请选择要删除的单位信息"); return; } string title = "删除计量单位"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要删除选择的这些计量单位信息吗?") == DialogResult.Yes) { List <int> guIds = new List <int>(); foreach (DataGridViewRow row in dgvGUnitList.SelectedRows) { GoodsUnitInfoModel guInfo = row.DataBoundItem as GoodsUnitInfoModel; if (RequestStar.GetGoodsUnitUse(guInfo.GUnitName)) { MsgBoxHelper.MsgErrorShow($"计量单位:{guInfo.GUnitName} 已经应用,不能删除!"); return; } else { guIds.Add(guInfo.GUnitId); } } bool bl = RequestStar.GoodsUnitLogicDeleteList(guIds); string sucMsg = bl ? "成功" : "失败"; string msg = $"选择的单位信息删除 {sucMsg}"; if (bl) { MsgBoxHelper.MsgBoxShow(title, msg); LoadGUnitList(); } else { MsgBoxHelper.MsgErrorShow(msg); } } }; act.TryCatch("批量删除计量单位信息异常!"); }
/// <summary> /// 永久删除工具组 /// </summary> /// <param name="tgInfo"></param> private void RemoveToolGroupInfo(ToolGroupInfoModel tgInfo) { string title = "永久删除工具组"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要永久删除该工具组数据吗,删除了就无法再恢复?") == DialogResult.Yes) { bool bl = RequestStar.DeleteToolGroup(tgInfo.TGroupId); if (bl) { MsgBoxHelper.MsgBoxShow(title, $"工具组:{tgInfo.TGroupName} 永久删除成功!"); LoadToolGroups(); } else { MsgBoxHelper.MsgErrorShow($"工具组:{tgInfo.TGroupName} 永久删除失败!"); return; } } }
private void RecoverToolGroupInfo(ToolGroupInfoModel tgInfo) { string title = "恢复工具组"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要恢复该工具组数据吗?") == DialogResult.Yes) { bool bl = RequestStar.RecoverToolGroup(tgInfo.TGroupId); if (bl) { MsgBoxHelper.MsgBoxShow(title, $"工具组:{tgInfo.TGroupName} 恢复成功!"); LoadToolGroups(); } else { MsgBoxHelper.MsgErrorShow($"工具组:{tgInfo.TGroupName} 恢复失败!"); return; } } }
/// <summary> /// 工具菜单数据恢复 /// </summary> /// <param name="tmInfo"></param> private void RecoverToolMenuInfo(ToolMenuInfoModel tmInfo) { string title = "恢复工具菜单项"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要恢复该工具菜单项数据吗?会连同角色工具菜单关系数据一并恢复?") == DialogResult.Yes) { //角色工具菜单关系数据 工具菜单信息 bool bl = RequestStar.RecoverToolMenu(tmInfo.TMenuId); if (bl) { MsgBoxHelper.MsgBoxShow(title, $"工具菜单项:{tmInfo.TMenuName} 恢复成功!"); LoadTMenuList(); } else { MsgBoxHelper.MsgErrorShow($"工具菜单项:{tmInfo.TMenuName} 恢复失败!"); return; } } }
private void DeleToolMenuInfo(ToolMenuInfoModel tmInfo) { string title = "删除工具菜单项"; if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要删除该工具菜单项数据吗?会连同角色工具菜单关系数据一并删除?") == DialogResult.Yes) { //删除操作 //角色工具菜单关系数据 工具菜单信息 bool bl = RequestStar.DeleteToolMenuLogic(tmInfo.TMenuId); if (bl) { MsgBoxHelper.MsgBoxShow(title, $"工具菜单项:{tmInfo.TMenuName} 删除成功!"); LoadTMenuList(); } else { MsgBoxHelper.MsgErrorShow($"工具菜单项:{tmInfo.TMenuName} 删除失败!"); return; } } }
private void btnDel_Click(object sender, EventArgs e) { string title = "删除工具组"; if (dgvGroups.SelectedRows.Count > 0) { if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要删除这些工具组数据吗?") == DialogResult.Yes) { //获取要删除的Id List <int> tgIds = new List <int>(); foreach (DataGridViewRow row in dgvGroups.SelectedRows) { ToolGroupInfoModel tgInfo = row.DataBoundItem as ToolGroupInfoModel; tgIds.Add(tgInfo.TGroupId); } //先检查是否已添加工具菜单数据 if (!RequestStar.HasToolMenus(tgIds)) { bool bl = RequestStar.LogicDeleteToolGroups(tgIds); if (bl) { MsgBoxHelper.MsgBoxShow(title, "这些工具组删除成功!"); LoadToolGroups(); } else { MsgBoxHelper.MsgErrorShow("这些工具组删除失败!"); return; } } else { MsgBoxHelper.MsgErrorShow($"选择的工具组中有的已添加工具菜单项,不能删除!"); return; } } } }
/// <summary> /// 修改多用户状态 /// </summary> /// <param name="type"></param> private void UpdateUsersState(int type) { string actMsg = type == 1 ? "启用" : "停用"; if (dgvUsers.SelectedRows.Count == 0) { MsgBoxHelper.MsgErrorShow($"请选择要{actMsg}的用户!"); return; } if (MsgBoxHelper.MsgBoxConfirm($"用户{actMsg}", $"您确定要{actMsg}这些选择的用户吗?") == DialogResult.Yes) { List <int> userIds = new List <int>(); foreach (DataGridViewRow row in dgvUsers.SelectedRows) { UserInfoModel userInfo = row.DataBoundItem as UserInfoModel; userIds.Add(userInfo.UserId); } bool bl = false; if (type == 1) { bl = RequestStar.EnableUsers(userIds); } else { bl = RequestStar.StopUsers(userIds); } if (bl) { MsgBoxHelper.MsgBoxShow($"用户{actMsg}", $"该用户{actMsg}成功!"); LoadUserList(); } else { MsgBoxHelper.MsgErrorShow($"该用户{actMsg}失败!"); return; } } }
/// <summary> /// 审核入库单 状态:待审核 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnCheck_Click(object sender, EventArgs e) { Action act = () => { if (actType == 1) { MsgBoxHelper.MsgErrorShow("期初入库单还未保存,不能审核!"); return; } if (MsgBoxHelper.MsgBoxConfirm("期初入库单审核", "你确定要审核该入库单吗?") == DialogResult.Yes) { bool bl = RequestStar.CheckStockInfo(stockId, uName, store.StoreId); if (bl) { lblCheckState.Text = "已审核"; lblCheckState.ForeColor = Color.Red; SetBtnsEnabled(1); } } }; act.TryCatch("审核入库单出现异常!"); }
/// <summary> /// 作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiNoUse_Click(object sender, EventArgs e) { Action act = () => { if (actType == 1) { MsgBoxHelper.MsgErrorShow("期初入库单还未保存,不能进行作废操作!"); return; } if (MsgBoxHelper.MsgBoxConfirm("期初入库单审核", "你确定要作废该入库单吗?") == DialogResult.Yes) { bool bl = RequestStar.NoUseStockInfo(stockId); if (bl) { lblCheckState.Text = "已作废"; lblCheckState.ForeColor = Color.Gray; SetBtnsEnabled(2); } } }; act.TryCatch("作废入库单出现异常!"); }