Example #1
0
        protected override XResp Execute()
        {
            var ag = DB.x_agent.SingleOrDefault(o => o.uid == uid);

            if (ag == null || (Secret.MD5(ag.pwd) != Secret.MD5(pwd) && Secret.MD5(ag.pwd) != pwd))
            {
                throw new XExcep("用户名或密码不正确");
            }

            ag.ukey = Tools.GetRandRom(32, 3);
            SubmitDBChanges();

            var r = new cag
            {
                ukey        = ag.ukey,
                contract    = ag.contract,
                logo        = ag.logo,
                name        = ag.name,
                pwd         = Secret.MD5(ag.pwd),
                tel         = ag.tel,
                uid         = ag.uid,
                addr        = ag.addr,
                intro       = ag.intro,
                status      = ag.status ?? 0,
                status_name = ag.status_name,
                zz          = (decimal)ag.c_zz,
                hz          = (decimal)ag.c_hz
            };

            return(r);
        }
Example #2
0
        protected override XResp Execute()
        {
            if (!string.IsNullOrEmpty(name))
            {
                cag.name = name;
            }
            if (!string.IsNullOrEmpty(contract))
            {
                cag.contract = contract;
            }
            if (!string.IsNullOrEmpty(tel))
            {
                cag.tel = tel;
            }
            if (!string.IsNullOrEmpty(intro))
            {
                cag.intro = intro;
            }
            if (!string.IsNullOrEmpty(addr))
            {
                cag.addr = addr;
            }
            if (!string.IsNullOrEmpty(logo))
            {
                cag.logo = logo;
            }
            if (!string.IsNullOrEmpty(pwd))
            {
                cag.pwd = pwd;
            }
            cag.c_zz = c_zz;
            cag.c_hz = c_hz;

            SubmitDBChanges();

            var r = new cag
            {
                ukey     = cag.ukey,
                contract = cag.contract,
                logo     = cag.logo,
                name     = cag.name,
                pwd      = Secret.MD5(cag.pwd),
                tel      = cag.tel,
                uid      = cag.uid,
                addr     = cag.addr,
                intro    = cag.intro,
                hz       = (decimal)cag.c_hz,
                zz       = (decimal)cag.c_zz
            };

            return(r);
        }