Пример #1
0
        protected override void InitApi()
        {
            base.InitApi();

            var id = GetReqParms("mgr_ad");

            if (string.IsNullOrEmpty("ad"))
            {
                throw new XExcep("0x0006");
            }

            //mg = DB.x_mgr.FirstOrDefault(o => o.mgr_id == 1);
            mg = CacheHelper.Get <x_mgr>("mgr." + id);
            if (mg == null)
            {
                throw new XExcep("0x0004");
            }

            if (mg.city == null || mg.city == 0)
            {
                throw new XExcep("0x0060");
            }
            if (mg.city == 62 && mg.role_id == 3)
            {
                long.TryParse(GetReqParms("mgr_ct"), out cityid);
            }
            if (cityid == 0)
            {
                cityid = mg.city.Value;
            }

            ValidPower();
        }
Пример #2
0
        protected override void InitDict()
        {
            base.InitDict();

            var id = GetReqParms("mgr_ad");// Context.Request.Cookies["ad"];

            if (string.IsNullOrEmpty("ad"))
            {
                throw new XExcep("0x0006");
            }

            mg = DB.x_mgr.FirstOrDefault(o => o.mgr_id == 1);
            //mg = CacheHelper.Get<x_mgr>("mgr." + id); //CacheHelper.Get<x_mgr>("mgr." + id);
            if (mg == null)
            {
                throw new XExcep("0x0006");
            }
            var dt = DB.x_dict.FirstOrDefault(o => o.value == mg.city + "" && o.code == "sys.city");

            dict.Add("isbase", dt.f1);
            dict.Add("cname", dt.name);

            ValidPower();

            CacheHelper.Save("mgr." + id, mg, 60 * 60);
            dict.Add("mg", mg);
        }
Пример #3
0
        protected override Web.Com.XResp Execute()
        {
            x_mgr ad = null;

            if (id > 0)
            {
                ad = DB.x_mgr.SingleOrDefault(o => o.mgr_id == id);
            }
            if (ad == null)
            {
                ad = new x_mgr()
                {
                    ctime = DateTime.Now
                }
            }
            ;

            if (mg.city == 62 && ad.mgr_id != 1)
            {
                ad.city = ct;
            }
            else
            {
                ad.city = mg.city;
            }
            if (mg.role_id == 3)
            {
                ad.role_id = role;
            }

            if (DB.x_mgr.Count(o => o.uid == uid && o.mgr_id != ad.mgr_id) > 0)
            {
                throw new XExcep("0x0061");
            }

            ad.uid = uid;
            if (!string.IsNullOrEmpty(pwd) && id > 0)
            {
                ad.pwd = Secret.MD5(pwd);
            }
            ad.name  = name;
            ad.tel   = tel;
            ad.email = mail;
            ad.ctime = DateTime.Now;

            if (ad.mgr_id == 0)
            {
                DB.x_mgr.InsertOnSubmit(ad);
            }
            SubmitDBChanges();

            return(new XResp());
        }
    }
Пример #4
0
        protected override void InitApi()
        {
            base.InitApi();

            //var key = GetReqParms("mg_keys");
            //if (string.IsNullOrEmpty(key)) throw new XExcep("0x0006");

            mg = DB.x_mgr.FirstOrDefault(o => o.mgr_id == 1);// CacheHelper.Get<x_mgr>("mgr." + key);
            if (mg == null)
            {
                throw new XExcep("0x0006");
            }

            //CacheHelper.Save("mgr." + id, mg, 60 * 60);

            ValidPower();
        }
Пример #5
0
        protected override void InitDict()
        {
            base.InitDict();

            //var id = GetReqParms("ad");// Context.Request.Cookies["ad"];
            //if (string.IsNullOrEmpty("ad")) throw new XExcep("0x0006");

            mg = DB.x_mgr.FirstOrDefault(o => o.mgr_id == 1); //CacheHelper.Get<x_mgr>("mgr." + id);
            if (mg == null)
            {
                throw new XExcep("0x0006");
            }

            ValidPower();

            //CacheHelper.Save("mgr." + id, mg, 60 * 60);
            dict.Add("mg", mg);
        }
Пример #6
0
        protected override void InitDict()
        {
            base.InitDict();

            var key = GetReqParms("mgr_ad");// Context.Request.Cookies["ad"];

            if (string.IsNullOrEmpty(key))
            {
                throw new XExcep("0x0004");
            }

            //mg = DB.x_mgr.FirstOrDefault(o => o.mgr_id == 1);
            mg = CacheHelper.Get <x_mgr>("mgr." + key); //CacheHelper.Get<x_mgr>("mgr." + id);
            if (mg == null)
            {
                throw new XExcep("0x0004");
            }

            if (mg.city == null || mg.city == 0)
            {
                throw new XExcep("0x0060");
            }
            if (mg.city == 62 && mg.role_id == 3)
            {
                long.TryParse(GetReqParms("mgr_ct"), out cityid);
            }
            if (cityid == 0)
            {
                cityid = mg.city.Value;
            }

            dict.Add("cityid", cityid);
            var dt = DB.x_dict.FirstOrDefault(o => o.value == cityid + "" && o.code == "sys.city");

            dict.Add("cityname", dt.name);

            ValidPower();

            Context.Response.SetCookie(new System.Web.HttpCookie("mgr_ct", cityid + ""));

            CacheHelper.Save("mgr." + key, mg, 60 * 60);
            dict.Add("mg", mg);
        }
Пример #7
0
        protected override Web.Com.XResp Execute()
        {
            x_mgr ad = new x_mgr();

            if (id > 0)
            {
                ad = DB.x_mgr.SingleOrDefault(o => o.mgr_id == id);
                if (ad == null)
                {
                    throw new XExcep("0x0005");
                }
            }
            else
            {
                //判断用户是否已经存在(根据用户名或账户)
                if (!string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(uid))
                {
                    ad = DB.x_mgr.SingleOrDefault(o => o.name == name || o.uid == uid);
                    if (ad != null)
                    {
                        throw new XExcep("0x0007");
                    }
                    else
                    {
                        ad = new x_mgr();
                    }
                }
            }
            ad.uid = uid;
            if (!string.IsNullOrEmpty(password))
            {
                ad.pwd = Secret.MD5(password);
            }
            ad.name    = name;
            ad.tel     = tel;
            ad.role_id = role;
            ad.email   = mail;
            ad.ctime   = DateTime.Now;


            return(new XResp());
        }
Пример #8
0
        protected override Web.Com.XResp Execute()
        {
            x_mgr ad = new x_mgr();

            if (id > 0)
            {
                ad = DB.x_mgr.SingleOrDefault(o => o.mgr_id == id);
                if (ad == null)
                {
                    throw new XExcep("0x0005");
                }
            }
            else
            {
                ad = DB.x_mgr.SingleOrDefault(o => o.name == name || o.uid == uid);
                if (ad != null)
                {
                    throw new XExcep("0x0007");
                }
                ad = new x_mgr();
            }
            ad.uid = uid;
            if (!string.IsNullOrEmpty(password))
            {
                ad.pwd = Secret.MD5(password);
            }
            ad.name    = name;
            ad.tel     = tel;
            ad.role_id = role;
            ad.email   = mail;
            ad.ctime   = DateTime.Now;

            if (ad.mgr_id == 0)
            {
                DB.x_mgr.InsertOnSubmit(ad);
            }
            SubmitDBChanges();

            return(new XResp());
        }