Esempio n. 1
0
    private void SetPagePrivilege()
    {
        try
        {
            objPage.CheckSession();
            string[] menuArray = new string[] { "mnuli1", "mnuli2", "mnuli3", "mnuli4", "mnuli5", "mnuli6", "mnuli7", "mnuli8", "mnuli9", "mnuli10", "mnuli11" };
            string[] SellingDesk = new string[] { "mnuli6", "mnuli9" };  //SALE & CUSTOMER & MY ACCOUNT
            string[] StockManager = new string[] { "mnuli6", "mnuli4", "mnuli8", "mnuli5" }; //: MANUFACTURER, PRODUCT, BARCODE, PURCHASE
            User objUser = new BLL.BusinessObject.User();
            objUser = (User)Session["UserData"];
            if (objUser.UserTypeID == (int)Constants.UserType.SellingDesk)
            {
                for (int i = 0; i < menuArray.Length; i++)
                {
                    for (int ii = 0; ii < SellingDesk.Length; ii++)
                    {
                        if (SellingDesk[ii] == menuArray[i])
                        {
                            HtmlGenericControl ThisLI = (HtmlGenericControl)FindControl(SellingDesk[ii]);
                            ThisLI.ID = SellingDesk[ii];
                            ThisLI.Style.Add("display", "");
                        }
                    }
                }
            }

            else if (objUser.UserTypeID == (int)Constants.UserType.StockManager)
            {
                for (int i = 0; i < menuArray.Length; i++)
                {
                    for (int ii = 0; ii < StockManager.Length; ii++)
                    {
                        if (StockManager[ii] == menuArray[i])
                        {
                            HtmlGenericControl ThisLI = (HtmlGenericControl)FindControl(StockManager[ii]);
                            ThisLI.ID = StockManager[ii];
                            ThisLI.Style.Add("display", "");
                        }
                    }
                }
            }

            else if (objUser.UserTypeID == (int)Constants.UserType.Admin)
            {
                for (int i = 0; i < menuArray.Length; i++)
                {
                    HtmlGenericControl ThisLI = (HtmlGenericControl)FindControl(menuArray[i]);
                    ThisLI.ID = menuArray[i];
                    ThisLI.Style.Add("display", "");
                }
            }

        }
        catch (Exception ex)
        {
           objPage.CheckSession();
        }
    }
Esempio n. 2
0
        public void AuthenticationValidation(ref User vObjUserInfo)
        {

            object[] mParams = {
                                        new SqlParameter("@LoginID", SqlDbType.NVarChar),    
                                        new SqlParameter("@LoginPassword", SqlDbType.NVarChar),    
                                };

            mParams[0] = vObjUserInfo.LoginID;
            mParams[1] = vObjUserInfo.LoginPassword;

            using (IDataReader reader = dBase.ExecuteReader("sprocCS_AuthenticationValidation", mParams))
            {

                while (reader.Read())
                {
                    if (reader["UserID"] != DBNull.Value)
                        vObjUserInfo.UserID = Convert.ToInt32(reader["UserID"]);

                    if (reader["LoginID"] != DBNull.Value)
                        vObjUserInfo.LoginID = Convert.ToString(reader["LoginID"]);

                    if (reader["UserTypeID"] != DBNull.Value)
                        vObjUserInfo.UserTypeID = Convert.ToInt32(reader["UserTypeID"]);

                    if (reader["UserType"] != DBNull.Value)
                        vObjUserInfo.UserType = Convert.ToString(reader["UserType"]);

                    if (reader["LoginPassword"] != DBNull.Value)
                        vObjUserInfo.LoginPassword = Convert.ToString(reader["LoginPassword"]);

                    if (reader["FirstName"] != DBNull.Value)
                        vObjUserInfo.FirstName = Convert.ToString(reader["FirstName"]);

                    if (reader["LastName"] != DBNull.Value)
                        vObjUserInfo.LastName = Convert.ToString(reader["LastName"]);

                    if (reader["CommunicationEmailID"] != DBNull.Value)
                        vObjUserInfo.CommunicationEmailID = Convert.ToString(reader["CommunicationEmailID"]);

                    if (reader["LastLoggedIn"] != DBNull.Value)
                        vObjUserInfo.LastLoggedIn = Convert.ToDateTime(reader["LastLoggedIn"]);
                }
            }

        }
