コード例 #1
0
ファイル: Profile.aspx.cs プロジェクト: pranavjoseph12/Relks
        protected void Page_Load(object sender, EventArgs e)
        {
            RolesBusinessActions objRole = new RolesBusinessActions();
            UserModel            objUser = new UserModel();

            if (Session["User"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            objUser = (UserModel)Session["User"];
            if (!objUser.IsValidUser)
            {
                Response.Redirect("Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                UserBusinessActions obj = new UserBusinessActions();
                var result = obj.GetUserDetailsById(objUser.UserId);
                if (result != null && result.Rows.Count > 0)
                {
                    txtName.Text     = result.Rows[0]["Name"].ToString();
                    txtEmail.Text    = result.Rows[0]["Email"].ToString();
                    txtPhone.Text    = result.Rows[0]["Mobile"].ToString();
                    txtPassword.Text = result.Rows[0]["Password"].ToString();
                    lblRole.Text     = result.Rows[0]["RoleName"].ToString();
                }
            }
        }
コード例 #2
0
        public string GetAllUsersForAssignment()
        {
            UserBusinessActions obj = new UserBusinessActions();
            var result = obj.GetAllUsersForAssignment();
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
コード例 #3
0
        public string GetUserDetails(string userId)
        {
            UserBusinessActions obj = new UserBusinessActions();
            var result = obj.GetUserDetails(Convert.ToInt32(userId));
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
コード例 #4
0
        public string DeleteUser(string userId)
        {
            UserModel objUser = new UserModel();
            int       loginId = 0;

            if (HttpContext.Current.Session["User"] != null)
            {
                objUser = (UserModel)Session["User"];
                loginId = objUser.UserId;
            }

            UserBusinessActions obj = new UserBusinessActions();
            var result = obj.DeleteUser(userId, loginId);
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
コード例 #5
0
        public string AddUser(string name, string phone, string email, string password, string role, string allowAssignTask, string centerValue)
        {
            UserModel objUser = new UserModel();
            string    userID  = string.Empty;

            if (HttpContext.Current.Session["User"] != null)
            {
                objUser = (UserModel)Session["User"];
                userID  = objUser.UserId.ToString();
            }

            UserBusinessActions obj = new UserBusinessActions();
            var result = obj.AddUser(name, phone, email, password, role, userID, allowAssignTask, centerValue);
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
コード例 #6
0
ファイル: Profile.aspx.cs プロジェクト: pranavjoseph12/Relks
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            UserModel objUser = new UserModel();

            objUser = (UserModel)Session["User"];
            if (!objUser.IsValidUser)
            {
                Response.Redirect("Login.aspx");
            }
            UserBusinessActions obj = new UserBusinessActions();

            var result = obj.UpdateUserDetailsById(objUser.UserId, txtName.Text, txtEmail.Text, txtPhone.Text, txtPassword.Text);

            if (result == true)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SuccessRedirect", "alert('Profile Updated Successfully.');", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorRedirect", "alert('Something Went wrong. Please try again later');", true);
            }
        }