Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Session["s_forceChange"] as string))
            {
                if (HttpContext.Current.Request.Url.AbsolutePath.Substring(HttpContext.Current.Request.Url.AbsolutePath.Length - 19, 19) != "changepassword.aspx")
                {
                    Response.Redirect(Session["s_forceChange"].ToString(), false);
                }
            }
            if( !IsPostBack )
            {
                //lnkChangePasswd.HRef = "changepassword.aspx?" + Request.QueryString;
                //lnkDayofExpired.HRef = "dayofexpired.aspx?" + Request.QueryString;

                if (PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_NameUserCookie"]) == "" && PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"]) == "")
                {
                    Response.Redirect("login.aspx", false);
                }
                //else if (Request["id"] == null) Response.Redirect("logout.aspx", false);
                else
                {
                    eStatus = new PHCore_Status();
                    string strRoleId = PH_EncrptHelper.MD5Decryp(PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"]));
                    if (strRoleId != "")
                        eStatus.RoleId = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), strRoleId, true);

                    GenMenu();

                }
            }
        }
Ejemplo n.º 2
0
        public static PHCore_Status UserSignIn(string strConnDB, string strUserName, string strPassword)
        {
            try
            {
                PHCore_Status eStatus = new PHCore_Status();
                DataTable dtUser = PH_UserProfile.PH_UserProfile_SigIn(strConnDB, strUserName, PH_EncrptHelper.MD5Encryp( strPassword));
                if (dtUser != null && dtUser.Rows.Count > 0)
                {
                    DateTime dtPassExpired = (DateTime)dtUser.Rows[0]["Passwd_Expired_Date"];
                    if (DateTime.Now > dtPassExpired) eStatus.Status = PHCore_Status.SignInStatus.PasswordExpired;
                    else eStatus.Status = PHCore_Status.SignInStatus.Success;

                    eStatus.UserId = dtUser.Rows[0]["userid"].ToString();
                    eStatus.UserName = dtUser.Rows[0]["username"].ToString();
                    eStatus.UserStatus = dtUser.Rows[0]["User_Status"].ToString();
                    eStatus.RoleId =  (PHCore_Status.RoleID)Enum.Parse( typeof(PHCore_Status.RoleID),dtUser.Rows[0]["roleid"].ToString() ,true);
                }
                else {
                    eStatus.Status = PHCore_Status.SignInStatus.Failure;
                }
                //eStatus = Microsoft.AspNet.Identity.Owin.SignInStatus.Success;
                return eStatus;

            }
            catch(Exception ex)
            {
                throw new Exception("UserSignIn >> " + ex.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// PH_Flow_UserInsert
        /// </summary>
        /// <param name="strConnDB"></param>
        /// <param name="drProfile"></param>
        /// <param name="drVenders"></param>
        /// <returns></returns>
        public PHCore_Status PH_Flow_UserInsert(string strConnDB, PHDS_User.User_ProfileRow drProfile, List <PHDS_User.User_VendorRow> drVenders)
        {
            PHCore_Status status = new PHCore_Status();

            try
            {
                drProfile.UserID = PH_UserProfile.PH_UserProfile_GetMaxID(strConnDB);
                PH_UserProfile.PH_UserProfile_Insert(strConnDB, drProfile);

                if (drVenders != null && drVenders.Count > 0)
                {
                    foreach (PHDS_User.User_VendorRow dr in drVenders)
                    {
                        dr.UserID = drProfile.UserID;
                        PH_UserVendor.PH_UserVendor_Insert(strConnDB, dr);
                    }
                }

                status.Status = PHCore_Status.SignInStatus.Success;
            }
            catch (Exception ex)
            {
                status.Status  = PHCore_Status.SignInStatus.Failure;
                status.Message = ex.Message;
            }
            return(status);
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if( !IsPostBack )
            {

                //lnkChangePasswd.HRef = "changepassword.aspx?" + Request.QueryString;
                //lnkDayofExpired.HRef = "dayofexpired.aspx?" + Request.QueryString;

                if (PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_NameUserCookie"]) == "" && PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"]) == "")
                {
                    Response.Redirect("login.aspx", false);
                }
                else if (Request["id"] == null) Response.Redirect("logout.aspx", false);
                else
                {
                    eStatus = new PHCore_Status();
                    string strRoleId = PH_EncrptHelper.MD5Decryp(PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"]));
                    if (strRoleId != "")
                        eStatus.RoleId = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), strRoleId, true);

                    GenMenu();

                }
            }
        }
Ejemplo n.º 5
0
        public static PHCore_Status UserSignIn(string strConnDB, string strUserName, string strPassword)
        {
            try
            {
                PHCore_Status eStatus = new PHCore_Status();
                DataTable     dtUser  = PH_UserProfile.PH_UserProfile_SigIn(strConnDB, strUserName, PH_EncrptHelper.MD5Encryp(strPassword));
                if (dtUser != null && dtUser.Rows.Count > 0)
                {
                    DateTime dtPassExpired = (DateTime)dtUser.Rows[0]["Passwd_Expired_Date"];
                    if (DateTime.Now > dtPassExpired)
                    {
                        eStatus.Status = PHCore_Status.SignInStatus.PasswordExpired;
                    }
                    else
                    {
                        eStatus.Status = PHCore_Status.SignInStatus.Success;
                    }


                    eStatus.UserId   = dtUser.Rows[0]["userid"].ToString();
                    eStatus.UserName = dtUser.Rows[0]["username"].ToString();
                    eStatus.RoleId   = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), dtUser.Rows[0]["roleid"].ToString(), true);
                }
                else
                {
                    eStatus.Status = PHCore_Status.SignInStatus.Failure;
                }
                //eStatus = Microsoft.AspNet.Identity.Owin.SignInStatus.Success;
                return(eStatus);
            }
            catch (Exception ex)
            {
                throw new Exception("UserSignIn >> " + ex.Message);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// PHCode_Menu_SelByRole
 /// </summary>
 /// <param name="strConnDB"></param>
 /// <param name="strRoleId"></param>
 /// <returns></returns>
 public static DataTable PHCode_Menu_SelByRole(string strConnDB,PHCore_Status.RoleID strRoleId)
 {
     try
     {
         return PH_MenuRole.PH_MenuRole_SelByRole(strConnDB, strRoleId.ToString());
     }
     catch(Exception ex)
     {
         throw new Exception("PHCode_Menu_SelByRole >>" + ex.Message);
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// PH_Flow_UserInsert
        /// </summary>
        /// <param name="strConnDB"></param>
        /// <param name="drProfile"></param>
        /// <param name="drVenders"></param>
        /// <returns></returns>
        public PHCore_Status PH_Flow_UserInsert(string strConnDB,PHDS_User.User_ProfileRow drProfile , List<PHDS_User.User_VendorRow> drVenders)
        {
            PHCore_Status status = new PHCore_Status();
            try
            {
                drProfile.UserID = PH_UserProfile.PH_UserProfile_GetMaxID(strConnDB);
                PH_UserProfile.PH_UserProfile_Insert(strConnDB, drProfile);

                if(drVenders != null && drVenders.Count >0 )
                {

                    foreach( PHDS_User.User_VendorRow dr in drVenders )
                    {
                        dr.UserID = drProfile.UserID;
                        PH_UserVendor.PH_UserVendor_Insert(strConnDB, dr);
                    }
                }

                status.Status = PHCore_Status.SignInStatus.Success;

            }
            catch(Exception ex)
            {
                status.Status = PHCore_Status.SignInStatus.Failure;
                status.Message = ex.Message;
            }
            return status;
        }