Пример #1
0
 /// <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;
     }
 }
Пример #2
0
        /// <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;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 单元格双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvGoods_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewCell cell    = dgvGoods.Rows[e.RowIndex].Cells[e.ColumnIndex];
            string           colName = dgvGoods.Columns[e.ColumnIndex].Name;

            if (addGoods == 1)
            {
                if (colName == "GoodsName")
                {
                    if (!string.IsNullOrEmpty(txtInStore.Text))
                    {
                        FrmChooseGoods fGoods = new FrmChooseGoods();
                        fGoods.Tag = new ChooseModel()
                        {
                            FGet     = this,
                            UName    = uName,
                            TypeCode = "DgvGoods-StartStock"
                        };
                        fGoods.SetChooseGoods += SetDgvGoods;
                        fGoods.ShowDialog();
                    }
                    else
                    {
                        MsgBoxHelper.MsgErrorShow("请先选择入货仓库!");
                        return;
                    }
                }
            }
        }
Пример #4
0
        /// <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("红冲入库单出现异常!");
        }
Пример #5
0
        /// <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;
                }
            }
        }
Пример #6
0
        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;
                    }
                }
            }
        }
Пример #7
0
        /// <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("批量设置库存上下限出现异常!");
        }
Пример #8
0
 /// <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;
         }
     }
 }
Пример #9
0
        /// <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;
                }
            }
        }
Пример #10
0
        /*/// <summary>
         * /// 递归加载单位类别节点
         * /// </summary>
         * /// <param name="list"></param>
         * /// <param name="pNode"></param>
         * /// <param name="pId"></param>
         * public static void AddTvUTypesNode(List<UnitTypeInfoModel> list, TreeNode pNode, int pId)
         * {
         *  var pList = list.Where(ut => ut.ParentId == pId);
         *  foreach (UnitTypeInfoModel ut in pList)
         *  {
         *      TreeNode node = FormUtility.CreateNode(ut.UTypeId.ToString(), ut.UTypeName);
         *      pNode.Nodes.Add(node);
         *      AddTvUTypesNode(list, node, ut.UTypeId);
         *  }
         * }
         *
         * /// <summary>
         * /// 递归加载商品类别节点
         * /// </summary>
         * /// <param name="list"></param>
         * /// <param name="pNode"></param>
         * /// <param name="pId"></param>
         * public static void AddTvGTypesNode(List<GoodsTypeInfoModel> list, TreeNode pNode, int pId)
         * {
         *  var pList = list.Where(ut => ut.ParentId == pId);
         *  foreach (GoodsTypeInfoModel gt in pList)
         *  {
         *      TreeNode node = FormUtility.CreateNode(gt.GTypeId.ToString(), gt.GTypeName);
         *      pNode.Nodes.Add(node);
         *      AddTvGTypesNode(list, node, gt.GTypeId);
         *  }
         * }*/

        /// <summary>
        /// 将DataGridView中数据导出到Excel
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <param name="dgv"></param>
        /// <param name="fileName"></param>
        /// <param name="sheetName"></param>
        /// <param name="msg"></param>
        /// <param name="title"></param>
        public static void DataToExcel <T>(List <T> list, DataGridView dgv, string fileName, string sheetName, string msg, string title)
        {
            if (list != null && list.Count > 0)
            {
                string filePath = "";
                FolderBrowserDialog fbdChoose = new FolderBrowserDialog();
                if (fbdChoose.ShowDialog() == DialogResult.OK)
                {
                    filePath = fbdChoose.SelectedPath;
                }
                if (string.IsNullOrEmpty(filePath))
                {
                    MsgBoxHelper.MsgErrorShow("请选择导出的位置!");
                    return;
                }
                if (filePath.LastIndexOf('/') != filePath.Length - 1)
                {
                    filePath += "/";
                }
                Dictionary <string, string> colsName = new Dictionary <string, string>();
                foreach (DataGridViewColumn dc in dgv.Columns)
                {
                    colsName.Add(dc.Name, dc.HeaderText);
                }
                int count = ExcelHelper.ListToExcel <T>(list, filePath + fileName, sheetName, colsName);
                if (count > 0)
                {
                    MsgBoxHelper.MsgBoxShow(title, msg + "数据导出成功!");
                }
                else
                {
                    MsgBoxHelper.MsgErrorShow(msg + "数据导出失败!");
                }
            }
        }
