Exemplo n.º 1
0
        private void tsbDel_Click(object sender, EventArgs e)
        {
            if (!MyLove.PermissionsBalidation(this.Text, "02"))
            {
                return;
            }
            DataRow dr = this.dgvSup.CurrentRow();

            if (dr == null)
            {
                return;
            }

            if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes)
            {
                if (_runType == 0)
                {
                    IBLL.ISup bll = new BLL.SupBLL();
                    var       sup = DB.ReflectionHelper.DataRowToModel <bi_t_supcust_info>(dr);
                    bll.Del(sup);
                }
                else if (_runType == 1)
                {
                    IBLL.ICus bll = new BLL.CusBLL();
                    var       sup = DB.ReflectionHelper.DataRowToModel <bi_t_supcust_info>(dr);
                    bll.Del(sup);
                }
                LoadSup();
            }
        }
Exemplo n.º 2
0
        private void LoadTv()
        {
            if (itemcls_lis != null && itemcls_lis.Count > 0)
            {
                this.itemcls_lis.Clear();
            }
            this.tv.Nodes.Clear();
            int      cb_index = Conv.ToInt(cb.SelectedValue);
            TreeNode tn       = new TreeNode("所有");

            if (cb_index == 1)
            {
                tn = new TreeNode("所有类别");
                IBLL.IItemCls bll = new BLL.ItemClsBLL();
                itemcls_lis = bll.GetAllList();
            }
            else if (cb_index == 2)
            {
                tn = new TreeNode("所有货商");
                IBLL.ISup bll = new BLL.SupBLL();
                int       tmp;
                var       tb = bll.GetDataTable("", "", 1, 1, 20000, out tmp);
                sup_lis = new List <bi_t_supcust_info>();
                foreach (DataRow row in tb.Rows)
                {
                    Model.bi_t_supcust_info it = DB.ReflectionHelper.DataRowToModel <Model.bi_t_supcust_info>(row);
                    sup_lis.Add(it);
                }
            }
            else if (cb_index == 3)
            {
                tn = new TreeNode("所有品牌");
            }
            else if (cb_index == 4)
            {
                tn = new TreeNode("所有属性");
            }
            tn.Tag = "";
            this.tv.Nodes.Add(tn);
            LoadTreeView();

            //
            this.tv.Nodes[0].Expand();
        }
