Example #1
0
 private void BindData()
 {
     try
     {
         List <SubCatgVO> data = manager.LoadData(true, null);
         if (null != data && data.Count > 0)
         {
             dtgvSubCatg.DataSource = null;
             dtgvSubCatg.DataSource = data;
         }
     }
     catch
     {
         MainForm.Error("系统异常!");
     }
 }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cboxUsr.SelectedIndex == -1)
            {
                return;
            }
            string         uId  = StringUtil.Obj2Str(cboxUsr.SelectedValue);
            List <UsrAuth> list = new List <UsrAuth>();

            foreach (DataGridViewRow row in dtgvAuth.Rows)
            {
                UsrAuth auth  = new UsrAuth();
                string  value = StringUtil.Obj2Str(row.Cells[colckbox.Name].Value);
                if (value == "true")
                {
                    auth.St = ST.VALID;
                }
                else
                {
                    auth.St = ST.INVALID;
                }

                auth.FuncID__PK = StringUtil.Obj2Str(row.Cells[colFuncID.Name].Value);
                auth.UID__PK    = uId;
                list.Add(auth);
            }
            try
            {
                int cnt = 0;
                if (list.Count > 0)
                {
                    cnt = manager.SetAuth(list);
                }
                if (cnt > 0)
                {
                    MainForm.Info("设置成功!");
                }
                else
                {
                    MainForm.Warn("设置失败!");
                }
            }
            catch (Exception e1)
            {
                MainForm.Error(e1.Message);
            }
        }
Example #3
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                Goods goods = new Goods();
                goods.St = ST.VALID;
                short subCatgID  = StringUtil.Obj2Short(cboxCatg.SelectedValue);
                int   supplierId = 0;
                if (cboxSupplier.SelectedIndex != -1)
                {
                    supplierId = StringUtil.Obj2Int(cboxSupplier.SelectedValue);
                }
                goods.SubCatgID = subCatgID;
                List <GoodsVO> data = goodsManager.LoadData(goods, page, supplierId);
                if (null != data && data.Count > 0)
                {
                    dtgvMGoods.DataSource = null;
                    dtgvMGoods.DataSource = data;
                }
                else
                {
                    dtgvMGoods.DataSource = null;
                }

                if (goodsMap.Count > 0)
                {
                    foreach (DataGridViewRow row in dtgvMGoods.Rows)
                    {
                        int gid = StringUtil.Obj2Int(row.Cells[colGId.Name].Value);
                        if (goodsMap.ContainsKey(gid))
                        {
                            row.Cells[colCkboxs.Name].Value = "true";
                        }
                    }
                }
            }
            catch
            {
                MainForm.Error("系统异常!");
            }
        }
Example #4
0
 private void BindData()
 {
     try
     {
         if (cboxCatg.SelectedIndex == -1)
         {
             return;
         }
         Goods goods = new Goods();
         goods.GName = txtGName.Text.Trim();
         goods.St    = cboxSt.SelectedValue.ToString();
         short subCatgID = StringUtil.Obj2Short(cboxCatg.SelectedValue);
         goods.SubCatgID = subCatgID;
         if (string.Empty != txtGId.Text.Trim())
         {
             goods.GID__PK = int.Parse(txtGId.Text.Trim());
         }
         List <GoodsVO> data = manager.LoadData(goods, page);
         if (null != data && data.Count > 0)
         {
             dtgvMGoods.DataSource = null;
             dtgvMGoods.DataSource = data;
         }
         else
         {
             dtgvMGoods.DataSource = null;
         }
         dgvPager.TotalPageNum = page.TotalPage;
         dgvPager.TotalNum     = page.TotalNum;
         dgvPager.ShowPageInfo();
     }
     catch
     {
         MainForm.Error("系统异常!");
     }
 }