Пример #11
0
        /// <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;
                }
            }
        }
Пример #12
0
 private void btnQuery_Click(object sender, EventArgs e)
 {
     LoadTMenuList();
     if (dgvTMenus.Rows.Count == 0)
     {
         MsgBoxHelper.MsgErrorShow("没有符合条件的数据!");
         return;
     }
 }
Пример #13
0
        /// <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;
                }
            }
        }
Пример #14
0
        //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;
                }
            }
        }
Пример #15
0
        /// <summary>
        /// 提交响应
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //接收页面信息输入
            string roleName = txtRName.Text.Trim();
            string remark   = txtRemark.Text.Trim();

            //判空处理 ---角色名称
            if (string.IsNullOrEmpty(roleName))
            {
                MsgBoxHelper.MsgErrorShow("角色名称不能为空!");
                txtRName.Focus();
                return;
            }
            //角色名称存在性---add 不能是已存在  update 没有修改名称(不用判断存在性)  名称已修改的情况(要判断)
            if (fModel.FId == 0 || (!string.IsNullOrEmpty(oldName) && oldName != roleName))
            {
                if (RequestStar.ExistRoleName(roleName))
                {
                    MsgBoxHelper.MsgErrorShow("角色名称已经存在!");
                    txtRName.Focus();
                    return;
                }
            }
            //封装
            RoleInfoModel roleInfo = new RoleInfoModel()
            {
                RoleName = roleName,
                Remark   = remark,
                Creator  = fModel.UName
            };
            //调用方法(add)  (update)
            bool bl = false;

            if (fModel.FId == 0)
            {
                bl = RequestStar.AddRoleInfo(roleInfo);
            }
            else if (fModel.FId > 0)
            {
                roleInfo.RoleId = fModel.FId;
                bl = RequestStar.UpdateRoleInfo(roleInfo);
            }
            //判断结果给出提示
            if (bl)
            {
                MsgBoxHelper.MsgBoxShow($"{btnText}角色", $"角色:{roleName} 信息{btnText}成功!");
                //刷新列表页面数据
                fModel.ReLoad?.Invoke();
            }
            else
            {
                MsgBoxHelper.MsgErrorShow($"角色:{roleName} 信息{btnText}失败!");
                return;
            }
        }
Пример #16
0
        /// <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;
                }
            }
        }
Пример #17
0
 /// <summary>
 /// try  catch 异常处理
 /// </summary>
 /// <param name="act"></param>
 /// <param name="message"></param>
 public static void TryCatch(this Action act, string message)
 {
     try
     {
         act.Invoke();
     }
     catch (Exception ex)
     {
         MsgBoxHelper.MsgErrorShow(ex.Message);
     }
 }
Пример #18
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbtnEdit_Click(object sender, EventArgs e)
        {
            if (dgvGUnitList.SelectedRows.Count == 0)
            {
                MsgBoxHelper.MsgErrorShow("请选择要修改的单位信息");
                return;
            }
            //SelectedRows.Count>0
            GoodsUnitInfoModel guInfo = dgvGUnitList.SelectedRows[0].DataBoundItem as GoodsUnitInfoModel;

            InitEditInfo(guInfo);
        }
Пример #19
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnEdit_Click(object sender, EventArgs e)
 {
     if (dgvUnitTypeList.CurrentRow != null)
     {
         UnitTypeInfoModel utInfo = dgvUnitTypeList.CurrentRow.DataBoundItem as UnitTypeInfoModel;
         ShowEditTypeInfo(utInfo);
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择要修改的类别信息!");
         return;
     }
 }
