Пример #1
0
        void IBLL.ISup.Add(Model.bi_t_supcust_info item)
        {
            item.update_time = System.DateTime.Now;
            string sql = "select * from bi_t_supcust_info where supcust_flag='S' and supcust_no='" + item.supcust_no + "'";

            DB.IDB db = new DB.DBByAutoClose(Appsetting.conn);
            var    tb = db.ExecuteToTable(sql, null);

            if (tb.Rows.Count != 0)
            {
                throw new Exception("已经存在编码" + item.supcust_no);
            }
            db.Insert(item);
        }
Пример #2
0
        private void panel2_MouseClick(object sender, MouseEventArgs e)
        {
            clickPoint = new Point(e.X, e.Y);
            this.panel2.Refresh();
            this.panel2.Refresh();
            Model.bi_t_supcust_info cus = new Model.bi_t_supcust_info();

            if (GetItem(new Point(e.X, e.Y), out cus) == true)
            {
                this.item         = cus;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Пример #3
0
        Dictionary <string, Model.bi_t_supcust_info> IBLL.ISup.GetDic()
        {
            IBLL.ISup bll = new BLL.Sup();
            var       lst = bll.GetList("");
            Dictionary <string, Model.bi_t_supcust_info> dic = new Dictionary <string, Model.bi_t_supcust_info>();

            foreach (Model.bi_t_supcust_info item in lst)
            {
                var it = new Model.bi_t_supcust_info();
                if (dic.TryGetValue(item.supcust_no, out it) == false)
                {
                    dic.Add(item.supcust_no, item);
                }
            }
            return(dic);
        }
Пример #4
0
        private bool GetItem(Point p, out Model.bi_t_supcust_info cus)
        {
            foreach (CellInfo cell in pageInfo)
            {
                if (cell.rec.Contains(p) == true)
                {
                    if (cell.item != null)
                    {
                        cus = cell.item;
                        return(true);
                    }
                }
            }

            cus = null;
            return(false);
        }
Пример #5
0
        List <Model.bi_t_supcust_info> ICommonBLL.GetSupList(string keyword)
        {
            try
            {
                Helper.IRequest req = new Helper.Request();
                ReadWriteContext.IWriteContext write = new ReadWriteContext.WriteContextByJson();
                write.Append("page_index", "1");
                write.Append("page_size", "500");
                write.Append("region_no", "");
                write.Append("show_stop", "0");
                write.Append("keyword", keyword);

                var json = req.request("/sup?t=get_list", write.ToString());
                ReadWriteContext.IReadContext read = new ReadWriteContext.ReadContextByJson(json);
                if (read.Read("errId") != "0")
                {
                    throw new Exception(read.Read("errMsg"));
                }
                List <Model.bi_t_supcust_info> lst = new List <Model.bi_t_supcust_info>();
                if (read.Read("data") != null)
                {
                    foreach (ReadWriteContext.IReadContext r in read.ReadList("data"))
                    {
                        Model.bi_t_supcust_info item = new Model.bi_t_supcust_info();
                        item.supcust_no = r.Read("supcust_no");
                        item.sup_name   = item.supcust_no + "/" + r.Read("sup_name");
                        lst.Add(item);
                    }
                }
                return(lst);
            }
            catch (Exception ex)
            {
                Helper.LogHelper.writeLog("CommonBLL.GetSupList()", ex.ToString(), null);
                throw ex;
            }
        }
Пример #6
0
 void IBLL.ISup.Change(Model.bi_t_supcust_info item)
 {
     item.update_time = System.DateTime.Now;
     DB.IDB db = new DB.DBByAutoClose(Appsetting.conn);
     db.Update(item, "supcust_no,supcust_flag");
 }
Пример #7
0
 public CellInfo(Rectangle rec, Model.bi_t_supcust_info item)
 {
     this.rec  = rec;
     this.item = item;
 }
Пример #8
0
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                WebHelper web = new WebHelper(pars);
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var       kv  = r.ToDictionary();
                IBLL.ISup bll = new BLL.Sup();
                if (t == "get_list")
                {
                    string region_no   = r.Read("region_no");
                    string keyword     = r.Read("keyword");
                    int    show_stop   = Helper.Conv.ToInt32(r.Read("show_stop"));
                    int    page_index  = Helper.Conv.ToInt32(r.Read("page_index"));
                    int    page_size   = Helper.Conv.ToInt32(r.Read("page_size"));
                    int    total_count = 0;

                    var tb = bll.GetList(region_no, keyword, show_stop, page_index, page_size, out total_count);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);
                    w.Append("total_count", total_count.ToString());
                    res = w.ToString();
                }
                else if (t == "get_item")
                {
                    string supcust_no = r.Read("supcust_no");
                    var    tb         = bll.GetItem(supcust_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);
                    res = w.ToString();
                }
                else if (t == "max_code")
                {
                    string code = bll.MaxCode();
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("code", code);
                    res = w.ToString();
                }
                else if (t == "add")
                {
                    Model.bi_t_supcust_info item = new Model.bi_t_supcust_info();
                    item.supcust_no   = r.Read("supcust_no");
                    item.supcust_flag = r.Read("supcust_flag");
                    item.sup_name     = r.Read("sup_name");
                    item.region_no    = r.Read("region_no");
                    item.sup_type     = r.Read("sup_type");
                    item.sup_man      = r.Read("sup_man");
                    item.sup_addr     = r.Read("sup_addr");

                    item.sup_email = r.Read("sup_email");
                    item.sup_tel   = r.Read("sup_tel");

                    item.display_flag = r.Read("display_flag");
                    item.credit_amt   = Helper.Conv.ToDecimal(r.Read("credit_amt"));
                    item.sale_man     = r.Read("sale_man");
                    item.sup_pyname   = r.Read("sup_pyname");
                    bll.Add(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "change")
                {
                    Model.bi_t_supcust_info item = new Model.bi_t_supcust_info();
                    item.supcust_no   = r.Read("supcust_no");
                    item.supcust_flag = r.Read("supcust_flag");
                    item.sup_name     = r.Read("sup_name");
                    item.region_no    = r.Read("region_no");
                    item.sup_type     = r.Read("sup_type");
                    item.sup_man      = r.Read("sup_man");
                    item.sup_addr     = r.Read("sup_addr");

                    item.sup_email = r.Read("sup_email");
                    item.sup_tel   = r.Read("sup_tel");

                    item.display_flag = r.Read("display_flag");
                    item.credit_amt   = Helper.Conv.ToDecimal(r.Read("credit_amt"));
                    item.sale_man     = r.Read("sale_man");
                    item.sup_pyname   = r.Read("sup_pyname");
                    bll.Change(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete")
                {
                    string supcust_no = r.Read("supcust_no");
                    bll.Delete(supcust_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else
                {
                    web.ReflectionMethod(bll, t);
                    res = web.NmJson();
                }
            }
            catch (Exception ex)
            {
                ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                w.Append("errId", "-1");
                w.Append("errMsg", ex.Message);
                res = w.ToString();
            }
        }
Пример #9
0
 public void change(WebHelper w, Dictionary <string, object> kv)
 {
     Model.bi_t_supcust_info item = w.GetObject <Model.bi_t_supcust_info>();
     bll.Change(item);
 }