Exemple #1
0
        public void LoadData()
        {
            IBLL.ISupcustGroup bll = new BLL.SupcustGroupBLL();
            DataTable          tb  = bll.GetALl();

            if (tb.Columns.Count < 1)
            {
                tb = Conv.Assign <Model.bi_t_supcust_group>();
            }

            this.dgv.DataSource = tb;
        }
Exemple #2
0
        public void Save()
        {
            List <Model.bi_t_supcust_group> lis = new List <Model.bi_t_supcust_group>();

            foreach (DataRow dr in ((DataTable)this.dgv.DataSource).Rows)
            {
                lis.Add(DB.ReflectionHelper.DataRowToModel <Model.bi_t_supcust_group>(dr));
            }

            IBLL.ISupcustGroup bll = new BLL.SupcustGroupBLL();
            bll.SaveGroup(lis);

            MsgForm.ShowFrom("保存成功");
            LoadData();
        }
Exemple #3
0
        private void LoadCb()
        {
            Thread th = new Thread(() =>
            {
                Cursor.Current = Cursors.WaitCursor;
                Helper.GlobalData.windows.ShowLoad(this);
                try
                {
                    IBLL.IRegion bll = new BLL.RegionBLL();
                    sup_tb           = bll.GetDataTable();

                    IBLL.IPeople pbll = new BLL.PeopleBLL();
                    int count;
                    peo_tb = pbll.GetDataTable("", "", 1, 1, 99999, out count);

                    this.Invoke((MethodInvoker) delegate
                    {
                        //货商区域
                        this.txtRegion.Bind(sup_tb, 300, 200, "region_no", "region_no:编号:80,region_name:区域:150", "region_no/region_name->Text");

                        //货商分类
                        Dictionary <string, string> dic = new Dictionary <string, string>()
                        {
                            { "00", "不定" }
                        };
                        this.cbSupType.DisplayMember = "Value";
                        this.cbSupType.ValueMember   = "Key";
                        this.cbSupType.DataSource    = new BindingSource(dic, null);

                        //业务员
                        this.txtPeo.Bind(peo_tb, 250, 200, "oper_id", "oper_id:编号:80,oper_name:名字:150", "oper_id/oper_name->Text");

                        //价格等级
                        Dictionary <string, string> dic3 = new Dictionary <string, string>()
                        {
                            { "1", "一级批发价" },
                            { "2", "二级批发价" },
                            { "3", "三级批发价" },
                        };

                        this.cbPriceLevel.DisplayMember = "Value";
                        this.cbPriceLevel.ValueMember   = "Key";
                        this.cbPriceLevel.DataSource    = new BindingSource(dic3, null);

                        //客户组
                        IBLL.ISupcustGroup gbll = new BLL.SupcustGroupBLL();
                        DataTable flag          = new DataTable();
                        if (_runType == 0)
                        {
                            flag = gbll.GetSupGroup();
                        }
                        else if (_runType == 1)
                        {
                            flag = gbll.GetCusGroup();
                        }
                        if (flag.Columns.Count < 1)
                        {
                            flag = Conv.Assign <bi_t_supcust_group>();
                        }

                        DataRow dr              = flag.NewRow();
                        dr["SupCust_GroupNo"]   = "0";
                        dr["SupCust_GroupName"] = "不定";
                        flag.Rows.InsertAt(dr, 0);

                        this.cb_supcust_group.DisplayMember = "SupCust_GroupName";
                        this.cb_supcust_group.ValueMember   = "SupCust_GroupNo";
                        this.cb_supcust_group.DataSource    = flag;

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

            th.Start();
        }