Пример #20
0
 /// <summary>
 /// 打开工具菜单详情
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnInfo_Click(object sender, EventArgs e)
 {
     if (dgvTMenus.SelectedRows.Count > 0)
     {
         ToolMenuInfoModel tmInfo = dgvTMenus.SelectedRows[0].DataBoundItem as ToolMenuInfoModel;
         ShowTMenuInfoPage(tmInfo.TMenuId, 4);
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择要查看的工具菜单项!");
         return;
     }
 }
Пример #21
0
 /// <summary>
 /// 修改菜单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnEdit_Click(object sender, EventArgs e)
 {
     if (dgvMenus.SelectedRows.Count > 0)
     {
         DataGridViewRow row      = dgvMenus.SelectedRows[0];
         MenuInfoModel   menuInfo = row.DataBoundItem as MenuInfoModel;
         ShowMenuInfoPage(2, menuInfo.MId);
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择你要修改的菜单信息!");
         return;
     }
 }
Пример #22
0
 /// <summary>
 /// 详情响应
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnInfo_Click(object sender, EventArgs e)
 {
     if (dgvGoodsList.CurrentRow != null)
     {
         ViewGoodsInfoModel goodsInfo = dgvGoodsList.CurrentRow.DataBoundItem as ViewGoodsInfoModel;
         if (goodsInfo != null)
         {
             ShowGoodsInfoPage(4, goodsInfo.GoodsId);
         }
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择要查看的商品信息!");
         return;
     }
 }
Пример #23
0
 private void tsbtnInfo_Click(object sender, EventArgs e)
 {
     if (dgvUnitList.CurrentRow != null)
     {
         ViewUnitInfoModel unitInfo = dgvUnitList.CurrentRow.DataBoundItem as ViewUnitInfoModel;
         if (unitInfo != null)
         {
             ShowUnitInfoPage(4, unitInfo.UnitId);
         }
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择要查看的单位信息!");
         return;
     }
 }
Пример #24
0
 /// <summary>
 /// 详情
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnInfo_Click(object sender, EventArgs e)
 {
     if (dgvStoreList.CurrentRow != null)
     {
         ViewStoreInfoModel storeInfo = dgvStoreList.CurrentRow.DataBoundItem as ViewStoreInfoModel;
         if (storeInfo != null)
         {
             ShowStoreInfoPage(4, storeInfo.StoreId);
         }
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择要查看的仓库信息!");
         return;
     }
 }
Пример #25
0
        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("审核销售单出现异常!");
        }
Пример #26
0
        /// <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;
                }
            }
        }
Пример #27
0
        /// <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;
                }
            }
        }
Пример #28
0
        /// <summary>
        /// 提交响应
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            string gName = txtGroupName.Text.Trim();

            if (string.IsNullOrEmpty(gName))
            {
                MsgBoxHelper.MsgErrorShow("请输入组名!");
                txtGroupName.Focus();
                return;
            }
            if (tgId == 0 || (tgId > 0 && oldName != gName))
            {
                if (RequestStar.ExistName(gName))
                {
                    MsgBoxHelper.MsgErrorShow("该组名已存在,请重新输入组名!");
                    txtGroupName.Focus();
                    return;
                }
            }
            ToolGroupInfoModel tgInfo = new ToolGroupInfoModel()
            {
                TGroupName = gName,
                Creator    = uName,
                TGroupId   = tgId
            };
            bool bl = false;

            bl = RequestStar.ConfirmToolGroup(tgInfo);
            string actMsg = "";

            actMsg = tgId == 0 ? "添加" : "修改";
            string msgTitle = $"{actMsg}工具组";
            string sucMsg   = bl ? "成功" : "失败";
            string msg      = $"工具组:{gName} {actMsg} {sucMsg}!";

            if (bl)
            {
                MsgBoxHelper.MsgBoxShow(msgTitle, msg);
                LoadToolGroups();
            }
            else
            {
                MsgBoxHelper.MsgErrorShow(msg);
                return;
            }
        }
Пример #29
0
        /// <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;
                }
            }
        }
Пример #30
0
        /// <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;
                }
            }
        }