Пример #1
0
        public void login(WebHelper w, Dictionary <string, object> kv)
        {
            string oper_id = w.Read("oper_id");
            string pwd     = w.Read("pwd");
            string oper_name;
            string oper_type;

            bll.Login(oper_id, pwd, out oper_name, out oper_type);

            w.Write("oper_name", oper_name);
            w.Write("oper_type", oper_type);
            w.Write("mc_id", "0");

            IBLL.IMyDestop desbll = new BLL.MyDestop();
            var            tbs    = desbll.GetAll();

            w.Write("data", tbs);

            //我的权限
            IBLL.ISys sysbll = new BLL.Sys();
            tbs = sysbll.GetAllGrant(new global::Model.sa_t_oper_grant()
            {
                oper_id = oper_type
            });
            w.Write("data2", tbs);
        }
Пример #2
0
        public static void Upadte()
        {
            try
            {
                {
                    //更新中间件
                    IBLL.IUpdate bll = new BLL.UpdateBLL();
                    bll.AutoUpdate();
                }
                {
                    //更新数据库
                    IBLL.ISys bll     = new BLL.Sys();
                    int       ser_ver = Conv.ToInt(bll.Read("ser_ver").Split('_')[1]);
                    int       ver     = Conv.ToInt(Appsetting.versions.Split('_')[1]);
                    if (ser_ver < ver)
                    {
                        //需要更新
                        Type         t     = soft_update.GetType();
                        MethodInfo[] infos = t.GetMethods();
                        foreach (MethodInfo info in infos)
                        {
                            if (info.Name.IndexOf("_") > -1)
                            {
                                int time = Conv.ToInt(info.Name.Split('_')[1]);

                                if (time > ser_ver)
                                {
                                    info.Invoke(soft_update, null);
                                }
                            }
                        }
                    }
                    else if (ser_ver > ver)
                    {
                        //需要更新程序
                        Log.writeLog("中间件版本过低,请更新");
                    }
                }
            }
            catch (Exception ex)
            {
                Log.writeLog("更新失败" + Environment.NewLine + ex.ToString());
            }
        }
Пример #3
0
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var        kv  = r.ToDictionary();
                IBLL.IOper bll = new BLL.Oper();
                if (t == "login")
                {
                    string oper_id = r.Read("oper_id");
                    string pwd     = r.Read("pwd");
                    string oper_name;
                    string oper_type;
                    bll.Login(oper_id, pwd, out oper_name, out oper_type);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("oper_name", oper_name);
                    w.Append("oper_type", oper_type);

                    IBLL.IMyDestop desbll = new BLL.MyDestop();
                    var            tbs    = desbll.GetAll();
                    w.Append("data", tbs);

                    //我的权限
                    IBLL.ISys sysbll = new BLL.Sys();
                    tbs = sysbll.GetAllGrant(new global::Model.sa_t_oper_grant()
                    {
                        oper_id = oper_type
                    });
                    w.Append("data2", tbs);

                    res = w.ToString();
                }
                else if (t == "change_pwd")
                {
                    string oper_id = r.Read("oper_id");
                    string old_pwd = r.Read("old_pwd");
                    string new_pwd = r.Read("new_pwd");
                    bll.ChangePWD(oper_id, old_pwd, new_pwd);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t.Equals("add"))
                {
                    WebHelper web = new WebHelper(pars);

                    Model.sa_t_operator_i oper = web.GetObject <Model.sa_t_operator_i>();

                    bll.Add(oper);

                    web.WriteSuccess();
                    res = web.NmJson();
                }
                else if (t.Equals("GetMaxCode"))
                {
                    WebHelper web  = new WebHelper(pars);
                    string    code = bll.GetMaxCode();

                    web.Write("code", code);
                    web.WriteSuccess();
                    res = web.NmJson();
                }
                else if (t.Equals("GetOperType"))
                {
                    WebHelper web = new WebHelper(pars);
                    var       tb  = bll.GetOperType();

                    web.Write(tb);
                    web.WriteSuccess();
                    res = web.NmJson();
                }
                else if (t.Equals("GetOpers"))
                {
                    WebHelper web = new WebHelper(pars);
                    var       tb  = bll.GetOpers();

                    web.Write(tb);
                    web.WriteSuccess();
                    res = web.NmJson();
                }
                else if (t.Equals("Upload"))
                {
                    WebHelper web = new WebHelper(pars);

                    var oper = web.GetObject <Model.sa_t_operator_i>();
                    bll.Upload(oper);

                    web.WriteSuccess();
                    res = web.NmJson();
                }
                else if (t.Equals("Del"))
                {
                    WebHelper web = new WebHelper(pars);

                    var oper = web.GetObject <Model.sa_t_operator_i>();
                    bll.Del(oper.oper_id);

                    web.WriteSuccess();
                    res = web.NmJson();
                }
                else if (t == "reset_pwd")
                {
                    string oper_id = r.Read("oper_id");

                    string new_pwd = r.Read("new_pwd");
                    bll.ResetPWD(oper_id, new_pwd);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else
                {
                    WebHelper web = new WebHelper(pars);
                    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();
            }
        }
Пример #4
0
        public void Request(string t, string pars, out string res)
        {
            WebHelper w = new WebHelper(pars);

            IBLL.ISys bll = new BLL.Sys();
            try
            {
                if (t == "add")
                {
                    Model.sys_t_system system = w.GetObject <Model.sys_t_system>();
                    bll.add(system);
                    w.WriteSuccess();
                }
                else if (t == "addDic")
                {
                    Dictionary <string, Model.sys_t_system> dic = w.GetDic <Model.sys_t_system>();
                    bll.addDic(dic);
                    w.WriteSuccess();
                }
                else if (t == "update")
                {
                    Model.sys_t_system system = w.GetObject <Model.sys_t_system>();
                    bll.update(system);
                    w.WriteSuccess();
                }
                else if (t == "updateDic")
                {
                    Dictionary <string, Model.sys_t_system> dic = w.GetDic <Model.sys_t_system>();
                    bll.updatedic(dic);
                    w.WriteSuccess();
                }
                else if (t == "GetAll")
                {
                    var tb = bll.GetAll();
                    w.Write(tb);
                    w.WriteSuccess();
                }
                else if (t == "read")
                {
                    ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                    string sys_var_id = r.Read("sys_var_id");
                    string value      = bll.Read(sys_var_id);
                    ReadWriteContext.IWriteContext w2 = new ReadWriteContext.WriteContextByJson();
                    w2.Append("errId", "0");
                    w2.Append("errMsg", "");
                    w2.Append("value", value);

                    res = w2.ToString();
                    return;
                }
                else
                {
                    w.ReflectionMethod(bll, t);
                    res = w.NmJson();
                }

                res = w.NmJson();
            }
            catch (Exception ex)
            {
                w.WriteError(ex);
                res = w.NmJson();
            }
        }
Пример #5
0
 public string GetServerVer()
 {
     IBLL.ISys bll = new BLL.Sys();
     return(bll.Read("ser_ver"));
 }