示例#1
0
        private bool SaveData()
        {
            bsHouse.EndEdit();

            if (!CheckInput())
            {
                return(false);
            }

            string strErr = string.Empty;

            if (Basic_Func.SaveHouse(ref _house, ref strErr))
            {
                Common.Common_Func.ErrorMessage("库区保存成功!", "保存成功");
                bsHouse.DataSource = _house;
                InitForm();
                _back = Common.Common_Func.ConvertToModel <HouseInfo>(_house);
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败");
                bsHouse.DataSource = _house;
                return(false);
            }
        }
示例#2
0
        private void GetParentMenu()
        {
            bsMenu.EndEdit();

            if (_menu.ParentID <= 0)
            {
                _parent = rootMenu;
            }
            else
            {
                string strErr = string.Empty;
                _parent = new MenuInfo()
                {
                    ID = _menu.ParentID
                };

                if (!Basic_Func.GetMenuByID(ref _parent, ref strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "读取上级菜单失败");
                }
            }

            _menu.ParentID  = _parent.ID;
            _menu.NodeUrl   = _parent.NodeUrl;
            _menu.NodeSort  = _parent.SonQty + 1;
            _menu.NodeLevel = _parent.NodeLevel + 1;
        }
示例#3
0
        private bool SaveData()
        {
            bsArea.EndEdit();

            _area.AreaNo   = string.Format("{0}-{1}", txtAreaNoLeft.Text, txtAreaNoRight.Text);
            _area.AreaName = txtAreaName.Text;
            if (!CheckInput())
            {
                return(false);
            }
            //_area.AreaStatus = 1;
            //_area.IsDel = 1;
            _area.CreateTime = DateTime.Today;
            string strErr = string.Empty;

            if (Basic_Func.SaveArea(ref _area, ref strErr))
            {
                Common.Common_Func.ErrorMessage("货位保存成功!", "保存成功");
                bsArea.DataSource = _area;
                InitForm();
                _back = Common.Common_Func.ConvertToModel <AreaInfo>(_area);
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败");
                bsArea.DataSource = _area;
                return(false);
            }
        }
示例#4
0
        private void ClearForm()
        {
            try
            {
                isInit = true;
                _menu  = new MenuInfo();
                SetNewModel();

                BindUrlComboBox();

                string strError = string.Empty;
                Basic_Func.GetMenuNo(ref _menu, ref strError);
                _menu.ParentID = _back.ParentID;
                _menu.NodeUrl  = _parent.NodeUrl;
                _menu.NodeSort = _back.NodeSort + 1;
                _menu.IsEnd    = _back.IsEnd;
                _menu.MenuType = _back.MenuType;

                SetMenuUrl();

                bsMenu.DataSource = _menu;
                bsMenu.ResetBindings(false);
                bsMenu.EndEdit();
            }
            catch
            {
            }
            finally
            {
                isInit = false;
                txtMenuName.Focus();
            }
        }
示例#5
0
        private void RePwdListModel(int iRowIndex)
        {
            if (iRowIndex < 0 || iRowIndex >= dgvList.Rows.Count) return;

            string strErr = string.Empty;
            UserInfo user = new UserInfo();
            user.ID = lstMain[iRowIndex].ID;

            if (!Basic_Func.GetUserByID(ref user, ref strErr))
            {
                MessageBox.Show(strErr, "重置失败");
                GetListQueryData();
                return;
            }

            //user.Password = Basic_Func.JiaMi(Common_Var.DefaultPwd);
            user.Password = Common_Var.DefaultPwd;

            if (!Basic_Func.SaveUser(ref user, ref strErr))
            {
                MessageBox.Show(strErr, "重置失败");
                GetListQueryData();
                return;
            }
            else
            {
                MessageBox.Show("重置密码为【" + Common_Var.DefaultPwd + "】成功", "重置成功");
            }

            GetListQueryData();

        }
示例#6
0
        private MenuInfo GetParentMenu(int ParentID)
        {
            MenuInfo parent = new MenuInfo();

            if (ParentID <= 0)
            {
                parent = rootMenu;
            }
            else
            {
                string strError = string.Empty;
                parent = new MenuInfo()
                {
                    ID = ParentID
                };

                if (!Basic_Func.GetMenuByID(ref parent, ref strError))
                {
                    Common.Common_Func.ErrorMessage(strError, "读取上级菜单失败");
                    return(null);
                }
            }

            return(parent);
        }
