Ejemplo n.º 1
0
        void IBLL.IPeople.Add(Model.bi_t_people_info item)
        {
            string sql = "select * from bi_t_people_info where oper_id='" + item.oper_id + "'";

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

            if (tb.Rows.Count != 0)
            {
                throw new Exception("已经存在职员编号" + item.oper_id);
            }
            db.Insert(item);
        }
Ejemplo n.º 2
0
 public void change(WebHelper w, Dictionary <string, object> kv)
 {
     Model.bi_t_people_info item = w.GetObject <Model.bi_t_people_info>();
     if (w.Read("birthday") != "")
     {
         item.birthday = Helper.Conv.ToDateTime(w.Read("birthday"));
     }
     if (w.Read("in_date") != "")
     {
         item.in_date = Helper.Conv.ToDateTime(w.Read("in_date"));
     }
     bll.Change(item);
 }
Ejemplo n.º 3
0
 void IBLL.IPeople.Change(Model.bi_t_people_info item)
 {
     DB.IDB db = new DB.DBByAutoClose(Appsetting.conn);
     db.Update(item, "oper_id");
 }
Ejemplo n.º 4
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.IPeople bll = new BLL.People();
                if (t == "get_list")
                {
                    string dep_no      = r.Read("dep_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(dep_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 oper_id = r.Read("oper_id");
                    var    tb      = bll.GetItem(oper_id);
                    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_people_info item = new Model.bi_t_people_info();
                    item.oper_id     = r.Read("oper_id");
                    item.oper_name   = r.Read("oper_name");
                    item.oper_status = r.Read("oper_status");
                    item.dept_no     = r.Read("dept_no");
                    if (r.Read("birthday") != "")
                    {
                        item.birthday = Helper.Conv.ToDateTime(r.Read("birthday"));
                    }
                    item.tel = r.Read("tel");
                    if (r.Read("in_date") != "")
                    {
                        item.in_date = Helper.Conv.ToDateTime(r.Read("in_date"));
                    }
                    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_people_info item = new Model.bi_t_people_info();
                    item.oper_id     = r.Read("oper_id");
                    item.oper_name   = r.Read("oper_name");
                    item.oper_status = r.Read("oper_status");
                    item.dept_no     = r.Read("dept_no");
                    if (r.Read("birthday") != "")
                    {
                        item.birthday = Helper.Conv.ToDateTime(r.Read("birthday"));
                    }
                    item.tel = r.Read("tel");
                    if (r.Read("in_date") != "")
                    {
                        item.in_date = Helper.Conv.ToDateTime(r.Read("in_date"));
                    }
                    bll.Change(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete")
                {
                    string oper_id = r.Read("oper_id");
                    bll.Delete(oper_id);
                    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();
            }
        }