protected void btnSubmit_Click(object sender, System.EventArgs e) { user = new DMXUser(); if (EmployeeID > 0) { user.Find(EmployeeID); } user.UserType = (Database.EmployeeType)int.Parse(lstEmployeeType.SelectedValue); user.UserName = this.txtUserName.Text; user.Password = this.txtPassword.Text; user.FirstName = this.txtFirstName.Text; user.LastName = this.txtLastName.Text; user.Address = this.txtAddress.Text; user.Phone = this.txtPhone.Text; user.Email = this.txtEmail.Text; if (int.Parse(lstEmployeeType.SelectedValue) != (int)Database.EmployeeType.Administrator) { user.Region = lstRegion.SelectedValue; user.Area = lstArea.SelectedValue; user.LSO = lstLSO.SelectedValue; if (int.Parse(lstEmployeeType.SelectedValue) == (int)Database.EmployeeType.Sales) { if (lstManagers.SelectedValue != "") { user.SalesManagerID = int.Parse(lstManagers.SelectedValue); } } } user.Save(); lblMessage.Text = "Changes Saved."; lblMessage.Visible = true; }
public static DataTable SendNotificationQueue() { Database data = new Database(); DataTable dt = data.GetNotificationQueue(); string msgBody = ""; int intRecipientID = -1; int intEmployeeID = -1; ArrayList Messages = new ArrayList(); AuthenticatedMail msg = null; DMXUser user = new DMXUser(); SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer"]; foreach (DataRow row in dt.Rows) { if (intRecipientID != Convert.ToInt32(row["intRecipientID"])) { if (msg !=null) { msg.Body = msgBody; Messages.Add(msg); SmtpMail.Send(msg); } intRecipientID = Convert.ToInt32(row["intRecipientID"]); msg = new AuthenticatedMail(); msg.BodyFormat = MailFormat.Html; user.Find(intRecipientID); if ((string)ConfigurationSettings.AppSettings["TestingServer"] == "true") { msg.To = "*****@*****.**"; // FOR TESTING } else { msg.To = user.Email; //msg.Bcc = "*****@*****.**"; // FOR TESTING } msg.From = ConfigurationSettings.AppSettings["SystemEmail"]; msg.Subject = "Top 25 Account Updates"; msgBody += user.FullName + ",\n\nThe following changes have been made:\n\n<pre>\n"; } intEmployeeID = Convert.ToInt32(row["intEmployeeID"]); user.Find(intEmployeeID); msgBody += Convert.ToString(row["strAction"]) + ":\t" + Convert.ToString(row["strAccountName"]) + " - " + user.FullName + ", " + Convert.ToDateTime(row["dtmCreated"]).ToString("M-d-yy, h:mm") + "\n"; row["dtmSent"] = DateTime.Now; } // if (msg !=null) // { // msg.Body = msgBody + "</pre>\n\n<a href=\"http://www.top25hpa.com\">Log in to Top25HPA.com</a> \n\n"; // Messages.Add(msg); // SmtpMail.Send(msg); // } // dt.AcceptChanges(); data.UpdateNotificationQueue(dt); data.Close(); data.Dispose(); return dt; }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // Extract the forms authentication cookie string cookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = Context.Request.Cookies[cookieName]; if (authCookie != null) { authCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(authCookie); } Session.Abandon(); } else { DMXUser user = new DMXUser(); // User = new GenericPrincipal( if ((user.Find(txtUserName.Text))&&(user.Active)) { if(user.Password == txtPassword.Text) { // Create the authentication ticket FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, // version txtUserName.Text, // user name DateTime.Now, // creation DateTime.Now.AddMinutes(60), // Expiration false, //Persistent user.ToXml() ); // Userdata // Now encrypt the ticket. string encryptedTicket = FormsAuthentication.Encrypt(authTicket); // Create a cookie and add the encrypted ticket to the // cookie as data. HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); // Add the cookie to the outgoing cookies collection. Response.Cookies.Add(authCookie); // this is a temp fix for old ASP security Session.Add("EmployeeID", user.EmployeeID); // Response.Redirect("Top25Report.aspx"); Response.Redirect(user.HomePage + "?intEmpID=" + user.EmployeeID + "&strLName=" + user.LastName + "&strFName=" + user.FirstName); } else { Message.Text = "Password invalid."; Message.Visible = true; } } else { Message.Text = "User not found."; Message.Visible = true; } } }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); if (!IsPostBack) { LoadMenu(lstRegion); LoadMenu(lstArea); LoadMenu(lstLSO); LoadMenu(lstEmployeeType); LoadMenu(lstManagers); if ((Request["intEmpID"] != null)&&(Request["intEmpID"] != "")) { EmployeeID = int.Parse(Request["intEmpID"]); user = new DMXUser(); user.Find(EmployeeID); LoadEmployeeInfo(user); } else { this.lstEmployeeType.SelectedValue = ((int)Database.EmployeeType.Sales).ToString(); } } switch (Convert.ToInt16(lstEmployeeType.SelectedValue)) { case (short)Database.EmployeeType.Administrator: rwRegion.Visible = false; rwArea.Visible = false; rwLSO.Visible = false; rwManager.Visible = false; break; case (short)Database.EmployeeType.Sales: rwRegion.Visible = true; rwArea.Visible = true; rwLSO.Visible = true; rwManager.Visible = true; break; default: rwRegion.Visible = true; rwArea.Visible = true; rwLSO.Visible = true; rwManager.Visible = false; break; } }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); if(!IsPostBack) { if ((Request["eid"] != null)&&(Request["eid"] != "")) { EmployeeID = Convert.ToInt32(Request["eid"]); } ReportMonth = Convert.ToDateTime(Request["month"]); Approved = Convert.ToBoolean(Request["approved"]); DMXUser user = new DMXUser(); user.Find(EmployeeID); lblName.Text = user.FullName; LoadData(); if (User.IsInRole(Database.EmployeeType.Executive.ToString())) { lnkHome.Text = "Return to Top 25 Summary"; lnkHome.NavigateUrl = "top25Report.aspx"; } } if (User.IsInRole(Database.EmployeeType.SalesManager.ToString())) { lnkHome.Text = "Return to Top 25 Approval"; lnkHome.NavigateUrl = "top25forecast.aspx?eid=" + EmployeeID.ToString() + "&approved=" + Approved.ToString() + "&month=" + ReportMonth.ToString(); } }