Exemplo n.º 1
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);
        }