Exemplo n.º 3
0
        private void OK()
        {
            if (_runType == 0)
            {
                IBLL.ISup bll = new BLL.SupBLL();
                if (supcust == null || string.IsNullOrEmpty(supcust.supcust_no))
                {
                    //添加
                    bi_t_supcust_info sup = new bi_t_supcust_info()
                    {
                        supcust_flag  = "S",
                        sup_man       = txtSupMan.Text,
                        sup_type      = cbSupType.SelectedValue.ToString(),
                        sup_tel       = txtTel.Text,
                        sup_name      = txtSupName.Text,
                        supcust_no    = txtSupNo.Text,
                        sup_addr      = txtAddress.Text,
                        sup_email     = txtEmail.Text,
                        credit_amt    = Conv.ToDecimal(txtCredit_amt.Text),
                        sale_man      = this.txtPeo.Text.Split('/')[0],
                        display_flag  = "1",
                        region_no     = this.txtRegion.Text.Split('/')[0],
                        cust_level    = this.cbPriceLevel.SelectedValue.ToString(),
                        update_time   = DateTime.Now,
                        sup_pyname    = this.txtPyname.Text,
                        is_retail     = this.cbIsRetail.Checked ? "1" : "0",
                        login_no      = this.txt_login_no.Text,
                        pwd           = string.IsNullOrEmpty(this.txt_pwd.Text) ? "123456" : this.txt_pwd.Text,
                        is_branch     = this.cb_is_branch.Checked ? "1" : "0",
                        supcust_group = cb_supcust_group.SelectedValue.ToString(),
                    };
                    bll.Add(sup);
                }
                else
                {
                    //修改
                    supcust.sup_man       = txtSupMan.Text;
                    supcust.sup_type      = cbSupType.SelectedValue.ToString();
                    supcust.sup_tel       = txtTel.Text;
                    supcust.sup_name      = txtSupName.Text;
                    supcust.supcust_no    = txtSupNo.Text;
                    supcust.sup_addr      = txtAddress.Text;
                    supcust.sup_email     = txtEmail.Text;
                    supcust.credit_amt    = Conv.ToDecimal(txtCredit_amt.Text);
                    supcust.sale_man      = this.txtPeo.Text.Split('/')[0];
                    supcust.display_flag  = this.mycbStop.Checked ? "0" : "1";
                    supcust.region_no     = this.txtRegion.Text.Split('/')[0];
                    supcust.cust_level    = this.cbPriceLevel.SelectedValue.ToString();
                    supcust.update_time   = DateTime.Now;
                    supcust.sup_pyname    = this.txtPyname.Text;
                    supcust.is_retail     = this.cbIsRetail.Checked ? "1" : "0";
                    supcust.login_no      = this.txt_login_no.Text;
                    supcust.pwd           = string.IsNullOrEmpty(this.txt_pwd.Text) ? "123456" : this.txt_pwd.Text;
                    supcust.is_branch     = this.cb_is_branch.Checked ? "1" : "0";
                    supcust.supcust_group = cb_supcust_group.SelectedValue.ToString();

                    bll.Update(supcust);
                }
            }
            else if (_runType == 1)
            {
                IBLL.ICus bll = new BLL.CusBLL();
                if (supcust == null || string.IsNullOrEmpty(supcust.supcust_no))
                {
                    //添加
                    bi_t_supcust_info sup = new bi_t_supcust_info()
                    {
                        supcust_flag  = "C",
                        sup_man       = txtSupMan.Text,
                        sup_type      = cbSupType.SelectedValue.ToString(),
                        sup_tel       = txtTel.Text,
                        sup_name      = txtSupName.Text,
                        supcust_no    = txtSupNo.Text,
                        sup_addr      = txtAddress.Text,
                        sup_email     = txtEmail.Text,
                        credit_amt    = Conv.ToDecimal(txtCredit_amt.Text),
                        sale_man      = this.txtPeo.Text.Split('/')[0],
                        display_flag  = "1",
                        cust_level    = this.cbPriceLevel.SelectedValue.ToString(),
                        region_no     = this.txtRegion.Text.Split('/')[0],
                        update_time   = DateTime.Now,
                        sup_pyname    = this.txtPyname.Text,
                        is_retail     = this.cbIsRetail.Checked ? "1" : "0",
                        login_no      = this.txt_login_no.Text,
                        pwd           = string.IsNullOrEmpty(this.txt_pwd.Text) ? "123456" : this.txt_pwd.Text,
                        is_branch     = this.cb_is_branch.Checked ? "1" : "0",
                        supcust_group = cb_supcust_group.SelectedValue.ToString(),
                    };
                    bll.Add(sup);
                }
                else
                {
                    //修改
                    supcust.sup_man       = txtSupMan.Text;
                    supcust.sup_type      = cbSupType.SelectedValue.ToString();
                    supcust.sup_tel       = txtTel.Text;
                    supcust.sup_name      = txtSupName.Text;
                    supcust.supcust_no    = txtSupNo.Text;
                    supcust.sup_addr      = txtAddress.Text;
                    supcust.sup_email     = txtEmail.Text;
                    supcust.credit_amt    = Conv.ToDecimal(txtCredit_amt.Text);
                    supcust.sale_man      = this.txtPeo.Text.Split('/')[0];
                    supcust.display_flag  = this.mycbStop.Checked ? "0" : "1";
                    supcust.region_no     = this.txtRegion.Text.Split('/')[0];
                    supcust.cust_level    = this.cbPriceLevel.SelectedValue.ToString();
                    supcust.update_time   = DateTime.Now;
                    supcust.sup_pyname    = this.txtPyname.Text;
                    supcust.is_retail     = this.cbIsRetail.Checked ? "1" : "0";
                    supcust.login_no      = this.txt_login_no.Text;
                    supcust.pwd           = string.IsNullOrEmpty(this.txt_pwd.Text) ? "123456" : this.txt_pwd.Text;
                    supcust.is_branch     = this.cb_is_branch.Checked ? "1" : "0";
                    supcust.supcust_group = cb_supcust_group.SelectedValue.ToString();

                    bll.Update(supcust);
                }
            }
        }
Exemplo n.º 4
0
        private void LoadSup()
        {
            if (!MyLove.PermissionsBalidation(this.Text, "18"))
            {
                return;
            }
            page.PageSize = this.dgvSup.MaxDisplayRowCount();

            Thread th = new Thread(() =>
            {
                Helper.GlobalData.windows.ShowLoad(this);
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    string cls_no  = "";

                    this.tv.Invoke((MethodInvoker) delegate
                    {
                        if (this.tv.SelectedNode != null)
                        {
                            if (this.tv.SelectedNode.Tag != null)
                            {
                                var item = (Model.bi_t_region_info) this.tv.SelectedNode.Tag;
                                cls_no   = item.region_no;
                            }
                        }
                    });

                    string SelectedNode = "";
                    string Keyword      = "";
                    int ShowStopSup     = 0;

                    this.Invoke((MethodInvoker) delegate
                    {
                        SelectedNode = this.tv.SelectedNode == null ? "" : cls_no;
                        Keyword      = this.txtKeyword.Text.Trim();
                        ShowStopSup  = this.cbShowStopSup.Checked ? 1 : 0;
                    });

                    if (_runType == 0)
                    {
                        IBLL.ISup bll = new BLL.SupBLL();
                        page          = bll.GetDataTable(
                            SelectedNode,
                            Keyword,
                            ShowStopSup,
                            page
                            );
                    }
                    else if (_runType == 1)
                    {
                        IBLL.ICus bll = new BLL.CusBLL();
                        page          = bll.GetDataTable(
                            SelectedNode,
                            Keyword,
                            ShowStopSup,
                            page
                            );
                    }

                    Conv.AddColorTable(page.tb, "display_flag");

                    this.Invoke((MethodInvoker) delegate
                    {
                        this.dgvSup.DataSource = page.tb;

                        this.lblMaxIndex.Text = page.PageMax.ToString();
                        this.lblIndex.Text    = page.PageIndex.ToString();
                    });

                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    LogHelper.writeLog("LoadSup", "获取商品分类出错!");
                    MsgForm.ShowFrom(ex);
                }
                Helper.GlobalData.windows.CloseLoad(this);
            });

            th.Start();
        }
