示例#1
0
        public object User_Role_Id()
        {
            string    User_Id   = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
            Database  db        = DBConnectionHandler.GetDBConnection().DBConnection;
            DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.SPNames.USER_FIRSTNAME);

            db.AddInParameter(dbCommand, "@UserID", DbType.String, User_Id);
            IDataReader dr = db.ExecuteReader(dbCommand);

            if (dr.Read())
            {
                Session["user_role"] = dr.GetString(2);
            }
            return(User_Role_Id1(Session["user_role"].ToString()));
        }
示例#2
0
        public void UpdateAssignmentVisit(AssignmentVisit objAssignmentVisit)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                Database  db        = DBConnectionHandler.GetDBConnection().DBConnection;
                DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.AssignmentVisit.SPNames.UPDATE_AssignmentVisit);


                db.AddInParameter(dbCommand, "@strTo", DbType.String, objAssignmentVisit.strTo);
                db.AddInParameter(dbCommand, "@strSubmittedBy", DbType.String, objAssignmentVisit.strSubmittedBy);
                db.AddInParameter(dbCommand, "@strNameOfAssignment", DbType.String, objAssignmentVisit.strNameOfAssignment);

                db.AddInParameter(dbCommand, "@strInCharge", DbType.String, objAssignmentVisit.strInCharge);
                db.AddInParameter(dbCommand, "@strGuards", DbType.String, objAssignmentVisit.strDressing);
                db.AddInParameter(dbCommand, "@strDressing", DbType.String, objAssignmentVisit.strDeployment);
                db.AddInParameter(dbCommand, "@strAppearance", DbType.String, objAssignmentVisit.strAppearance);
                db.AddInParameter(dbCommand, "@strHaircut", DbType.String, objAssignmentVisit.strHaircut);
                db.AddInParameter(dbCommand, "@strAlertness", DbType.String, objAssignmentVisit.strAlertness);
                db.AddInParameter(dbCommand, "@strDeployment", DbType.String, objAssignmentVisit.strDeployment);
                db.AddInParameter(dbCommand, "@strGeneralPerformance", DbType.String, objAssignmentVisit.strGeneralPerformance);
                db.AddInParameter(dbCommand, "@strOtherMatters", DbType.String, objAssignmentVisit.strOtherMatters);
                db.AddInParameter(dbCommand, "@strConclussion", DbType.String, objAssignmentVisit.strConclussion);
                db.AddInParameter(dbCommand, "@strRecommendation", DbType.String, objAssignmentVisit.strRecommendation);
                db.AddInParameter(dbCommand, "@dtmDateVisit", DbType.Date, objAssignmentVisit.dtmDateVisit);

                log4net.ILog logger1 = log4net.LogManager.GetLogger("File");
                try
                {
                    db.ExecuteNonQuery(dbCommand);
                }
                catch (Exception ex)
                {
                    logger1.Info(ex.Message);
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#3
0
        public void UpdateClientVisitMinutes(ClientVisitMinutes objClientVisitMinutes)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                Database  db        = DBConnectionHandler.GetDBConnection().DBConnection;
                DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.ClientVisitMinutes.SPNames.UPDATE_ClientVisitMinutes);


                db.AddInParameter(dbCommand, "@strAssignment", DbType.String, objClientVisitMinutes.strAssignment);
                db.AddInParameter(dbCommand, "@strMetWith", DbType.String, objClientVisitMinutes.strMetWith);
                db.AddInParameter(dbCommand, "@strCompletedBy", DbType.String, objClientVisitMinutes.strCompletedBy);

                db.AddInParameter(dbCommand, "@strComplaints", DbType.String, objClientVisitMinutes.strComplaints);
                db.AddInParameter(dbCommand, "@strPositiveComments", DbType.String, objClientVisitMinutes.strPositiveComments);
                db.AddInParameter(dbCommand, "@strDeployment", DbType.String, objClientVisitMinutes.strDeployment);
                db.AddInParameter(dbCommand, "@strEvents", DbType.String, objClientVisitMinutes.strEvents);
                db.AddInParameter(dbCommand, "@strRemarks", DbType.String, objClientVisitMinutes.strRemarks);

                db.AddInParameter(dbCommand, "@dtmDateMet", DbType.Date, objClientVisitMinutes.dtmDateMet);

                log4net.ILog logger1 = log4net.LogManager.GetLogger("File");
                try
                {
                    db.ExecuteNonQuery(dbCommand);
                }
                catch (Exception ex)
                {
                    logger1.Info(ex.Message);
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#4
0
        protected void LoginCheck(string username,string password)
        {
            /*string getuserRole = string.Empty;
            try
            {
                if (!AuthenticateUser())
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Alert", "alert('Invalid User Name or Password');",true);
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Referer", "location.href('index.html');", true);
                }
                else
                {
                    DataTable dt = dal.getdata("select Role from UserInformation Where UserID='" + username.Trim() + "'");
                    Session["user_role"]=Session["role"] = dt.Rows[0][0].ToString();
                    Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER] = username;
                    getuserRole = GetAuthenticateUserRoleAndID();

                    Session["ManagementRole"] = getuserRole.Split(new string[] { "||" }, StringSplitOptions.None)[0];
                    Session["StaffID"] = getuserRole.Split(new string[] { "||" }, StringSplitOptions.None)[1];
                   // Session["LCID"] = "-select-";//int.Parse(ddlLocation.SelectedValue);
                    try
                    {

                        switch (Session["role"].ToString())
                        {
                            case "Security Officer":
                                Response.Redirect("SMSCommons/VerifyLogin.aspx");
                                break;
                            case "Supervisor":
                                Response.Redirect("SMSCommons/VerifyLogin.aspx");
                                break;
                            default:
                                Response.Redirect("SMSCommons/Default.aspx");
                                break;
                        }
                        switch (Session["user_role"].ToString())
                        {

                            case "Security Officer":
                                Session["ManagementRole"] = Session["user_role"];
                                Response.Redirect("VerifyLogin.aspx");
                                break;
                            case "Supervisor":
                                Session["ManagementRole"] = Session["user_role"];
                                Response.Redirect("VerifyLogin.aspx");
                                break;
                            default:
                                Session["ManagementRole"] = Session["user_role"];
                                Response.Redirect("login.aspx");
                                break;
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }*/
            try
            {
                if (!AuthenticateUser())
                {
                    //errorLabel.Text = "Please Enter Valid UserID And Password";
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Alert", "alert('Invalid User Name or Password');", true);
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Referer", "location.href('index.html');", true);
                }
                else
                {

                    string User_Id = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
                    Database db = DBConnectionHandler.GetDBConnection().DBConnection;
                    DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.SPNames.USER_FIRSTNAME);
                    db.AddInParameter(dbCommand, "@UserID", DbType.String, User_Id);
                    IDataReader dr = db.ExecuteReader(dbCommand);
                    if (dr.Read())
                    {
                        Session["user_role"] = dr.GetString(2);
                        Session["StaffID"] = dr.GetString(3);

                    }
                    string xx = Session["user_role"].ToString();
                    switch (Session["user_role"].ToString())
                    {

                        case "Security Officer":
                            Session["ManagementRole"] = Session["user_role"];
                            Response.Redirect("master/VerifyLogin.aspx");
                            break;
                        case "Supervisor":
                            Session["ManagementRole"] = Session["user_role"];
                            Response.Redirect("master/VerifyLogin.aspx");
                            break;
                        default:
                            Session["ManagementRole"] = Session["user_role"];
                            Response.Redirect("master/login.aspx");
                            break;
                    }

                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Header.DataBind();
            if (Session["StaffID1"] != null)
            {
                HiddenFieldID.Value = Session["StaffID1"].ToString();
            }
            if (Request.QueryString["t"] == null)
            {
                if (Session["SubRole"] != null)
                {
                    Session["x"] = Session["SubRole"].ToString();
                }
            }
            #region Dynamically Displaying Logo
            DBConnectionHandler1 bd = new DBConnectionHandler1();
            SqlConnection        cn = bd.getconnection();
            cn.Open();
            SqlCommand    cmd    = new SqlCommand("select ImagePath,fullpathname from UploadLogo", cn);
            SqlDataReader drLogo = cmd.ExecuteReader();
            if (drLogo.Read())
            {
                if (drLogo.GetString(0) != "")
                {
                    imgHeaderLogo.ImageUrl = drLogo.GetString(0);
                    drLogo.Close();
                    cn.Close();
                }
            }
            else
            {
                imgHeaderLogo.ImageUrl = "../img/dsys_header_logo_new.png";
            }
            #endregion

            //-------------------------------------------------------------

            //-----------change by rakesh jaiswal-----------------------
            try
            {
                Session["User_Id"] = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
                string x = (string)Session["User_id"];
                //string User_Id = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
                Database  db        = DBConnectionHandler.GetDBConnection().DBConnection;
                DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.SPNames.USER_FIRSTNAME);
                db.AddInParameter(dbCommand, "@UserID", DbType.String, Session["User_Id"].ToString());
                IDataReader dr = db.ExecuteReader(dbCommand);
                if (dr.Read())
                {
                    if (dr.GetString(0).ToString() != "")
                    {
                        image1.ImageUrl = dr.GetString(0);
                        nameLabel.Text  = dr.GetString(1);
                        Session["role"] = Session["user_role"] = dr.GetString(2);
                    }
                    else
                    {
                        nameLabel.Text  = dr.GetString(1);
                        image1.ImageUrl = "~/Images/avatar.png";
                        //string x1 = dr.GetString(2);
                        Session["role"] = dr.GetString(2);
                        Session["role"] = Session["user_role"] = dr.GetString(2);
                    }
                }
                //=============================//
                dr.Close();
                dr.Dispose();
                //=========================//
            }
            catch (Exception exc)
            {
                image1.ImageUrl = "~/Images/avatar.png";
            }
            //-----------end of change-----------------------------------------------------


            //--------------------------------------------------------------------------
            if (Session["SubRole"] == null)
            {
                if (Session["user_role"].ToString().ToLower() == "superuser")
                {
                }
                else
                {
                    Session["x2"] = Session["user_role"].ToString();
                }
            }
        }
示例#6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //------change by rakesh------------------
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                if (!AuthenticateUser())
                {
                    Labelerror.Text = "Please Enter Valid UserID And Password";
                }
                else
                {
                    string    User_Id   = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
                    Database  db        = DBConnectionHandler.GetDBConnection().DBConnection;
                    DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.SPNames.USER_FIRSTNAME);
                    db.AddInParameter(dbCommand, "@UserID", DbType.String, User_Id);
                    IDataReader dr = db.ExecuteReader(dbCommand);
                    if (dr.Read())
                    {
                        Session["user_role"]     = dr.GetString(2);
                        Session["StaffID"]       = dr.GetString(3);
                        Session["StaffID1"]      = dr.GetString(3);
                        Session["NricNoOfStaff"] = dr.GetString(4);
                    }
                    dr.Close();
                    dr.Dispose();

                    //-----Alert Code start-----//
                    SqlParameter[] para1 = new SqlParameter[2];
                    para1[0]       = new SqlParameter("@Staff_ID", SqlDbType.VarChar);
                    para1[0].Value = Session["StaffID"].ToString();
                    para1[1]       = new SqlParameter("@ActiveStatus", SqlDbType.VarChar);
                    para1[1].Value = "1";


                    dal.exeprocedure("SP_UpdateuserinformationActiveStatus", para1);
                    //-----Alert Code End-----//

                    string xx = Session["user_role"].ToString();
                    switch (Session["user_role"].ToString())
                    {
                    case "Security Officer":
                        Session["ManagementRole"] = Session["user_role"];
                        int roleid = User_Role_Id("Security Officer");
                        Session["RoleID"] = roleid;
                        // Response.Redirect("VerifyLogin.aspx");
                        ModalPopupVerify.Show();
                        populatecontrol();
                        break;

                    case "Supervisor":
                        Session["ManagementRole"] = Session["user_role"];
                        int roleid2 = User_Role_Id("Supervisor");
                        Session["RoleID"] = roleid2;
                        //Response.Redirect("VerifyLogin.aspx");
                        ModalPopupVerify.Show();
                        populatecontrol();
                        break;

                    default:
                        Session["ManagementRole"] = Session["user_role"];
                        Response.Redirect("login.aspx");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Info("Error:" + ex.Message);
                Response.Write(ex.Message);
            }
            //-----end of change----------------------
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            rd  = (RadMenu)rdDBMenu;
            rd1 = (RadMenu)rdDBMenu;
            if (Request.QueryString["t"] == null)
            {
                if (Session["SubRole"] != null)
                {
                    //nameLabel.Text = Session["SubRole"].ToString();
                    //int User_Role = Convert.ToInt32(User_Role_Id(Session["SubRole"]));
                    Session["x"] = Session["SubRole"].ToString();
                    //string x = Session["SubRole"].ToString();
                    if (Convert.ToInt32(Session["count"]) == 1)
                    {
                        MenuBind(User_Role_Id(Session["x"].ToString()));
                    }
                    if (Convert.ToInt32(Session["count1"]) == 1)
                    {
                        MenuBind(User_Role_Id(Session["x"].ToString()));
                    }
                    if (Convert.ToInt32(Session["count2"]) == 1)
                    {
                        MenuBind(User_Role_Id(Session["x"].ToString()));
                    }
                    if (Convert.ToInt32(Session["count3"]) == 1)
                    {
                        MenuBind(User_Role_Id(Session["x"].ToString()));
                    }
                }
            }


            //-------------------------------------------------------------

            //-----------change by rakesh jaiswal-----------------------
            try
            {
                Session["User_Id"] = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
                string x = (string)Session["User_id"];
                //string User_Id = Session[SMSAppUtilities.SessionKeys.SESSION_LOGIN_USER_ID].ToString();
                Database  db        = DBConnectionHandler.GetDBConnection().DBConnection;
                DbCommand dbCommand = db.GetStoredProcCommand(DALConstants.SPNames.USER_FIRSTNAME);
                db.AddInParameter(dbCommand, "@UserID", DbType.String, Session["User_Id"].ToString());
                IDataReader dr = db.ExecuteReader(dbCommand);
                if (dr.Read())
                {
                    if (dr.GetString(0).ToString() != "")
                    {
                        image1.ImageUrl = dr.GetString(0);
                        nameLabel.Text  = dr.GetString(1);
                        Session["role"] = Session["user_role"] = dr.GetString(2);
                    }
                    else
                    {
                        nameLabel.Text  = dr.GetString(1);
                        image1.ImageUrl = "~/Images/avatar.png";
                        //string x1 = dr.GetString(2);
                        Session["role"] = dr.GetString(2);
                        Session["role"] = Session["user_role"] = dr.GetString(2);
                    }
                }
                //=============================//
                dr.Close();
                dr.Dispose();
                //=========================//
            }
            catch (Exception exc)
            {
                image1.ImageUrl = "~/Images/avatar.png";
            }
            //-----------end of change-----------------------------------------------------


            //--------------------------------------------------------------------------
            if (Session["SubRole"] == null)
            {
                if (Session["user_role"].ToString().ToLower() == "superuser")
                {
                }
                else
                {
                    Session["x2"] = Session["user_role"].ToString();
                    MenuBind(User_Role_Id(Session["x2"].ToString()));
                }
            }
        }