示例#7
0
        private void GetListQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bool   bResult = false;
                string strErr  = string.Empty;

                bResult = Basic_Func.GetPreparationList(ref lstPreparation, _preparation, ref strErr);
                ckLstBoxPreparation.DataSource    = lstPreparation;
                ckLstBoxPreparation.DisplayMember = "pCode";
                ckLstBoxPreparation.ValueMember   = "bid";

                bResult = Basic_Func.GetBuildingList(ref lstBuilding, _building, ref strErr);
                lstBoxBuilding.DataSource    = lstBuilding;
                lstBoxBuilding.DisplayMember = "bName";
                lstBoxBuilding.ValueMember   = "bNo";

                if (!bResult || !string.IsNullOrEmpty(strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "查询失败");
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败");
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#8
0
        private bool SaveData()
        {
            bsGroup.EndEdit();

            if (!CheckInput())
            {
                return(false);
            }

            string strErr = string.Empty;

            if (Basic_Func.SaveUserGroup(ref _group, ref strErr))
            {
                Common.Common_Func.ErrorMessage("用户组保存成功!", "保存成功");
                bsGroup.DataSource = _group;
                InitForm();
                _back = Common.Common_Func.ConvertToModel <UserGroupInfo>(_group);
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败");
                bsGroup.DataSource = _group;
                return(false);
            }
        }
示例#9
0
        private void ClearListModel(int iRowIndex)
        {
            UserInfo user = GetListRowModel(iRowIndex);
            if (user == null) return;

            if (MessageBox.Show(string.Format("是否确认清除用户【{0}】的登录记录?", user.UserName), "确认清除", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No) return;

            try
            {
                if (!string.IsNullOrEmpty(user.LoginIP))
                {
                    string strErr = string.Empty;
                    user.UserType = 2;
                    if (!Basic_Func.ClearLoginTime(user, ref strErr))
                    {
                        Common.Common_Func.ErrorMessage(strErr, "清除失败");
                        return;
                    }
                }

                Common.Common_Func.ErrorMessage("清除用户登录记录成功", "清除成功");
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message);
            }
            finally
            {
                GetListQueryData();
            }
        }
示例#10
0
        private void GetListQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bool   bResult = false;
                string strErr  = string.Empty;
                GetQueryMain();

                ChensControl.DividPage clientPage = pageList.dDividPage;
                Common.Common_Func.GetServerPageFromClientPage(ref _serverMainPage, clientPage);
                bResult = Basic_Func.GetUserGroupListByPage(ref lstMain, queryMain, ref _serverMainPage, ref strErr);
                Common.Common_Func.GetClientPageFromServerPage(_serverMainPage, ref clientPage);
                pageList.ShowPage();
                dgvList.DataSource = lstMain;

                if (!bResult || !string.IsNullOrEmpty(strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "查询失败");
                }


                GetDetailsQueryData();
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败");
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#11
0
        private void DelListModel(int iRowIndex)
        {
            UserInfo user = GetListRowModel(iRowIndex);
            if (user == null) return;

            if (MessageBox.Show(string.Format("是否确认删除用户【{0}】?", user.UserName), "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No) return;

            try
            {
                if (user.IsDel != 2)
                {
                    string strErr = string.Empty;
                    if (!Basic_Func.DeleteUserByID(user, ref strErr))
                    {
                        Common.Common_Func.ErrorMessage(strErr, "删除失败");
                        return;
                    }
                }

                Common.Common_Func.ErrorMessage("删除用户成功", "删除成功");
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message);
            }
            finally
            {
                GetListQueryData();
            }

        }
示例#12
0
        private void AddMenu()
        {
            MenuInfo menu = new MenuInfo()
            {
                ID = 0
            };
            MenuInfo parent = GetCurrentMenu();

            if (parent.IsEnd == 1)
            {
                Common.Common_Func.ErrorMessage("当前菜单已经是末级节点", "新增失败");
                return;
            }
            menu.ParentID = parent.ID;
            if (SelectNode())
            {
                if (curNode.Nodes == null || curNode.Nodes.Count <= 0)
                {
                    menu.NodeSort = 1;
                }
                else
                {
                    menu.NodeSort = (curNode.Nodes[curNode.Nodes.Count - 1].Tag as MenuInfo).NodeSort + 1;
                }
            }
            else
            {
                menu.NodeSort = 1;
            }

            string strError = string.Empty;

            Basic_Func.GetMenuNo(ref menu, ref strError);
            ShowFileForm(menu);
        }
示例#13
0
        private void GetDetailsQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bool   bResult = true;
                string strErr  = string.Empty;
                GetQueryDetails();

                bResult = Basic_Func.GetMenuListByUserGroup(ref lstDetails, queryDetails, true, ref strErr);

                SetDetailsQueryData();

                if (!bResult || !string.IsNullOrEmpty(strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "查询失败");
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败");
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#14
0
        private WarehouseInfo GetBelongWarehouse(int WarehouseID)
        {
            WarehouseInfo warehouse = new WarehouseInfo();

            if (WarehouseID <= 0)
            {
                Common.Common_Func.ErrorMessage("获取仓库信息失败", "错误");
                return(null);
            }
            else
            {
                string strError = string.Empty;
                warehouse = new WarehouseInfo()
                {
                    ID = WarehouseID
                };

                if (!Basic_Func.GetWarehouseByID(ref warehouse, ref strError))
                {
                    Common.Common_Func.ErrorMessage(strError, "错误");
                    return(null);
                }
            }

            return(warehouse);
        }
示例#15
0
        private HouseInfo GetBelongHouse(int HouseID)
        {
            HouseInfo house = new HouseInfo();

            if (HouseID <= 0)
            {
                Common.Common_Func.ErrorMessage("获取库区信息失败", "错误");
                return(null);
            }
            else
            {
                string strError = string.Empty;
                house = new HouseInfo()
                {
                    ID = HouseID
                };

                if (!Basic_Func.GetHouseByID(ref house, ref strError))
                {
                    Common.Common_Func.ErrorMessage(strError, "错误");
                    return(null);
                }
            }

            return(house);
        }
示例#16
0
        private UserInfo GetListRowModel(int iRowIndex)
        {
            string strErr = string.Empty;
            UserInfo user = new UserInfo();
            user.ID = lstMain[iRowIndex].ID;

            if (!Basic_Func.GetUserByID(ref user, ref strErr))
            {
                MessageBox.Show(strErr, "读取失败");
                GetListQueryData();
                return null;
            }

            return user;
        }
示例#17
0
        private void GetListQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bsMain.EndEdit();

                bool   bResult = false;
                string strErr  = string.Empty;
                GetQueryMain();

                ChensControl.DividPage clientPage = pageList.dDividPage;
                Common.Common_Func.GetServerPageFromClientPage(ref _serverMainPage, clientPage);
                bResult = Basic_Func.GetWarehouseListByPage(ref lstMain, queryMain, ref _serverMainPage, ref strErr);
                Common.Common_Func.GetClientPageFromServerPage(_serverMainPage, ref clientPage);
                pageList.ShowPage();
                dgvList.DataSource = lstMain;

                if (!bResult || !string.IsNullOrEmpty(strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "查询失败");
                }


                if (dgvList.DataSource == null || dgvList.Rows.Count <= 0)
                {
                    lstDetails           = new List <HouseInfo>();
                    dgvDetail.DataSource = lstDetails;
                    return;
                }
                else
                {
                    //dgvList.CurrentCell = dgvList[0, 0];
                    pageDetail.dDividPage.CurrentPageNumber = 1;
                    GetDetailsQueryData();
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败");
            }
            finally
            {
                this.Cursor = Cursors.Default;
                txtWarehouseNo.Focus();
            }
        }
示例#18
0
        private HouseInfo GetDetailsRowModel(int iRowIndex)
        {
            string    strErr = string.Empty;
            HouseInfo house  = new HouseInfo();

            house.ID = lstDetails[iRowIndex].ID;

            if (!Basic_Func.GetHouseByID(ref house, ref strErr))
            {
                Common.Common_Func.ErrorMessage(strErr, "读取失败");
                GetListQueryData();
                return(null);
            }

            return(house);
        }
示例#19
0
        private WarehouseInfo GetListRowModel(int iRowIndex)
        {
            string        strErr    = string.Empty;
            WarehouseInfo warehouse = new WarehouseInfo();

            warehouse.ID = lstMain[iRowIndex].ID;

            if (!Basic_Func.GetWarehouseByID(ref warehouse, ref strErr))
            {
                Common.Common_Func.ErrorMessage(strErr, "读取失败");
                GetListQueryData();
                return(null);
            }

            return(warehouse);
        }
示例#20
0
        private AreaInfo GetDetailsRowModel(int iRowIndex)
        {
            string   strErr = string.Empty;
            AreaInfo area   = new AreaInfo();

            area.ID = lstDetails[iRowIndex].ID;

            if (!Basic_Func.GetAreaByID(ref area, ref strErr))
            {
                Common.Common_Func.ErrorMessage(strErr, "读取失败");
                GetListQueryData();
                return(null);
            }

            return(area);
        }
示例#21
0
        private Preparation GetListRowModel(int iRowIndex)
        {
            string      strErr      = string.Empty;
            Preparation preparation = new Preparation();

            preparation.ID = lstPreparation[iRowIndex].ID;

            if (!Basic_Func.GetPreparationByID(ref preparation, ref strErr))
            {
                Common.Common_Func.ErrorMessage(strErr, "读取失败");
                GetListQueryData();
                return(null);
            }

            return(preparation);
        }
示例#22
0
        private UserGroupInfo GetListRowModel(int iRowIndex)
        {
            string        strErr = string.Empty;
            UserGroupInfo group  = new UserGroupInfo();

            group.ID = lstMain[iRowIndex].ID;

            if (!Basic_Func.GetUserGroupByID(ref group, ref strErr))
            {
                Common.Common_Func.ErrorMessage(strErr, "读取失败");
                GetListQueryData();
                return(null);
            }

            return(group);
        }
示例#23
0
        private void DeleteDetailsModel(TreeNode treeNode)
        {
            if (treeNode.Nodes != null && treeNode.Nodes.Count >= 1)
            {
                Common.Common_Func.ErrorMessage("请先删除下级菜单", "删除失败");
                return;
            }

            MenuInfo menu = GetDetailRowModel(treeNode);

            if (menu == null)
            {
                return;
            }
            if (menu.ID <= 0)
            {
                return;
            }

            if (MessageBox.Show(string.Format("是否确认删除菜单【{0}】?", menu.MenuName), "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
            {
                return;
            }

            try
            {
                if (menu.IsDel != 2)
                {
                    string strErr = string.Empty;
                    if (!Basic_Func.DeleteMenuByID(menu, ref strErr))
                    {
                        Common.Common_Func.ErrorMessage(strErr, "删除失败");
                        return;
                    }
                }

                Common.Common_Func.ErrorMessage("删除菜单成功", "删除成功");
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message);
            }
            finally
            {
                GetDetailsQueryData();
            }
        }
示例#24
0
        private void GetGroupData()
        {
            string strError = string.Empty;
            List <UserGroupInfo> lstGroup = new List <UserGroupInfo>();

            if (Basic_Func.GetUserGroupListByUser(ref lstGroup, _user, true, ref strError))
            {
                _user.lstUserGroup = lstGroup;
            }
            else
            {
                Common_Func.ErrorMessage(strError, "获取用户组失败");
                return;
            }

            SetGroupData();
        }
示例#25
0
        private void GetWarehouseData()
        {
            string strError = string.Empty;
            List <WarehouseInfo> lstWarehouse = new List <WarehouseInfo>();

            if (Basic_Func.GetWarehouseListByUser(ref lstWarehouse, _user, true, ref strError))
            {
                _user.lstWarehouse = lstWarehouse;
            }
            else
            {
                Common_Func.ErrorMessage(strError, "获取用户仓库失败");
                return;
            }

            SetWarehouseData();
        }
示例#26
0
        private void EditListModel(int iRowIndex, int iColIndex)
        {
            if (dgvList[iColIndex, iRowIndex].FormattedValue.ToString() == "编辑")
            {
                string strErr = string.Empty;
                UserInfo user = new UserInfo();
                user.ID = lstMain[iRowIndex].ID;

                if (!Basic_Func.GetUserByID(ref user, ref strErr))
                {
                    MessageBox.Show(strErr, "编辑失败");
                    GetListQueryData();
                    return;
                }

                ShowFileForm(user);
            }
        }
示例#27
0
        private bool RefreshServiceNode(TreeNode tnChecked)
        {
            if (isLocal)
            {
                return(true);
            }

            MenuInfo menu     = GetDetailRowModel(tnChecked);
            string   strError = string.Empty;

            if (!Basic_Func.SaveUserGroupMenuToDB(menu, GetListRowModel(dgvList.CurrentCell.RowIndex), ref strError))
            {
                return(Common.Common_Func.ErrorMessage(strError, "设置权限失败"));
            }
            else
            {
                return(true);
            }
        }
示例#28
0
        private bool SaveData()
        {
            bsUser.EndEdit();

            _user.PinYin = PinYinConvert.Get(_user.UserName);
            if (_user.Password == _back.Password)
            {
                //_user.Password = Basic_Func.JiaMi(_user.Password);
                //_user.RePassword = Basic_Func.JiaMi(_user.RePassword);

                _user.Password   = "******";
                _user.RePassword = "******";
            }
            _user.IsReceive     = _user.BIsReceive.ToInt32();
            _user.IsQuality     = _user.BIsQuality.ToInt32();
            _user.IsPick        = _user.BIsPick.ToInt32();
            _user.GroupCode     = GetGroupCode();
            _user.WarehouseCode = GetWarehouseCode();

            if (!CheckInput())
            {
                return(false);
            }

            string strErr = string.Empty;

            if (Basic_Func.SaveUser(ref _user, ref strErr))
            {
                Common.Common_Func.ErrorMessage("数据保存成功!", "保存成功");
                bsUser.DataSource = _user;
                InitForm();
                _back = Common.Common_Func.ConvertToModel <UserInfo>(_user);
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败");
                bsUser.DataSource = _user;
                return(false);
            }
        }
示例#29
0
        private void DownloadTemplates()
        {
            string strError            = string.Empty;
            List <WarehouseInfo> lstWH = new List <WarehouseInfo>();

            if (!Basic_Func.GetWarehouseList(ref lstWH, new WarehouseInfo(), ref strError))
            {
                MessageBox.Show(strError);
                return;
            }
            if (lstWH == null || lstWH.Count <= 0)
            {
                MessageBox.Show("未获取到任何仓库");
                return;
            }

            DataSet dsWH = ConvertList2DataSet(lstWH);

            string path = "货位导入格式";

            if (!Common_Func.ShowSaveDialog(ref path, "xlsx"))
            {
                return;
            }

            byte[] bArea;
            bool   isXSSF = Path.GetExtension(path).ToLower() == (".xlsx");

            bArea = isXSSF ? Properties.Resources.AreaTemplateXLSX : Properties.Resources.AreaTemplateXLS;
            if (Common_Func.SaveBytesToFile(path, bArea))
            {
                ExcelLibrary_Func.AddDataSetToExcelByNPOI(path, dsWH);

                if (MessageBox.Show(string.Format("文件已成功保存到【{0}】!{1}是否直接打开?", path, Environment.NewLine), "保存成功", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(path);
                }
            }
        }
示例#30
0
        private void BindComboBoxs()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                Building _building = new Building();

                bool   bResult = false;
                string strErr  = string.Empty;

                bResult = Basic_Func.GetBuildingList(ref _lstBuilding, _building, ref strErr);

                cbbBuildingLst.DataSource    = _lstBuilding;
                cbbBuildingLst.DisplayMember = "bName";
                cbbBuildingLst.ValueMember   = "ID";

                if (_preparation.bid != 0)
                {
                    for (int i = 0; i < _lstBuilding.Count - 1; i++)
                    {
                        if (_lstBuilding[i].ID == _preparation.bid)
                        {
                            cbbBuildingLst.SelectedIndex = i;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败");
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }