コード例 #1
0
ファイル: DbOperations.cs プロジェクト: nsaltun/GunIsigi
        public static void Insert(object model)
        {
            //Type type = model.GetType();
            //string propName = type.Name;
            //var property = type.GetProperty(propName);
            //var propertyValue = property.GetValue(model);

            Type type = model.GetType();

            foreach (PropertyInfo prop in type.GetProperties())
            {
                if (prop.Name == "GUID")
                {
                    Int64 guid = KasifHelper.GuidFactory();
                    prop.SetValue(model, guid);
                }
                else if (prop.Name == "STATUS")
                {
                    prop.SetValue(model, Convert.ToInt16(1));
                }
                else if (prop.Name == "LASTUPDATED")
                {
                    prop.SetValue(model, KasifHelper.GetCurrentDate());
                }
            }

            DbAction(context =>
            {
                context.Entry(model).State = EntityState.Added;
                context.SaveChanges();
            });
        }
コード例 #2
0
 private void DoChangePwd()
 {
     try
     {
         List <USER_USER> lstUser = new List <USER_USER>();
         USER_USER        usrObj  = new USER_USER();
         DbOperations.FindBy <USER_USER>(ref lstUser, usrObj, x => x.GUID == KsfSI.UserGuid);
         lstUser[0].PASSWORD             = KasifHelper.GetSha512HashedData(txtNewPwd.Value);
         lstUser[0].LAST_PWD_CHANGE_DATE = KasifHelper.GetCurrentDate();
         DbOperations.Update(lstUser[0]);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
 private void FillSessionObject()
 {
     SessionObj         = new SessionInfo();
     SessionObj.Email   = userObj.EMAIL;
     SessionObj.IsAdmin = userObj.IS_ADMIN;
     //SessionObj.UserId = userObj.USER_ID;
     SessionObj.UserGuid         = userObj.GUID;
     SessionObj.MenuTreeItemInfo = lstMenuTreeObj;
     SessionObj.lstAllowedPages  = lstAllowedPagesObj;
     SessionObj.MenuTiles        = lstMenuTile;
     SessionObj.RoleGuid         = userInfo.ROLE_GUID;
     SessionObj.RoleName         = userInfo.ROLE_NAME;
     SessionObj.SessionGuid      = KasifHelper.GuidFactory();
     SessionObj.userNameSurname  = userInfo.NAME + " " + userInfo.SURNAME;
     SessionObj.HocaGuid         = userInfo.HOCA_GUID;
     SessionObj.OgrenciGuid      = userInfo.OGR_GUID;
 }
コード例 #4
0
ファイル: DbOperations.cs プロジェクト: nsaltun/GunIsigi
        public static void Delete(object model)
        {
            Type type = model.GetType();

            foreach (PropertyInfo prop in type.GetProperties())
            {
                if (prop.Name == "STATUS")
                {
                    prop.SetValue(model, Convert.ToInt16(0));
                }
                else if (prop.Name == "LASTUPDATED")
                {
                    prop.SetValue(model, KasifHelper.GetCurrentDate());
                }
            }

            DbAction(context =>
            {
                context.Entry(model).State = EntityState.Modified;
                context.SaveChanges();
            });
        }
コード例 #5
0
 private bool CheckOldPasswordCorrectness(string oldPwd)
 {
     try
     {
         List <USER_USER> lstUser   = new List <USER_USER>();
         string[]         prmNames  = new string[] { "P_EMAIL", "P_PASSWORD" };
         object[]         prmValues = new object[] { KsfSI.Email, KasifHelper.GetSha512HashedData(oldPwd) };
         DbOperations.RunDbQuery <USER_USER>(ref lstUser, DbQueryName.GET_USER_BY_EMAIL, prmNames, prmValues);
         if (lstUser == null || lstUser.Count == 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #6
0
 public OLogin(string userId, string pwd)
 {
     this.userId    = userId;
     this.hashedPwd = KasifHelper.GetSha512HashedData(pwd);
 }