Exemple #1
0
 /// <summary>
 /// 查询一条
 /// </summary>
 /// <param name="loginKey">登录凭证</param>
 /// <param name="err">错误信息</param>
 /// <param name="keyId">主键ID</param>
 /// <returns>查询一条</returns>
 public ProInterface.Models.LOGIN Login_SingleId(string loginKey, ref ProInterface.ErrorInfo err, int keyId)
 {
     if (!GlobalFun.UserCheckFunctioAuthority(loginKey, ref err, MethodBase.GetCurrentMethod()))
     {
         return(null);
     }
     using (DBEntities db = new DBEntities())
     {
         var ent   = db.fa_login.SingleOrDefault(x => x.ID == keyId);
         var reEnt = new ProInterface.Models.LOGIN();
         if (ent != null)
         {
             reEnt = Fun.ClassToCopy <fa_login, ProInterface.Models.LOGIN>(ent);
         }
         return(reEnt);
     }
 }
Exemple #2
0
 /// <summary>
 /// 修改登录
 /// </summary>
 /// <param name="loginKey">登录凭证</param>
 /// <param name="err">错误信息</param>
 /// <param name="inEnt">实体类</param>
 /// <param name="allPar">更新的参数</param>
 /// <returns>修改登录</returns>
 public object Login_Save(string loginKey, ref ProInterface.ErrorInfo err, ProInterface.Models.LOGIN inEnt, IList <string> allPar)
 {
     using (DBEntities db = new DBEntities())
     {
         try
         {
             var ent = Login_Save(db, loginKey, ref err, inEnt, allPar);
             db.SaveChanges();
             return(ent);
         }
         catch (DbEntityValidationException e)
         {
             err.IsError = true;
             err.Message = Fun.GetDbEntityErrMess(e);
             return(null);
         }
         catch (Exception e)
         {
             err.IsError = true;
             err.Message = e.Message;
             return(null);
         }
     }
 }
Exemple #3
0
        public object Login_Save(DBEntities db, string loginKey, ref ProInterface.ErrorInfo err, ProInterface.Models.LOGIN inEnt, IList <string> allPar)
        {
            if (!GlobalFun.UserCheckFunctioAuthority(loginKey, ref err, MethodBase.GetCurrentMethod()))
            {
                return(null);
            }
            var  ent   = db.fa_login.SingleOrDefault(a => a.ID == inEnt.ID);
            bool isAdd = false;

            if (ent == null)
            {
                isAdd  = true;
                ent    = Mapper.Map <LOGIN, fa_login>(inEnt);
                ent.ID = Fun.GetCurrvalSeqID <fa_login>();
            }
            else
            {
                ent = Fun.ClassToCopy <ProInterface.Models.LOGIN, fa_login>(inEnt, ent, allPar);
            }
            if (isAdd)
            {
                ent = db.fa_login.Add(ent);
            }
            GlobalFun.UserWriteLog(loginKey, MethodBase.GetCurrentMethod(), StatusType.UserLogType.Edit);
            return(ent);
        }