Exemplo n.º 5
0
        private void LoadItem()
        {
            string    keyword = this.txtKeyword.Text.Trim();
            DataTable dt      = new DataTable();

            if (this.op_type == "1")
            {
                //商品
                IBLL.IItem bll = new BLL.ItemBLL();
                dt = bll.QuickSearchList(keyword);
                if (dt.Rows.Count == 0)
                {
                }
                else if (dt.Rows.Count == 1)
                {
                    this.item_no = dt.Rows[0]["item_subno"].ToString();
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            else if (this.op_type == "2")
            {
                //客户
                IBLL.ICus bll = new BLL.CusBLL();
                dt = bll.QuickSearchList(keyword);
                if (dt.Rows.Count == 1)
                {
                    this.item_no = dt.Rows[0]["supcust_no"].ToString();
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            else if (this.op_type == "3")
            {
                //供应商
                IBLL.ISup bll = new BLL.SupBLL();
                dt = bll.QuickSearchList(keyword);
                if (dt.Rows.Count == 1)
                {
                    this.item_no = dt.Rows[0]["supcust_no"].ToString();
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            else if (this.op_type == "4")
            {
                //业务员
                IBLL.IPeople bll = new BLL.PeopleBLL();
                dt = bll.QuickSearchList("02", keyword);
                if (dt.Rows.Count == 1)
                {
                    this.item_no = dt.Rows[0]["oper_id"].ToString();
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            else if (this.op_type == "5")
            {
                //仓库
                IBLL.IBranch bll = new BLL.BranchBLL();
                dt = bll.QuickSearchList(keyword);
                if (dt.Rows.Count == 1)
                {
                    this.item_no = dt.Rows[0]["branch_no"].ToString();
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            this.dgvItem.DataSource = dt;
            if (dt.Rows.Count > 0)
            {
                this.dgvItem.Focus();
            }
            else
            {
                this.txtKeyword.Focus();
            }
        }
Exemplo n.º 6
0
        private void LoadCb()
        {
            Thread th = new Thread(() =>
            {
                Helper.GlobalData.windows.ShowLoad(this);
                Cursor.Current = Cursors.WaitCursor;
                try
                {
                    //商品分类
                    IBLL.IItemCls bll = new BLL.ItemClsBLL();
                    tb_item_cls       = bll.GetDataTable();

                    this.txtItemCls.Invoke((MethodInvoker) delegate
                    {
                        this.txtItemCls.Bind(tb_item_cls, 300, 200, "item_clsno", "item_clsno:编号:100,item_clsname:分类:150", "item_clsno/item_clsname->Text");
                    });


                    //单位
                    List <string> unit_lis = new List <string>()
                    {
                        "kg",
                        "g",
                        "包",
                        "箱",
                    };
                    this.cbUnitNo.Invoke((MethodInvoker) delegate
                    {
                        foreach (var key in unit_lis)
                        {
                            this.cbUnitNo.Items.Add(key);
                            this.cbCGUnitNo.Items.Add(key);
                        }
                        this.cbUnitNo.SelectedIndex   = 0;
                        this.cbCGUnitNo.SelectedIndex = 0;
                    });


                    //商品性质0:普通商品 1:称重商品 2:条码秤商品
                    Dictionary <string, string> dic2 = new Dictionary <string, string>()
                    {
                        { "0", "普通商品" },
                        { "1", "称重商品" },
                        { "2", "条码秤商品" },
                    };

                    this.cbitem_flag.Invoke((MethodInvoker) delegate
                    {
                        this.cbitem_flag.DisplayMember = "Value";
                        this.cbitem_flag.ValueMember   = "Key";
                        this.cbitem_flag.DataSource    = new BindingSource(dic2, null);
                    });

                    //供应商
                    IBLL.ISup supbll = new BLL.SupBLL();
                    int num;
                    tb_sup = supbll.GetDataTable("", "", 1, 1, 99999, out num);


                    this.txtSup.Invoke((MethodInvoker) delegate
                    {
                        this.txtSup.Bind(tb_sup, 300, 200, "supcust_no", "supcust_no:编号:100,sup_name:供应商:150", "supcust_no/sup_name->Text");
                    });

                    LoadItem();
                }
                catch (Exception ex)
                {
                    LogHelper.writeLog("SysSetting_Load", ex.ToString());
                    MsgForm.ShowFrom(ex);
                }
                Cursor.Current = Cursors.Default;
                Helper.GlobalData.windows.CloseLoad(this);
            });

            th.Start();
        }