public void BindRole() { try { objRole = new Role(); lstRole = new List<Role>(); lstRole = objBL_Role.SelectRoleall(Convert.ToInt32(Session["CompanyID"].ToString())); if (lstRole.Count > 0) { //ddlrole.DataBind(); foreach (var items in lstRole) { ddlrole.DataValueField = "PK_RoleID"; ddlrole.DataTextField = "RoleName"; } ddlrole.DataSource = lstRole; ddlrole.DataBind(); } ddlrole.Items.Insert(0, "-- Select --"); } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("RoleSettings.aspx:BindRole() - " + ex.Message); } }
public void Bindrolegrid() { objRole = new Role(); if (Convert.ToInt16(Session["Usertype"].ToString()) == 1) { lstRole = objBL_Role.SelectRoleall(Convert.ToInt32(Session["CompanyID"].ToString())); gvcampaign.DataSource = lstRole; gvcampaign.DataBind(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { objRole = new Role(); lstRole = new List<Role>(); if(Chkcmpcreate.Checked == true) objRole.CampaignCreate = true; else objRole.CampaignCreate = false; if(Chksendcmp.Checked == true) objRole.MailSend = true; else objRole.MailSend = false; if(Chkusr.Checked == true) objRole.CreateUser = true; else objRole.CreateUser = false; if(Chkcmpdelete.Checked == true) objRole.CampaignDelete = true; else objRole.CampaignDelete = false; if(Chkvwreports.Checked == true) objRole.ViewingReports = true; else objRole.ViewingReports = false; //objRole.TemplateView if (Chklstexports.Checked == true) objRole.ListExports = true; else objRole.ListExports = false; objBL_Common.AccessUpdateAllCampaign("EC_Role", "CampaignCreate= '" + objRole.CampaignCreate + "', MailSend = '" + objRole.MailSend + "', CreateUser = '******', CampaignDelete = '" + objRole.CampaignDelete + "', ViewingReports = '" + objRole.ViewingReports + "',ListExports = '" + objRole.ListExports + "' ", "PK_RoleID =" + Convert.ToInt32(ddlrole.SelectedValue) + ""); Label1.Text = "Information Successfully Saved."; Label1.CssClass = "alert alert-success"; } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("RoleSettings.aspx:btnSubmit_Click() - " + ex.Message); Label1.Text = "Failed while saving the information."; Label1.CssClass = "alert alert-danger"; } }
public void RetrieveRole() { try { msg = ""; objRole = new Role(); objBL_Role = new BL_Role(); lstRole = objBL_Role.SelectRoleforcampid(Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["roleId"]).ToString())); if (lstRole.Count > 0) txtRoleName.Value = lstRole[0].RoleName; } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("RoleDetails.aspx:RetrieveRole() - " + ex.Message); } }
public void roledetails() { objRole = new Role(); lstRole = new List<Role>(); try { lstRole = objBL_Role.SelectRoleforcampid(Convert.ToInt32(Session["RoleID"].ToString())); if (lstRole.Count > 0) { foreach (var items in lstRole) { if (items.MailSend == true) Session["cmpsend"] = 1; if (items.CreateUser == true) Session["crtusr"] = 1; if (items.CampaignDelete == true) Session["cmpdelete"] = 1; if (items.ViewingReports == true) Session["vewrpts"] = 1; if (items.ListExports == true) Session["lstexprts"] = 1; if (items.CampaignCreate == true) Session["cmpcrte"] = 1; } } } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("UserLogin.aspx:roledetails() - " + ex.Message); } }
protected void ddlrole_SelectedIndexChanged(object sender, EventArgs e) { try { Label1.Text = ""; Label1.CssClass = ""; if (Convert.ToInt32(ddlrole.SelectedValue) != 0) { objRole = new Role(); lstRole = new List<Role>(); lstRole = objBL_Role.SelectRolealldropdownselection(Convert.ToInt32(ddlrole.SelectedValue), Convert.ToInt32(Session["CompanyID"].ToString())); if (lstRole.Count > 0) { //ddlrole.DataBind(); foreach (var items in lstRole) { if (items.MailSend == true) Chksendcmp.Checked = true; else Chksendcmp.Checked = false; if (items.CreateUser == true) Chkusr.Checked = true; else Chkusr.Checked = false; if (items.CampaignDelete == true) Chkcmpdelete.Checked = true; else Chkcmpdelete.Checked = false; if (items.ViewingReports == true) Chkvwreports.Checked = true; else Chkvwreports.Checked = false; if (items.ListExports == true) Chklstexports.Checked = true; else Chklstexports.Checked = false; if (items.CampaignCreate == true) Chkcmpcreate.Checked = true; else Chkcmpcreate.Checked = false; //if (items.TemplateView == true) // Chkusr.Checked = true; } } } } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("RoleSettings.aspx:BindRole() - " + ex.Message); } }
protected void Button1_Click(object sender, EventArgs e) { try { if (txtRoleName.Value != string.Empty) { objRole = new Role(); lstRole = new List<Role>(); objRole.RoleName = txtRoleName.Value.ToString().Trim(); objRole.FK_CompanyID = Convert.ToInt32(Session["CompanyID"].ToString()); if (Request.QueryString["roleId"] != null) { objRole.PK_RoleID = Convert.ToInt32(Request.QueryString["roleId"].ToString()); objRole.UpdatedBy = Convert.ToInt32(Session["UserID"].ToString()); objRole.UpdatedOn = DateTime.Now; lstRole = objBL_Role.SelectRoleforcampid(Convert.ToInt32(Request.QueryString["roleId"].ToString())); if (lstRole.Count > 0) { objRole.FK_CompanyID = lstRole[0].FK_CompanyID; objRole.CampaignCreate = lstRole[0].CampaignCreate; objRole.MailSend = lstRole[0].MailSend; objRole.CreateUser = lstRole[0].CreateUser; objRole.CampaignDelete = lstRole[0].CampaignDelete; objRole.ViewingReports = lstRole[0].ViewingReports; objRole.TemplateView = lstRole[0].TemplateView; if (lstRole[0].CreatedOn != null) objRole.CreatedOn = lstRole[0].CreatedOn; if (lstRole[0].CreatedBy != null) objRole.CreatedBy = lstRole[0].CreatedBy; } objBL_Role.AccessUpdateRole(objRole); txtRoleName.Value = string.Empty; } else { objRole.CreatedOn = DateTime.Now; objRole.CreatedBy = Convert.ToInt32(Session["UserID"].ToString()); objBL_Role.AccessInsertRole(objRole); txtRoleName.Value = string.Empty; } Bindrolegrid(); msg = "1"; Response.Redirect("RoleDetails.aspx"); } else { msg = ""; Label1.Text = "The role name should not be empty!"; Label1.CssClass = "alert alert-danger"; } } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("RoleDetails.aspx:btnSubmit_Click() - " + ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { HttpCookie myCookie = new HttpCookie("myCookie"); bool IsRemember = chkRememberme.Checked; lstUserDetails = new List<UserDetails>(); lstUserDetails = objBL_UserLoginDetails.SelectUserDetailsforLogin(txtUsername.Value.ToString(), txtpassword.Value.ToString()); if (lstUserDetails.Count > 0) { if (lstUserDetails[0].AccountActivated == true) { if (IsRemember) { myCookie.Values.Add("username", txtUsername.Value); myCookie.Values.Add("password", objCryptographicHashCode.EncryptPlainTextToCipherText(txtpassword.Value)); myCookie.Expires = DateTime.Now.AddDays(15); Response.Cookies.Add(myCookie); } else { myCookie.Values.Add("username", string.Empty); myCookie.Values.Add("password", string.Empty); myCookie.Expires = DateTime.Now.AddMinutes(5); Response.Cookies.Add(myCookie); } Session["UserID"] = lstUserDetails[0].PK_UserID; Session["Usertype"] = lstUserDetails[0].UserType; Session["CompanyID"] = lstUserDetails[0].FK_CompanyID; if (lstUserDetails[0].FirstName == "" && lstUserDetails[0].LastName == "") Session["UserName"] = lstUserDetails[0].UserName; else Session["UserName"] = lstUserDetails[0].FirstName + " " + lstUserDetails[0].LastName; if (Session["CompanyID"].ToString() != "") Session["CompanyName"] = objBL_Common.IsValidUser("Company_Name", "EC_Company", "PK_CompanyID =" + Convert.ToInt32(Session["CompanyID"].ToString()) + ""); else Session["CompanyName"] = "-"; if (Convert.ToInt64(Session["Usertype"].ToString()) == 10) { Response.Redirect("UserPlanTypeDetails.aspx", false); return; } if (lstUserDetails[0].FK_RoleID != null) Session["RoleID"] = lstUserDetails[0].FK_RoleID; if (lstUserDetails[0].UserType == 1) { if (lstUserDetails[0].FK_RoleID == null) { objRole = new Role(); objRole.RoleName = "Admin"; objRole.CampaignCreate = true; objRole.FK_CompanyID = Convert.ToInt32(Session["CompanyID"].ToString()); objRole.MailSend = true; objRole.CreateUser = true; objRole.CampaignDelete = true; objRole.ViewingReports = true; objRole.TemplateView = true; objRole.ListExports = true; objRole.CreatedOn = DateTime.Now; objRole.CreatedBy = Convert.ToInt32(Session["UserID"].ToString()); string pkcqid = objBL_Role.AccessInsertRole(objRole); if (pkcqid != "") { Session["RoleID"] = Convert.ToInt32(pkcqid); objBL_Common = new BL_Common(); objBL_Common.AccessUpdateAllCampaign("EC_UserLogin", "FK_RoleID = '" + Convert.ToInt32(pkcqid) + "'", "PK_UserID =" + Convert.ToInt32(Session["UserID"].ToString()) + ""); objBL_Common = null; } } } objBL_UserPlan = new BL_UserPlan(); lstUserPlan = new List<UserPlan>(); lstUserPlan = objBL_UserPlan.GetUserPlanBasedonCompanyID(Convert.ToInt32(Session["CompanyID"].ToString())); if (lstUserPlan.Count <= 0) { InsertUserPlan(Convert.ToInt32(Session["UserID"].ToString())); Response.Redirect("Dashboard.aspx", false); } else { Response.Redirect("Dashboard.aspx", false); DataTable dtplantype = new DataTable(); objBL_Common = new BL_Common(); dtplantype = objBL_Common.plantypedetails("*", "EC_PlanType", "PK_PlanID = " + Convert.ToInt32(lstUserPlan[0].FK_PlanID.ToString()) + " and IsActive = 1 order by plandate desc"); string[] UPtype = new string[3]; UPtype[0] = Convert.ToString(dtplantype.Rows[0]["IsSingleUser"]); UPtype[1] = Convert.ToString(dtplantype.Rows[0]["NOC"]); UPtype[2] = Convert.ToString(dtplantype.Rows[0]["AllowedMails"]); Session["lstUserPlanType"] = UPtype; } if (lstUserDetails[0].Email_id != null) Session["AdminEmilid"] = lstUserDetails[0].Email_id; if (lstUserDetails[0].FK_RoleID != 0) roledetails(); } else lblerrormsg.Text = "<span style='color:#c85305;font-size:11.5px;'>You have to activate your account from mail sent. Then only you can access your account.</span>"; } else lblerrormsg.Text = "<span style='color:#c85305;font-size:11.5px;'>That account doesn't exist. Enter a different account detail or </span> <a href='FreeAccountSignUp.aspx' style='font-size:11.5px; color: #00acec;'>get a new account</a>"; } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("UserLogin.aspx:btnSubmit_Click() - " + ex.Message); } }