private void reLoadSession() { if (Session["userType"] == null || Session["aGENT"] != null || Session["lOCATION"] != null) { USERINFO userInfo = new USERINFO(); userInfo = USERINFOManager.GetUSERINFOByUserNameType("Agent", User.Identity.Name);//"Agent" is dami in database i have not use the if (userInfo != null) { Session["userType"] = userInfo.Type.ToString(); Session["userInfoID"] = userInfo.USERINFOID.ToString(); Session["userName"] = userInfo.UserName.ToString(); //if (userInfo.Agent_LocationID.ToString() == ddlAgent.SelectedItem.Value.ToString()) if (userInfo.Type == "Agent") { Session["aGENT"] = AGENTManager.GetAGENTByID(userInfo.Agent_LocationID); Session["role"] = "Agent"; } else if (userInfo.Type == "Location") { Session["lOCATION"] = LOCATIONGROUPManager.GetLOCATIONGROUPByID(userInfo.Agent_LocationID); Session["role"] = "Location"; } } } }
protected void OnAuthenticate(object sender, AuthenticateEventArgs e) { lblMessage.Text = ""; e.Authenticated = false; Login masterLogin = (Login)masterview.FindControl("masterLogin"); string userName = masterLogin.UserName.ToString(); string password = masterLogin.Password.ToString(); //if (Membership.ValidateUser(userName, password) && (userName.Equals("admin"))) //{ // masterLogin.DestinationPageUrl = "Default.aspx"; // Session["role"] = "Admin"; // e.Authenticated = true; //} //else //{ if (Membership.ValidateUser(userName, password)) { USERINFO userInfo = new USERINFO(); userInfo = USERINFOManager.GetUSERINFOByUserNameType("Agent", userName);//"Agent" is dami in database i have not use the if (userInfo != null) { Session["userType"] = userInfo.Type.ToString(); Session["userInfoID"] = userInfo.USERINFOID.ToString(); Session["userName"] = userInfo.UserName.ToString(); e.Authenticated = true; //if (userInfo.Agent_LocationID.ToString() == ddlAgent.SelectedItem.Value.ToString()) if (userInfo.Type == "Agent") { Session["aGENT"] = AGENTManager.GetAGENTByID(userInfo.Agent_LocationID); Session["role"] = "Agent"; } else if (userInfo.Type == "Location") { Session["lOCATION"] = LOCATIONGROUPManager.GetLOCATIONGROUPByID(userInfo.Agent_LocationID); Session["role"] = "Location"; } //Response.Redirect("Default.aspx"); masterLogin.DestinationPageUrl = "~/Default.aspx"; } else { lblMessage.Text = "Password incorrect!!!"; } } else { //Response.Redirect("~/Forgetpassword.aspx"); } //} }
protected void btnDelete_Click(object sender, EventArgs e) { lblMessage.Text = ""; int userUnfoID = 0; userUnfoID = selecetedGridRow(); bool result = USERINFOManager.DeleteUSERINFO(userUnfoID); GetUserInfo(); lblMessage.Text = "Delete Successfully"; }
private void InsertUserInfo() { try { USERINFO uSERINFO = new USERINFO(); uSERINFO.AddedDate = DateTime.Now; uSERINFO.AddedBy = User.Identity.Name.ToString(); uSERINFO.ModifyDate = DateTime.Now; uSERINFO.ModifyBy = User.Identity.Name.ToString(); uSERINFO.Type = ddlUserType.SelectedItem.Value.ToString(); uSERINFO.UserName = txtUserName.Text; uSERINFO.Agent_LocationID = Int32.Parse(ddlAgent_Location.SelectedValue); uSERINFO.FirstName = txtFirstName.Text; uSERINFO.LastName = txtLastName.Text; uSERINFO.MiddleName = txtMiddleName.Text; uSERINFO.Address = txtAddress.Text; uSERINFO.City = txtCity.Text; uSERINFO.State = txtState.Text; uSERINFO.Country = txtCountry.Text; uSERINFO.PostalCode = txtPostalCode.Text; uSERINFO.ExpDate = DateTime.Now; uSERINFO.Status = 1; uSERINFO.HomePhone = txtHomePhone.Text; uSERINFO.WorkPhone = txtWorkPhone.Text; uSERINFO.Mobile = txtMobile.Text; uSERINFO.Comm = ""; int resutl = USERINFOManager.InsertUSERINFO(uSERINFO); if (resutl > 0) { lblregistrationError.Text = "Successfully Submited!!!! <br/><b>User Name:</b> " + txtUserName.Text + "<br/><b>Password:</b>" + txtPassword.Text + "<br/><b>Email: </b><a href='mailto:" + txtEmail.Text + "?body=Login page: http://abimatu.net/ USER NAME: (" + txtUserName.Text + ") PASSWORD: (" + txtPassword.Text + ")&subject=Password for KOROMSTAR ENTERPRISE'>" + txtEmail.Text + "</a><br/>(Click on the mail address to send mail)"; lblregistrationError.ForeColor = System.Drawing.Color.Green; ClearData(); } } catch (Exception ex) { lblregistrationError.Text = ex.Message; } }
private void showUSERINFOData() { int userInfoID = 0; userInfoID = selecetedGridRow(); USERINFO uSERINFO = new USERINFO(); uSERINFO = USERINFOManager.GetUSERINFOByID(userInfoID); lblUserInfoID.Text = userInfoID.ToString(); txtUserName.Text = uSERINFO.UserName; ddlAgent_Location.SelectedValue = uSERINFO.Agent_LocationID.ToString(); txtFirstName.Text = uSERINFO.FirstName; txtLastName.Text = uSERINFO.LastName; txtMiddleName.Text = uSERINFO.MiddleName; txtAddress.Text = uSERINFO.Address; txtCity.Text = uSERINFO.City; txtState.Text = uSERINFO.State; txtCountry.Text = uSERINFO.Country; txtPostalCode.Text = uSERINFO.PostalCode; txtHomePhone.Text = uSERINFO.HomePhone; txtWorkPhone.Text = uSERINFO.WorkPhone; txtMobile.Text = uSERINFO.Mobile; ddlUserType.SelectedValue = uSERINFO.Type.ToString(); MembershipUser mu = Membership.GetUser(uSERINFO.UserName); if (mu != null) { lblPassword.Text = mu.GetPassword().ToString(); txtEmail.Text = mu.Email.ToString(); chkActive.Checked = !mu.IsLockedOut; } }
public void GetUserInfo() { gvUSERINFO.DataSource = USERINFOManager.GetAllUSERINFOsByType(ddlUserType.SelectedItem.Value.ToString()); gvUSERINFO.DataBind(); }
protected void UpdateUserInfo() { int userInfoID = 0; userInfoID = selecetedGridRow(); USERINFO uSERINFO = new USERINFO(); uSERINFO = USERINFOManager.GetUSERINFOByID(userInfoID); USERINFO tempUSERINFO = new USERINFO(); tempUSERINFO.USERINFOID = uSERINFO.USERINFOID; tempUSERINFO.AddedDate = uSERINFO.AddedDate; tempUSERINFO.AddedBy = User.Identity.Name.ToString(); tempUSERINFO.ModifyDate = DateTime.Now; tempUSERINFO.ModifyBy = User.Identity.Name.ToString(); tempUSERINFO.Type = ddlUserType.SelectedItem.Value.ToString(); tempUSERINFO.UserName = uSERINFO.UserName; tempUSERINFO.Agent_LocationID = Int32.Parse(ddlAgent_Location.SelectedValue); tempUSERINFO.FirstName = txtFirstName.Text; tempUSERINFO.LastName = txtLastName.Text; tempUSERINFO.MiddleName = txtMiddleName.Text; tempUSERINFO.Address = txtAddress.Text; tempUSERINFO.City = txtCity.Text; tempUSERINFO.State = txtState.Text; tempUSERINFO.Country = txtCountry.Text; tempUSERINFO.PostalCode = txtPostalCode.Text; tempUSERINFO.ExpDate = DateTime.Now; tempUSERINFO.Status = 1; tempUSERINFO.HomePhone = txtHomePhone.Text; tempUSERINFO.WorkPhone = txtWorkPhone.Text; tempUSERINFO.Mobile = txtMobile.Text; tempUSERINFO.Comm = ""; bool result = USERINFOManager.UpdateUSERINFO(tempUSERINFO); MembershipUser mu = Membership.GetUser(uSERINFO.UserName); if (mu != null) { if (txtPassword.Text == "" && txtConfirmPassword.Text == "") { } else { if (lblPassword.Text != "") { mu.ChangePassword(lblPassword.Text, txtPassword.Text); } } mu.Email = txtEmail.Text; Membership.UpdateUser(mu); MSSQL.SQLExec("update aspnet_Membership set IsLockedOut=" + (chkActive.Checked ? "0" : "1") + " where UserId=(SELECT [UserId] FROM [aspnet_Users] where [UserName]='" + mu.UserName + "')"); } }