private void FillForm() { if (string.IsNullOrEmpty(UICommon.GetCurrentUserID().ToString())) { return; } String UserNo = UICommon.GetCurrentUserID().ToString(); DataTable dt = default(DataTable); Mode = "SelectUser"; dt = ObjclsFrms.loadList(Mode, "sp_User", UserNo); UserProfile userProfile = DALHelper.GetUsers(userCriteria => userCriteria.UserId == new Guid(dt.Rows[0]["UserId"].ToString())).First(); this.txtEmail.Text = userProfile.UserName; this.txtContactInfo.Text = userProfile.ContacInfo; this.txtFirstName.Text = userProfile.FirstName; this.txtLastName.Text = userProfile.LastName; MembershipUser user = Membership.GetUser(this.txtEmail.Text); //this.chkActive.Checked = user.IsApproved; this.txtEmail.Enabled = false; this.txtContactInfo.Enabled = false; this.txtFirstName.Enabled = false; this.txtLastName.Enabled = false; }
protected void btnSave_Click(object sender, EventArgs e) { try { UserProfile userProfile = new UserProfile(); MembershipUser user; string password = Membership.GeneratePassword(8, 1); if (!string.IsNullOrEmpty(Request.Params["Id"])) { userProfile = DALHelper.GetUsers(userCriteria => userCriteria.UserId == new Guid(Request.Params["id"])).First(); user = Membership.GetUser(this.txtEmail.Text); } else { if (Membership.GetUser(this.txtEmail.Text) != null) { this.ltrlMessage.Text = UICommon.GetErrorMessage("User already exists"); //System.Windows.Forms.MessageBox.Show("User already exists", "Add Edit User"); return; } //string password = "******"; user = Membership.CreateUser(this.txtEmail.Text, password); userProfile.CreatedDate = DateTime.Now; userProfile.CreatedBy = UICommon.GetCurrentUserID(); } user.IsApproved = this.chkActive.Checked; Membership.UpdateUser(user); userProfile.ModifiedDate = DateTime.Now; userProfile.ModifiedBy = UICommon.GetCurrentUserID(); userProfile.UserId = new Guid(user.ProviderUserKey.ToString()); userProfile.FirstName = this.txtFirstName.Text; userProfile.LastName = this.txtLastName.Text; userProfile.Email = this.txtEmail.Text; userProfile.ContacInfo = this.txtContactInfo.Text; userProfile.CreatedDate = DateTime.Now; userProfile.Active = this.chkActive.Checked; userProfile.UserName = user.UserName; DALHelper.UpdateUserProfile(userProfile); DataTable dtLogin = ObjclsFrms.loadList("SelLoginCredentailsForNAC", "sp_Masters"); if (dtLogin.Rows.Count > 0) { MailService(dtLogin, "BSMEA - Eclaim Account Activation for BSMEA Users", password); } } catch (Exception ex) { UICommon.LogException(ex, "Add Edit User"); String innerMessage = (ex.InnerException != null) ? ex.InnerException.Message : ""; ObjclsFrms.LogMessageToFile(UICommon.GetLogFileName(), "AddEditUser.aspx btnSave_Click()", "Error : " + ex.Message.ToString() + " - " + innerMessage); } Response.Redirect("Users.aspx"); }
protected void Save(string mode) { string user, name, description, category, price, discount, image, highlight, status; name = txtItem.Text.ToString(); description = txtDescription.Text.ToString(); category = ddlCategory.SelectedValue.ToString(); price = txtPrice.Text.ToString(); discount = txtDiscount.Text.ToString(); highlight = ""; status = ddlStatus.SelectedValue.ToString(); user = UICommon.GetCurrentUserID().ToString(); image = ""; if (mode.Equals("I")) { string[] arr = { name.ToString(), description.ToString(), category.ToString(), price.ToString(), discount.ToString(), image.ToString(), highlight.ToString(), status.ToString(), user.ToString() }; DataTable lstClaim = ObjclsFrms.loadList("InsertMenu", "sp_Masters", mode.ToString(), arr); if (lstClaim.Rows.Count > 0) { string claimID = lstClaim.Rows[0]["sliderID"].ToString(); ViewState["claimID"] = claimID.ToString(); } } else { string id = ResponseID.ToString(); string[] arr = { name.ToString(), description.ToString(), category.ToString(), price.ToString(), discount.ToString(), image.ToString(), highlight.ToString(), status.ToString(), user.ToString(), id.ToString() }; string Value = ObjclsFrms.SaveData("sp_Masters", "InsertMenu", mode.ToString(), arr); int res = Int32.Parse(Value.ToString()); if (res > 0) { string claimID = res.ToString(); ViewState["claimID"] = claimID.ToString(); } } string claim = ViewState["claimID"].ToString(); if (claim == "0") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>failedModal();</script>", false); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>successModal();</script>", false); } }
protected void Save(string mode) { string user, name, location, geo, email, phone, address, status; location = txtLocation.Text.ToString(); name = ""; geo = txtGeo.Text.ToString(); email = txtEmail.Text.ToString(); phone = txtMobile.Text.ToString(); address = txtAddress.Text.ToString(); status = ddlStatus.SelectedValue.ToString(); user = UICommon.GetCurrentUserID().ToString(); if (mode.Equals("I")) { string[] arr = { name.ToString(), location.ToString(), geo.ToString(), email.ToString(), phone.ToString(), address.ToString(), status.ToString(), user.ToString() }; DataTable lstClaim = ObjclsFrms.loadList("InsertBranch", "sp_Masters", mode.ToString(), arr); if (lstClaim.Rows.Count > 0) { string claimID = lstClaim.Rows[0]["sliderID"].ToString(); ViewState["claimID"] = claimID.ToString(); } } else { string id = ResponseID.ToString(); string[] arr = { name.ToString(), location.ToString(), geo.ToString(), email.ToString(), phone.ToString(), address.ToString(), status.ToString(), user.ToString(), id.ToString() }; string Value = ObjclsFrms.SaveData("sp_Masters", "InsertBranch", mode.ToString(), arr); int res = Int32.Parse(Value.ToString()); if (res > 0) { string claimID = res.ToString(); ViewState["claimID"] = claimID.ToString(); } } string claim = ViewState["claimID"].ToString(); if (claim == "0") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>failedModal();</script>", false); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>successModal();</script>", false); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(UICommon.GetCurrentUserID().ToString())) { return; } MembershipUser user; user = Membership.GetUser(this.txtEmail.Text); Boolean isSucess = user.ChangePassword(txtOldPassword.Text, txtNewPassword.Text); if (isSucess == true) { String UserNo = UICommon.GetCurrentUserID().ToString(); DataTable dt = default(DataTable); Mode = "SelectUser"; dt = ObjclsFrms.loadList(Mode, "sp_User", UserNo); UserProfile userProfile = DALHelper.GetUsers(userCriteria => userCriteria.UserId == new Guid(dt.Rows[0]["UserId"].ToString())).First(); userProfile.AccessCode = txtNewPassword.Text.ToString(); DALHelper.UpdateUserProfile(userProfile); Response.Redirect("~/Admin/AdminDashboard.aspx"); } else { ltrlMessage.Text = "Error Occured, Please contact system Administrator"; } } catch (Exception ex) { UICommon.LogException(ex, "Add Edit User"); String innerMessage = (ex.InnerException != null) ? ex.InnerException.Message : ""; ObjclsFrms.LogMessageToFile(UICommon.GetLogFileName(), "UpdatePassword.aspx btnSave_Click()", "Error : " + ex.Message.ToString() + " - " + innerMessage); } }
public void LeftCount() { DataTable dt = ObjclsFrms.loadList("LeftNavCount", "sp_Masters", UICommon.GetCurrentUserID().ToString()); Session["count"] = dt; }
protected void Save(string mode) { string user, name, highlight, description, status, image; name = txtName.Text.ToString(); status = ddlStatus.SelectedValue.ToString(); user = UICommon.GetCurrentUserID().ToString(); description = txtDescription.Text.ToString(); highlight = ddlHighLight.SelectedValue.ToString(); image = ""; int ImageID = 0; foreach (UploadedFile uploadedFile in upd1.UploadedFiles) { ImageID += 1; string csvPath = Server.MapPath(("..") + @"/UploadFiles/Gallery/") + ImageID.ToString() + "_" + uploadedFile.FileName; uploadedFile.SaveAs(csvPath); image = @"/UploadFiles/Gallery/" + ImageID.ToString() + "_" + uploadedFile.FileName.ToString(); ViewState["image"] = image.ToString(); } if (image == "") { image = ViewState["LoadedImage"].ToString(); } else { image = ViewState["image"].ToString(); } if (mode.Equals("I")) { string[] arr = { name.ToString(), description.ToString(), image.ToString(), highlight.ToString(), status.ToString(), user.ToString() }; DataTable lstClaim = ObjclsFrms.loadList("InsertGallery", "sp_Masters", mode.ToString(), arr); if (lstClaim.Rows.Count > 0) { string claimID = lstClaim.Rows[0]["sliderID"].ToString(); ViewState["claimID"] = claimID.ToString(); } } else { string id = ResponseID.ToString(); string[] arr = { name.ToString(), description.ToString(), image.ToString(), highlight.ToString(), status.ToString(), user.ToString(), id.ToString() }; string Value = ObjclsFrms.SaveData("sp_Masters", "InsertGallery", mode.ToString(), arr); int res = Int32.Parse(Value.ToString()); if (res > 0) { string claimID = res.ToString(); ViewState["claimID"] = claimID.ToString(); } } string claim = ViewState["claimID"].ToString(); if (claim == "0") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>failedModal();</script>", false); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>successModal();</script>", false); } }