Esempio n. 3
0
    private void LoadUserSpecificData()
    {
        try
        {
            objPage.CheckSession();
            User objUser = new BLL.BusinessObject.User();
            objUser = (User)Session["UserData"];
            lblUserName.InnerHtml = objUser.FirstName;
            spnUserType.InnerHtml = " , " + objUser.UserType + " - Last login : "******"{0:dd-MMM @ HH:mm}", objUser.LastLoggedIn) + " ";
        }
        catch (Exception ex)
        {

        }

    }
Esempio n. 4
0
        public User ChangeAccountInformation(ref User objUser)
        {

            User lstobjUser = new User();
            try
            {

                DbCommand objCmd = dBase.GetStoredProcCommand("sprocCS_ChangeAccountInformation");
                dBase.AddInParameter(objCmd, "@UserID", DbType.Int32, objUser.UserID);
                dBase.AddInParameter(objCmd, "@FirstName", DbType.String, objUser.FirstName);
                dBase.AddInParameter(objCmd, "@LastName", DbType.String, objUser.LastName);
                dBase.AddInParameter(objCmd, "@CommunicationEmailID", DbType.String, objUser.CommunicationEmailID);

                using (IDataReader reader = dBase.ExecuteReader(objCmd))
                {
                    while (reader.Read())
                    {
                        lstobjUser=PopulateUser(reader);

                    }
                }
            }
            catch (Exception ex)
            {

                Common.LogError("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            }
            return lstobjUser;
        }
Esempio n. 5
0
        public Message ChangePassword(User objUser, string vstrNewPassword)
        {
            Message objMessage = new Message();
            try
            {
                DbCommand objCmd = dBase.GetStoredProcCommand("sprocCS_ChangePassword");
                dBase.AddInParameter(objCmd, "@UserID", DbType.Int32, objUser.UserID);
                dBase.AddInParameter(objCmd, "@LoginPassword", DbType.String, objUser.LoginPassword);
                dBase.AddInParameter(objCmd, "@NewPassword", DbType.String, vstrNewPassword);
                dBase.AddOutParameter(objCmd, "@ReturnValue", DbType.Int32, 4);
                dBase.AddOutParameter(objCmd, "@ReturnMessage", DbType.String, 255);
                dBase.ExecuteNonQuery(objCmd);

                objMessage.ReturnValue = (int)dBase.GetParameterValue(objCmd, "@ReturnValue");
                objMessage.ReturnMessage = (string)dBase.GetParameterValue(objCmd, "@ReturnMessage");
            }
            catch (Exception ex)
            {

                Common.LogError("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            }
            return objMessage;
        }
Esempio n. 6
0
        public List<User> GetPlatformUserByUserID(ref User objUser)
        {
            List<User> lstobjUser = new List<User>();
            try
            {

                DbCommand objCmd = dBase.GetStoredProcCommand("sprocCS_GetPlatformUserByUserID");
                dBase.AddInParameter(objCmd, "@UserID", DbType.Int32, objUser.UserID);

                using (IDataReader reader = dBase.ExecuteReader(objCmd))
                {
                    while (reader.Read())
                    {
                        lstobjUser.Add(PopulateUser(reader));

                    }
                }
            }
            catch (Exception ex)
            {

                Common.LogError("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            }
            return lstobjUser;
        }
Esempio n. 7
0
        public Message InsertUpdatePlatformUser(User objUser)
        {
            Message objMessage = new Message();
            try
            {
                DbCommand objCmd = dBase.GetStoredProcCommand("sprocCS_InsertUpdatePlatformUser");
                dBase.AddInParameter(objCmd, "@UserID", DbType.Int32, objUser.UserID);
                dBase.AddInParameter(objCmd, "@UserTypeID", DbType.Int32, objUser.UserTypeID);
                dBase.AddInParameter(objCmd, "@FirstName", DbType.String, objUser.FirstName);
                dBase.AddInParameter(objCmd, "@LastName", DbType.String, objUser.LastName);
                dBase.AddInParameter(objCmd, "@CommunicationEmailID", DbType.String, objUser.CommunicationEmailID);
                dBase.AddInParameter(objCmd, "@LoginID", DbType.String, objUser.LoginID);
                dBase.AddInParameter(objCmd, "@LoginPassword", DbType.String, objUser.LoginPassword);
                dBase.AddOutParameter(objCmd, "@ReturnValue", DbType.Int32, 4);
                dBase.AddOutParameter(objCmd, "@ReturnMessage", DbType.String, 255);
                dBase.ExecuteNonQuery(objCmd);

                objMessage.ReturnValue = (int)dBase.GetParameterValue(objCmd, "@ReturnValue");
                objMessage.ReturnMessage = (string)dBase.GetParameterValue(objCmd, "@ReturnMessage");
            }
            catch (Exception ex)
            {

                Common.LogError("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            }
            return objMessage;
        }
Esempio n. 8
0
 public User ChangeAccountInformation(ref User objUser)
 {
     return objDB.ChangeAccountInformation(ref objUser);
 }
Esempio n. 9
0
        private User PopulateUser(IDataReader drData)
        {
            User objUser = new User();
            try
            {

                if (FieldExists(drData, "UserID") && drData["UserID"] != DBNull.Value)
                {
                    objUser.UserID = Convert.ToInt32(drData["UserID"]);
                }
                if (FieldExists(drData, "UserTypeID") && drData["UserTypeID"] != DBNull.Value)
                {
                    objUser.UserTypeID = Convert.ToInt32(drData["UserTypeID"]);
                }

                if (FieldExists(drData, "UserType") && drData["UserType"] != DBNull.Value)
                {
                    objUser.UserType = Convert.ToString(drData["UserType"]);
                }

                if (FieldExists(drData, "LoginID") && drData["LoginID"] != DBNull.Value)
                {
                    objUser.LoginID = Convert.ToString(drData["LoginID"]);
                }

                if (FieldExists(drData, "LoginPassword") && drData["LoginPassword"] != DBNull.Value)
                {
                    objUser.LoginPassword = Convert.ToString(drData["LoginPassword"]);
                }

                if (FieldExists(drData, "FirstName") && drData["FirstName"] != DBNull.Value)
                {
                    objUser.FirstName = Convert.ToString(drData["FirstName"]);
                }

                if (FieldExists(drData, "LastName") && drData["LastName"] != DBNull.Value)
                {
                    objUser.LastName = Convert.ToString(drData["LastName"]);
                }

                if (FieldExists(drData, "LastLoggedIn") && drData["LastLoggedIn"] != DBNull.Value)
                {
                    objUser.LastLoggedIn = Convert.ToDateTime(drData["LastLoggedIn"]);
                }

                if (FieldExists(drData, "CommunicationEmailID") && drData["CommunicationEmailID"] != DBNull.Value)
                {
                    objUser.CommunicationEmailID = Convert.ToString(drData["CommunicationEmailID"]);
                }

                if (FieldExists(drData, "CreatedOn") && drData["CreatedOn"] != DBNull.Value)
                {
                    objUser.CreatedOn = Convert.ToDateTime(drData["CreatedOn"]);
                }


                if (FieldExists(drData, "IsDeleted") && drData["IsDeleted"] != DBNull.Value)
                {
                    objUser.IsDeleted = Convert.ToBoolean(drData["IsDeleted"]);
                }

                if (FieldExists(drData, "UpdatedOn") && drData["UpdatedOn"] != DBNull.Value)
                {
                    objUser.UpdatedOn = Convert.ToDateTime(drData["UpdatedOn"]);
                }

            }
            catch (Exception ex)
            {

                Common.LogError("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            }
            return objUser;
        }
Esempio n. 10
0
 public Message ChangePassword(User objUser, string vstrNewPassword)
 {
     return objDB.ChangePassword(objUser, vstrNewPassword);
 }
Esempio n. 11
0
 public Message DeletePlatformUser(User objUser)
 {
     return objDB.DeletePlatformUser(objUser);
 }
Esempio n. 12
0
 public List<User> GetPlatformUserByUserID(ref User objUser)
 {
     return objDB.GetPlatformUserByUserID(ref objUser);
 }
Esempio n. 13
0
 public Message InsertUpdatePlatformUser(User objUser)
 {
     return objDB.InsertUpdatePlatformUser(objUser);
 }
Esempio n. 14
0
 public void AuthenticationValidation(ref User objUser)
 {
     objDB.AuthenticationValidation(ref objUser);
 }