示例#1
0
        public string Get(string id)
        {
            DB db = null;

            if (Config.IsMulti)
            {
                db = new DbBranch();
            }
            else
            {
                db = new DB();
            }
            @operator o = new DB()[email protected](x => x.s_work_no == id);

            return(RetMsg.Success(o));
        }
示例#2
0
        public string UpdatePwd(string id)
        {
            DB db = null;

            if (Config.IsMulti)
            {
                db = new DbBranch();
            }
            else
            {
                db = new DB();
            }
            //var desid=CchMis.Common.Encryption.AESDecrypt(id);
            @operator op = new DB()[email protected](x => x.s_work_no == id);

            return(RetMsg.Success(op));
        }
示例#3
0
        public string Put()
        {
            if (Config.IsMulti)
            {
                db = new DbBranch();
            }
            else
            {
                db = new DB();
            }

            //更新数据,方法一
            try
            {
                @operator user = JsonConvert.DeserializeObject <@operator>(Request["data"]);
                db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(RetMsg.Success(user));
                }
                return(RetMsg.UpdateFailed);
            }
            catch (Exception ex)
            {
                ex = ex.InnerException ?? ex;
                LogHelper.Error(ex);
                return(RetMsg.Error(ex.Message));
            }
            //更新数据,方法二
            //var query1 = (from q in context.Users
            //              where q.UserName == "Jone"
            //              select q).SingleOrDefault();

            ////判断query1是否为空,若不为空,则修改UserEmail。
            //if (query1 != null)
            //{
            //    query1.UserEmail = "*****@*****.**";
            //    context.SubmitChanges();
            //}
        }
示例#4
0
 public string FromMainDb(string id)
 {
     return(RetMsg.Success(new DB()[email protected](x => x.s_work_no == id)));
 }