Example #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int?num = null;

            try
            {
                num = StringUtil.Obj2Int(txtInvNum.Text.Trim());
            }
            catch
            {
                MainForm.Warn("请输入正确的数字!");
                return;
            }
            if (num == befNum)
            {
                return;
            }
            try
            {
                int cnt = manager.UpdateInvNum(invId, befNum, (int)num, MainForm.usr);
                if (cnt > 0)
                {
                    MainForm.Info("保存成功!");
                }
                else
                {
                    MainForm.Warn("保存失败!");
                }
            }
            catch (Exception e1)
            {
                MainForm.Error(e1);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string uId   = txtUID.Text.Trim();
            string uName = txtUName.Text.Trim();
            string pwd   = txtPwd.Text.Trim();

            if (StringUtil.isEmpty(uId))
            {
                MainForm.Warn("请输入用户ID!");
            }
            else if (StringUtil.isEmpty(uName))
            {
                MainForm.Warn("请输入用户姓名!");
            }
            else if (StringUtil.isEmpty(pwd) && !uptFlag)
            {
                MainForm.Warn("请输入密码!");
            }
            else
            {
                string pwd2 = txtPwd2.Text.Trim();
                if (pwd != pwd2)
                {
                    MainForm.Warn("两次输入密码不一致!");
                    return;
                }
                int cnt = 0;
                if (!uptFlag)
                {
                    cnt = manager.LoadUsrCnt(uId);
                }
                if (cnt > 0)
                {
                    MainForm.Warn("此ID已被注册,请重新选择!");
                }
                else
                {
                    Usr    usr = new Usr();
                    string tel = txtTel.Text.Trim();
                    string qq  = txtQQ.Text.Trim();
                    usr.UName   = uName;
                    usr.UId__PK = uId;
                    usr.Tel     = tel;
                    usr.QQ      = qq;
                    usr.Remark  = txtRmk.Text.Trim();
                    if (!StringUtil.isEmpty(pwd))
                    {
                        usr.Pwd = pwd;
                    }
                    if (rbnInvalid.Checked)
                    {
                        usr.St = ST.INVALID;
                    }
                    else if (rbtnValid.Checked)
                    {
                        usr.St = ST.VALID;
                    }

                    try
                    {
                        if (uptFlag)
                        {
                            cnt = manager.Update(usr);
                        }
                        else
                        {
                            cnt = manager.AddUsr(usr);
                        }
                        if (cnt > 0)
                        {
                            MainForm.Info("保存成功!");
                            DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MainForm.Warn("保存失败!");
                        }
                    }
                    catch
                    {
                        MainForm.Error("系统异常...");
                    }
                }
            }
        }
Example #7
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            DataGridViewRow curRow = dtgvCatg.CurrentRow;

            if (null == curRow)
            {
                return;
            }
            string cid  = StringUtil.Obj2Str(curRow.Cells[colCId.Name].Value);
            string name = StringUtil.Obj2Str(curRow.Cells[colName.Name].Value);

            string newName = txtMdfyName.Text.Trim();

            if (newName == string.Empty)
            {
                MainForm.Warn("分类名称不能为空!");
                txtMdfyName.Focus();
                return;
            }

            if (newName != name)
            {
                int cnt = manager.GenCatgCount(newName);
                if (cnt > 0)
                {
                    MainForm.Warn("分类名称已存在!");
                    txtMdfyName.Focus();
                    return;
                }
            }

            string newStEnum = ST.VALID;

            if (rbtnMdfyInvalid.Checked)
            {
                newStEnum = ST.INVALID;
            }

            Category catg = new Category();

            catg.CId__PK = Int16.Parse(cid);
            catg.CName   = newName;
            catg.St      = newStEnum;

            try
            {
                int    exCnt = manager.Update(catg);
                string msg   = "修改失败!";
                if (exCnt > 0)
                {
                    msg = "修改成功!";
                    BindData();
                }
                MainForm.Info(msg);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                MainForm.Error(msg);
            }
        }