protected void Page_Load(object sender, EventArgs e) { try { System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); if (!String.IsNullOrEmpty(currentUser.DisplayName)) { lblUser.Text = currentUser.DisplayName; } if (currentUser.Status == 1) { if (currentUser.UserRole.RoleName == "ReportsUser" || currentUser.UserRole.RoleName == "ReportsAdmin" || currentUser.UserRole.RoleName == "SuperUser") { miReports.Visible = true; } else { miReports.Visible = false; } if (currentUser.UserRole.RoleName == "SuperUser") { miAdmin.Visible = true; } else { miAdmin.Visible = false; } } else { miForms.Visible = false; miReports.Visible = false; miAdmin.Visible = false; Response.Redirect("/Unauthorized"); } } catch (Exception ex) { } }
protected void btnEditAccountSettings_Click(object sender, EventArgs e) { divSaveCancel.Visible = true; divLabelEdit.Visible = false; ddlUserStatus.Enabled = true; divDisplayNameEdit.Visible = true; txtGreeting.Enabled = true; if (Request.IsAuthenticated) { UserLogic uLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = uLogic.GetCurrentUser(user); if (currentUser != null) { txtDisplayName.Text = currentUser.DisplayName; } } }
protected void fvReport_ItemUpdating(object sender, FormViewUpdateEventArgs e) { if (IsValid) { int id = Convert.ToInt32(((Label)fvReport.FindControl("lblRecordId")).Text); Tingle_WebForms.Models.DirectOrderForm myForm = ctx.DirectOrderForms.FirstOrDefault(eof => eof.RecordId == id); RadDropDownList ddlCompanyEdit = (RadDropDownList)fvReport.FindControl("ddlCompanyEdit"); TextBox txtCustomer = (TextBox)fvReport.FindControl("txtCustomerEdit"); RadDropDownList ddlExpediteCode = (RadDropDownList)fvReport.FindControl("ddlExpediteCodeEdit"); int expediteCodeId = Convert.ToInt32(ddlExpediteCode.SelectedValue); TextBox txtContactName = (TextBox)fvReport.FindControl("txtContactNameEdit"); TextBox txtPhoneNumber = (TextBox)fvReport.FindControl("txtPhoneNumberEdit"); TextBox txtMaterialSku = (TextBox)fvReport.FindControl("txtMaterialSkuEdit"); TextBox txtQuantityOrdered = (TextBox)fvReport.FindControl("txtQuantityOrderedEdit"); TextBox txtAccountNumber = (TextBox)fvReport.FindControl("txtAccountNumberEdit"); TextBox txtPurchaseOrderNumber = (TextBox)fvReport.FindControl("txtPurchaseOrderNumberEdit"); TextBox txtOowOrderNumber = (TextBox)fvReport.FindControl("txtOowOrderNumberEdit"); TextBox txtSM = (TextBox)fvReport.FindControl("txtSMEdit"); TextBox txtShipVia = (TextBox)fvReport.FindControl("txtShipViaEdit"); TextBox txtReserve = (TextBox)fvReport.FindControl("txtReserveEdit"); System.Web.UI.HtmlControls.HtmlInputText txtInstallDate = (System.Web.UI.HtmlControls.HtmlInputText)fvReport.FindControl("txtInstallDateEdit"); TextBox txtShipToName = (TextBox)fvReport.FindControl("txtShipToNameEdit"); TextBox txtShipToAddress = (TextBox)fvReport.FindControl("txtShipToAddressEdit"); TextBox txtShipToCity = (TextBox)fvReport.FindControl("txtShipToCityEdit"); TextBox txtShipToState = (TextBox)fvReport.FindControl("txtShipToStateEdit"); TextBox txtShipToZip = (TextBox)fvReport.FindControl("txtShipToZipEdit"); TextBox txtShipToPhone = (TextBox)fvReport.FindControl("txtShipToPhoneEdit"); HtmlInputText txtDueByDate = (HtmlInputText)fvReport.FindControl("txtDueByDateEdit"); RadDropDownList ddlStatus = (RadDropDownList)fvReport.FindControl("ddlStatusEdit"); int statusId = Convert.ToInt32(ddlStatus.SelectedValue); RadComboBox ddlRequestedByEdit = (RadComboBox)fvReport.FindControl("ddlRequestedByEdit"); int requestedById = Convert.ToInt32(ddlRequestedByEdit.SelectedValue); RadComboBox ddlAssignedToEdit = (RadComboBox)fvReport.FindControl("ddlAssignedToEdit"); int assignedToId = 0; if (ddlAssignedToEdit.SelectedIndex != -1) { assignedToId = Convert.ToInt32(ddlAssignedToEdit.SelectedValue); } RadDropDownList ddlPriorityEdit = (RadDropDownList)fvReport.FindControl("ddlPriorityEdit"); int priorityId = Convert.ToInt32(ddlPriorityEdit.SelectedValue); CheckBox cbSendComments = (CheckBox)fvReport.FindControl("cbSendComments"); CheckBox cbShowSystemComments = (CheckBox)fvReport.FindControl("cbShowSystemComments"); CheckBox cbNotifyStandard = (CheckBox)fvReport.FindControl("cbNotifyStandard"); CheckBox cbNotifyAssignee = (CheckBox)fvReport.FindControl("cbNotifyAssignee"); CheckBox cbNotifyOther = (CheckBox)fvReport.FindControl("cbNotifyOther"); CheckBox cbNotifyRequester = (CheckBox)fvReport.FindControl("cbNotifyRequester"); RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther"); Label lblEmailsSentTo = (Label)fvReport.FindControl("lblEmailsSentTo"); Label lblFVMessage = (Label)fvReport.FindControl("lblFVMessage"); DateTime tryInstallDate; Nullable<DateTime> installDate = null; DateTime tryDateDue; Nullable<DateTime> dateDue = null; try { if (myForm.RequestedUser.SystemUserID.ToString() != ddlRequestedByEdit.SelectedValue) { Comments newRequesterComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Requester Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newRequesterComment); } if (myForm.AssignedUser == null && ddlAssignedToEdit.SelectedIndex != -1) // (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1 && Convert.ToString(myForm.AssignedUser.SystemUserID) != ddlAssignedToEdit.SelectedValue)) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Request Assigned To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1) { if (myForm.AssignedUser.SystemUserID.ToString() != ddlAssignedToEdit.SelectedValue) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Request Assignee Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } } else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex == -1) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Request Assignment Removed From: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == myForm.AssignedUser.SystemUserID).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } DateTime.TryParse(txtInstallDate.Value, out tryInstallDate); if (tryInstallDate.Year > 0001) { installDate = tryInstallDate; } if (txtDueByDate.Value != null) { DateTime.TryParse(txtDueByDate.Value.ToString(), out tryDateDue); if (tryDateDue.Year > 0001) { dateDue = tryDateDue; } } string accountNumber = txtAccountNumber.Text; int accountNumberLength = txtAccountNumber.Text.Length; while (accountNumberLength < 6) { accountNumber = "0" + accountNumber; accountNumberLength++; } var expediteCode = ctx.ExpediteCodes.FirstOrDefault(ec => ec.ExpediteCodeID == expediteCodeId); var statusCode = ctx.Statuses.FirstOrDefault(s => s.StatusId == statusId); myForm.Company = ddlCompanyEdit.SelectedValue; myForm.Customer = txtCustomer.Text; myForm.ExpediteCode = expediteCode; myForm.ContactName = txtContactName.Text; myForm.PhoneNumber = txtPhoneNumber.Text; myForm.AccountNumber = accountNumber; myForm.PurchaseOrderNumber = txtPurchaseOrderNumber.Text; myForm.OowOrderNumber = txtOowOrderNumber.Text; myForm.SM = txtSM.Text; myForm.ShipVia = txtShipVia.Text; myForm.Reserve = txtReserve.Text; myForm.InstallDate = installDate; myForm.ShipToName = txtShipToName.Text; myForm.ShipToAddress = txtShipToAddress.Text; myForm.ShipToCity = txtShipToCity.Text; myForm.ShipToState = txtShipToState.Text; myForm.ShipToZip = txtShipToZip.Text; myForm.ShipToPhone = txtShipToPhone.Text; myForm.Status = statusCode; myForm.RequestedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById); myForm.Priority = ctx.Priorities.FirstOrDefault(x => x.RecordId == priorityId); myForm.DueDate = dateDue; if (ddlAssignedToEdit.SelectedIndex != -1) { myForm.AssignedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId); } else { myForm.AssignedUser = null; } myForm.LastModifiedTimestamp = DateTime.Now; UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); myForm.LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID); ctx.SaveChanges(); if (myForm.AssignedUser != null && !newLogic.HasBeenAssigned(myForm.AssignedUser, myForm.RecordId, "Direct Order")) { UserAssignmentAssociation uA = new UserAssignmentAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), RelatedFormId = myForm.RecordId, User = myForm.AssignedUser }; ctx.UserAssignments.Add(uA); } if (myForm.RequestedUser != null && !newLogic.HasBeenRequested(myForm.RequestedUser, myForm.RecordId, "Direct Order")) { UserRequestAssociation uR = new UserRequestAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), RelatedFormId = myForm.RecordId, User = myForm.RequestedUser }; ctx.UserRequests.Add(uR); } ctx.SaveChanges(); if (myForm.Status.StatusText == "Completed") { Comments updateComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Request Completed By: " + currentUser.DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(updateComment); } else { Comments updateComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Request Updated By: " + currentUser.DisplayName + " --- Status: " + myForm.Status.StatusText + " --- Priority: " + myForm.Priority.PriorityText, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(updateComment); } if (lblEmailsSentTo.Text != "") { SendUpdateEmail(myForm.RecordId, lblEmailsSentTo.Text, cbSendComments.Checked, cbShowSystemComments.Checked); Comments notificationComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Direct Order"), Note = "Request Notifications Sent To: " + lblEmailsSentTo.Text, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(notificationComment); } ctx.SaveChanges(); cbNotifyAssignee.Checked = false; cbNotifyOther.Checked = false; cbNotifyRequester.Checked = false; cbNotifyStandard.Checked = false; cbSendComments.Checked = false; ddlNotifyOther.Text = ""; gvReport.DataBind(); gvReport.SelectedIndex = -1; pnlDetails.Visible = false; pnlReport.Visible = true; pnlFilter.Visible = true; ddlExpediteCode.DataBind(); } catch (Exception ex) { throw; } } }
protected void ddlOrderedStatus_SelectedIndexChanged(object sender, DropDownListEventArgs e) { try { GridEditableItem editedItem = (sender as RadDropDownList).NamingContainer as GridEditableItem; RadDropDownList ddlApprovedStatus = sender as RadDropDownList; string statusDesc = ddlApprovedStatus.SelectedText; int formId = Convert.ToInt32(editedItem.GetDataKeyValue("RecordId")); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); int userId = currentUser.SystemUserID; using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.RecordId == formId)) { var editForm = ctx.InventoryApprovalItems.FirstOrDefault(x => x.RecordId == formId); editForm.Status = ctx.InventoryApprovalStatuses.FirstOrDefault(x => x.StatusDescription == statusDesc); editForm.LastModifiedTimestamp = DateTime.Now; editForm.LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); if (statusDesc == "Pending Approval") { editForm.ApprovedBy = null; editForm.ApprovedDate = null; editForm.OrderDate = null; editForm.OrderedBy = null; editForm.ActualShipDate = null; } else if (statusDesc == "Approved") { editForm.OrderedBy = null; editForm.OrderDate = null; editForm.ActualShipDate = null; } else if (statusDesc == "Arrived") { editForm.ReceivedBy = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); editForm.ArrivalDate = DateTime.Now; editForm.TimeToArrival = Math.Round((DateTime.Now - editForm.EstimatedShipDate.Value).TotalDays / 7, 1).ToString() + " weeks"; } else if (statusDesc == "Invoiced") { editForm.InvoicedBy = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); editForm.InvoiceDate = DateTime.Now; editForm.TimeToArrival = Math.Round((DateTime.Now - editForm.EstimatedShipDate.Value).TotalDays / 7, 1).ToString() + " weeks"; } else if (statusDesc == "Cancelled") { editForm.CancelledBy = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); editForm.CancelledDate = DateTime.Now; } } ctx.SaveChanges(); RebindGrids(); } } catch (Exception ex) { throw ex; } }
public IQueryable<Tingle_WebForms.Models.DirectOrderForm> GetDirectOrderForms( [Control("txtFromDate")] string FromDate, [Control("txtToDate")] string ToDate, [Control("txtInstallFrom")] string InstallFrom, [Control("txtInstallTo")] string InstallTo, [Control("txtDueByDateFrom")] string DueByFrom, [Control("txtDueByDateTo")] string DueByTo, [Control("ddlCompany")] string Company, [Control("txtCustomer")] string Customer, [Control("txtOowOrderNumber")] string OowOrderNumber, [Control("txtPurchaseOrderNumber")] string PurchaseOrderNumber, [Control("txtAccountNumber")] string AccountNumber, [Control("txtContactName")] string ContactName, [Control("txtPhoneNumber")] string PhoneNumber, [Control("txtMaterialSku")] string MaterialSku, [Control("ddlExpediteCode")] Nullable<Int32> ExpediteCodeId, [Control("txtSM")] string Sm, [Control("txtQuantityOrdered")] string QuantityOrdered, [Control("txtShipVia")] string ShipVia, [Control("txtReserve")] string Reserve, [Control("txtShipToName")] string ShipToName, [Control("txtShipToAddress")] string ShipToAddress, [Control("txtShipToCity")] string ShipToCity, [Control("txtShipToState")] string ShipToState, [Control("txtShipToZip")] string ShipToZip, [Control("txtShipToPhone")] string ShipToPhone, [Control("ddlStatus")] Nullable<Int32> StatusId, [Control("ddlGlobalStatus")] string GlobalStatus, [Control("ddlRequestedBy")] Nullable<Int32> RequestedById, [Control("ddlAssignedTo")] Nullable<Int32> AssignedToId, [Control("ddlPriority")] Nullable<Int32> PriorityId, [QueryString("formId")] Nullable<Int32> formId ) { DateTime dtFromDate; DateTime dtToDate; DateTime dtInstallFrom; DateTime dtInstallTo; DateTime dtDueByFrom; DateTime dtDueByTo; System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); IQueryable<Tingle_WebForms.Models.DirectOrderForm> DirectOrderFormList = ctx.DirectOrderForms.OrderByDescending(forms => forms.Timestamp); if (GlobalStatus != null) { if (GlobalStatus == "Active") { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Status.StatusText != "Completed"); } else if (GlobalStatus == "Archive") { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Status.StatusText == "Completed"); } } if (currentUser.UserRole.RoleName == "ReportsUser") { var reqHistory = ctx.UserRequests.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Cannot Wait For Container"); var assHistory = ctx.UserAssignments.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Cannot Wait For Container"); DirectOrderFormList = DirectOrderFormList .Where(eofl => eofl.SubmittedUser.SystemUserID == currentUser.SystemUserID || eofl.AssignedUser.SystemUserID == currentUser.SystemUserID || eofl.RequestedUser.SystemUserID == currentUser.SystemUserID || reqHistory.Any(y => y.RelatedFormId == eofl.RecordId) || assHistory.Any(y => y.RelatedFormId == eofl.RecordId) ); } if (formId != null) { Int32 id = Convert.ToInt32(formId); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.RecordId.Equals(id)); } if (!String.IsNullOrWhiteSpace(FromDate)) { DateTime.TryParse(FromDate, out dtFromDate); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Timestamp >= dtFromDate); } if (!String.IsNullOrWhiteSpace(ToDate)) { DateTime.TryParse(ToDate, out dtToDate); dtToDate = dtToDate.AddDays(1); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Timestamp <= dtToDate); } if (!String.IsNullOrWhiteSpace(InstallFrom)) { DateTime.TryParse(InstallFrom, out dtInstallFrom); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.InstallDate >= dtInstallFrom); } if (!String.IsNullOrWhiteSpace(InstallTo)) { DateTime.TryParse(InstallTo, out dtInstallTo); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.InstallDate <= dtInstallTo); } if (!String.IsNullOrWhiteSpace(Company) && Company != "Any Company") { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Company == Company); } if (!String.IsNullOrWhiteSpace(Customer)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Customer.Contains(Customer.Trim())); } if (!String.IsNullOrWhiteSpace(OowOrderNumber)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.OowOrderNumber.Contains(OowOrderNumber.Trim())); } if (!String.IsNullOrWhiteSpace(PurchaseOrderNumber)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.PurchaseOrderNumber.Contains(PurchaseOrderNumber.Trim())); } if (!String.IsNullOrWhiteSpace(AccountNumber)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.AccountNumber.Contains(AccountNumber.Trim())); } if (!String.IsNullOrWhiteSpace(ContactName)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ContactName.Contains(ContactName.Trim())); } if (!String.IsNullOrWhiteSpace(PhoneNumber)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.PhoneNumber.Contains(PhoneNumber.Trim())); } if (!String.IsNullOrWhiteSpace(MaterialSku)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.SkuQuantityItems.Any(x => x.MaterialSku.Contains(MaterialSku))); } if (ExpediteCodeId != null) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ExpediteCode.ExpediteCodeID == ExpediteCodeId); } if (!String.IsNullOrWhiteSpace(Sm)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.SM.Contains(Sm.Trim())); } if (!String.IsNullOrWhiteSpace(QuantityOrdered)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.SkuQuantityItems.Any(x => x.Quantity.Contains(QuantityOrdered))); } if (!String.IsNullOrWhiteSpace(ShipVia)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipVia.Contains(ShipVia.Trim())); } if (!String.IsNullOrWhiteSpace(Reserve)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Reserve.Contains(Reserve.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToName)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipToName.Contains(ShipToName.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToAddress)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipToAddress.Contains(ShipToAddress.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToCity)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipToCity.Contains(ShipToCity.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToState)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipToState.Contains(ShipToState.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToZip)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipToZip.Contains(ShipToZip.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToPhone)) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.ShipToPhone.Contains(ShipToPhone.Trim())); } if (StatusId != null) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Status.StatusId == StatusId); } if (!String.IsNullOrWhiteSpace(DueByFrom)) { DateTime.TryParse(DueByFrom, out dtDueByFrom); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.DueDate >= dtDueByFrom); } if (!String.IsNullOrWhiteSpace(DueByTo)) { DateTime.TryParse(DueByTo, out dtDueByTo); DirectOrderFormList = DirectOrderFormList.Where(forms => forms.DueDate <= dtDueByTo); } if (RequestedById != null) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.RequestedUser.SystemUserID == RequestedById); } if (AssignedToId != null) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.AssignedUser.SystemUserID == AssignedToId); } if (PriorityId != null) { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.Priority.RecordId == PriorityId); } if (Session["MyForms"] != null) { if (Session["MyForms"].ToString() == "Requested") { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.RequestedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Assigned") { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.AssignedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Created") { DirectOrderFormList = DirectOrderFormList.Where(forms => forms.SubmittedUser.SystemUserID == currentUser.SystemUserID); } } return DirectOrderFormList; }
protected void Page_Load(object sender, EventArgs e) { UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); if (String.IsNullOrEmpty(gvReport.SortExpression)) gvReport.Sort("Timestamp", SortDirection.Descending); if (newLogic.HasAccess(currentUser, "Must Include")) { if (pnlDetails.Visible == true) { RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther"); ddlNotifyOther.OpenDropDownOnLoad = false; } if (Page.IsPostBack && gvReport.Visible == true) { gvReport.DataBind(); } else { if (Request.QueryString["formId"] != null) { ddlCompany.SelectedIndex = 0; ddlGlobalStatus.SelectedIndex = -1; pnlFilter.Visible = false; pnlReport.Visible = false; pnlDetails.Visible = true; } else { if (Session["Company"] != null) { if (Session["Company"].ToString() == "Tingle") { ddlCompany.SelectedValue = "Tingle"; } else if (Session["Company"].ToString() == "Summit") { ddlCompany.SelectedValue = "Summit"; } else if (Session["Company"].ToString() == "Any") { ddlCompany.SelectedIndex = 0; } } if (Session["GlobalStatus"] != null) { if (Session["GlobalStatus"].ToString() == "Active") { ddlGlobalStatus.SelectedValue = "Active"; } else if (Session["GlobalStatus"].ToString() == "Archive") { ddlGlobalStatus.SelectedValue = "Archive"; } else if (Session["GlobalStatus"].ToString() == "All") { ddlGlobalStatus.SelectedValue = "All"; } } if (Session["MyForms"] != null) { if (Session["MyForms"].ToString() == "Assigned") { ddlAssignedTo.SelectedValue = currentUser.SystemUserID.ToString(); } else if (Session["MyForms"].ToString() == "Requested") { ddlRequestedBy.SelectedValue = currentUser.SystemUserID.ToString(); } } } } } else { Response.Redirect("/Default"); } }
public void SendUpdateEmail(Int32 FormId, string EmailList, Boolean SendComments, Boolean IncludeSystemComments) { Tingle_WebForms.Models.MustIncludeForm myForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == FormId); TForm submittedForm = ctx.TForms.FirstOrDefault(tf => tf.FormName == "Must Include"); Boolean anyComments = false; IEnumerable<Comments> finalComments = null; string dueDateString = ""; if (myForm.DueDate != null) { dueDateString = myForm.DueDate.Value.ToShortDateString(); } if (IncludeSystemComments) { if (ctx.Comments.Any(x => x.Form.FormName == "Must Include" && x.RelatedFormId == myForm.RecordId)) { anyComments = true; IEnumerable<Comments> commentsList = ctx.Comments .Where(x => x.Form.FormName == "Must Include" && x.RelatedFormId == myForm.RecordId) .Include(x => x.User) .OrderByDescending(x => x.RecordId) .ToList(); finalComments = commentsList; } } else { if (ctx.Comments.Any(x => x.Form.FormName == "Must Include" && x.RelatedFormId == myForm.RecordId && x.SystemComment == false)) { anyComments = true; IEnumerable<Comments> commentsList = ctx.Comments .Where(x => x.Form.FormName == "Must Include" && x.RelatedFormId == myForm.RecordId && x.SystemComment == false) .Include(x => x.User) .OrderByDescending(x => x.RecordId) .ToList(); finalComments = commentsList; } } string emailListString = EmailList.Replace(" ", ""); List<string> emailList = emailListString.Split(',').ToList<string>(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); SendEmail msg = new SendEmail(); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.AppendLine("<div style=\"width:50%; text-align:center;\"><img src=\"http://www.wctingle.com/img/Logo.jpg\" /><br /><br />") .AppendLine("<table style=\"border: 4px solid #d0604c;background-color:#FFF;width:100%;margin-lefT:auto; margin-right:auto;\">") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"4\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 20px;border: 4px solid #d0604c; color:#FFF; background-color:#bc4445;\">Must Include Request Update</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Company:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.Company).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;\"></td>") .AppendLine(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;\"></td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">PO:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.PO).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Armstrong Reference:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.ArmstrongReference).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Pattern:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.Pattern).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Line:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.Line).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Order #:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.OrderNumber).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\"></td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\"></td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Customer:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.Customer).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Warehouse:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(myForm.Warehouse.WarehouseText).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:100%;\" colspan=\"4\">") .AppendLine(" <table style=\"border:none; width:100%\">") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"4\" style=\"text-align:center\">") .AppendLine(" <span style=\"font-weight:bold; color:#bc4445; text-decoration:underline\">Assignment and Request Details:</span>") .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:25%; text-align:right\">Requested By:</td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(myForm.RequestedUser.DisplayName) .AppendLine(" </td>") .AppendLine(" <td style=\"width:25%; text-align:right\">Assigned To:</td>") .Append(" <td style=\"width:25%; text-align:left\">"); if (myForm.AssignedUser != null) { bodyHtml.AppendLine(myForm.AssignedUser.DisplayName); } else { bodyHtml.AppendLine("N/A"); } bodyHtml.AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:25%; text-align:right\">Date Created:</td>") .AppendLine(" <td style=\"width:25%; text-align:left\">").Append(myForm.Timestamp.ToShortDateString()) .AppendLine(" </td>") .AppendLine(" <td style=\"width:25%; text-align:right\">Due By:</td>") .Append(" <td style=\"width:25%; text-align:left\">").Append(dueDateString).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:25%; text-align:right\">Status:</td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(myForm.Status.StatusText) .AppendLine(" </td>") .AppendLine(" <td style=\"width:25%; text-align:right\">Priority:</td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(myForm.Priority.PriorityText) .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" </table>") .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .Append(" <td style=\"width:25%; text-align:right\">Created By:</td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(myForm.SubmittedUser.DisplayName).Append("</td>") .Append(" <td style=\"width:25%; text-align:right\">Updated By:</td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(myForm.LastModifiedUser.DisplayName).Append("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .Append(" <td style=\"width:25%; text-align:right\"></td>") .Append(" <td style=\"width:25%; text-align:left\"></td>") .Append(" <td style=\"width:25%; text-align:right\">Last Update:</td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(myForm.LastModifiedTimestamp.ToShortDateString()).Append("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .Append(" <td style=\"width:100%; text-align:center\" colspan=\"4\"><span style=\"color:#bc4445; font-weight:bold\">Request Notifications Sent To:</span> <br />") .AppendLine(EmailList) .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:100%; text-align:center\" colspan=\"4\"><br /><br /></td>") .AppendLine(" </tr>") .AppendLine("</table><br /><br />"); if (SendComments && anyComments) { bodyHtml.AppendLine("<div style=\"width:100%; padding-top:10px\">"); foreach (var comment in finalComments) { if (comment.SystemComment == false) { bodyHtml.AppendLine("<div style=\"width:80%; background-color:#bc4445; margin: 0 auto; text-align:left; font-size:12px; color:white;word-wrap: break-word;\">") .AppendLine("<div style=\"width:100%; margin:10px\">").AppendLine(comment.Note).AppendLine("<br /><br />") .AppendLine("<span style=\"padding-right:20px\">by ").AppendLine(comment.User.DisplayName).AppendLine("</span>") .AppendLine(comment.Timestamp.ToString()) .AppendLine("</div></div>"); } else { bodyHtml.AppendLine("<div style=\"width:80%; background-color:#FFF; margin: 0 auto; text-align:right; font-size:12px; color:#bc4445; word-wrap: break-word;\">") .AppendLine("<div style=\"width:95%; padding: 5px;\">").AppendLine(comment.Note).AppendLine("<br /><br />") .AppendLine(comment.Timestamp.ToString()) .AppendLine("</div></div>"); } } } bodyHtml.AppendLine("</div><br /><br />"); bool result = msg.SendMail("*****@*****.**", emailList, "Must Include Request Update", bodyHtml.ToString(), submittedForm, myForm.RecordId, currentUser); }
protected void Page_Load(object sender, EventArgs e) { System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); if (currentUser.InventoryApprovalUser == null || currentUser.InventoryApprovalUser == false) { Response.Redirect("/UserDashboard"); } else { LoadVendorStock(); ddlNotifyOther.OpenDropDownOnLoad = false; if (!IsPostBack) { FillEmailAddressLabels(); cbNotifyStandard.Checked = false; cbNotifyOther.Checked = false; ddlCompanyGlobal.SelectedIndex = 0; ddlVendorsGlobal.SelectedValue = "All"; ddlOverLastGlobal.SelectedIndex = 0; ddlCompany.SelectedIndex = 0; } } }
protected void fvReport_ItemUpdating(object sender, FormViewUpdateEventArgs e) { if (IsValid) { int id = Convert.ToInt32(((Label)fvReport.FindControl("lblRecordId")).Text); Tingle_WebForms.Models.MustIncludeForm myForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == id); RadDropDownList ddlCompanyEdit = (RadDropDownList)fvReport.FindControl("ddlCompanyEdit"); TextBox txtPO = (TextBox)fvReport.FindControl("txtPOEdit"); TextBox txtArmstrongReference = (TextBox)fvReport.FindControl("txtArmstrongReferenceEdit"); TextBox txtPattern = (TextBox)fvReport.FindControl("txtPatternEdit"); TextBox txtLine = (TextBox)fvReport.FindControl("txtLineEdit"); TextBox txtOrderNumber = (TextBox)fvReport.FindControl("txtOrderNumberEdit"); TextBox txtCustomer = (TextBox)fvReport.FindControl("txtCustomerEdit"); RadDropDownList ddlWarehouse = (RadDropDownList)fvReport.FindControl("ddlWarehouseEdit"); HtmlInputText txtDueByDate = (HtmlInputText)fvReport.FindControl("txtDueByDateEdit"); RadDropDownList ddlStatus = (RadDropDownList)fvReport.FindControl("ddlStatusEdit"); int statusId = Convert.ToInt32(ddlStatus.SelectedValue); RadComboBox ddlRequestedByEdit = (RadComboBox)fvReport.FindControl("ddlRequestedByEdit"); int requestedById = Convert.ToInt32(ddlRequestedByEdit.SelectedValue); RadComboBox ddlAssignedToEdit = (RadComboBox)fvReport.FindControl("ddlAssignedToEdit"); int assignedToId = 0; if (ddlAssignedToEdit.SelectedIndex != -1) { assignedToId = Convert.ToInt32(ddlAssignedToEdit.SelectedValue); } RadDropDownList ddlPriorityEdit = (RadDropDownList)fvReport.FindControl("ddlPriorityEdit"); int priorityId = Convert.ToInt32(ddlPriorityEdit.SelectedValue); CheckBox cbSendComments = (CheckBox)fvReport.FindControl("cbSendComments"); CheckBox cbShowSystemComments = (CheckBox)fvReport.FindControl("cbShowSystemComments"); CheckBox cbNotifyStandard = (CheckBox)fvReport.FindControl("cbNotifyStandard"); CheckBox cbNotifyAssignee = (CheckBox)fvReport.FindControl("cbNotifyAssignee"); CheckBox cbNotifyOther = (CheckBox)fvReport.FindControl("cbNotifyOther"); CheckBox cbNotifyRequester = (CheckBox)fvReport.FindControl("cbNotifyRequester"); RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther"); Label lblEmailsSentTo = (Label)fvReport.FindControl("lblEmailsSentTo"); Label lblFVMessage = (Label)fvReport.FindControl("lblFVMessage"); DateTime tryDateDue; Nullable<DateTime> dateDue = null; try { if (myForm.RequestedUser.SystemUserID.ToString() != ddlRequestedByEdit.SelectedValue) { Comments newRequesterComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Requester Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newRequesterComment); } if (myForm.AssignedUser == null && ddlAssignedToEdit.SelectedIndex != -1) // (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1 && Convert.ToString(myForm.AssignedUser.SystemUserID) != ddlAssignedToEdit.SelectedValue)) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Request Assigned To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1) { if (myForm.AssignedUser.SystemUserID.ToString() != ddlAssignedToEdit.SelectedValue) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Request Assignee Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } } else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex == -1) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Request Assignment Removed From: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == myForm.AssignedUser.SystemUserID).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } if (txtDueByDate.Value != null) { DateTime.TryParse(txtDueByDate.Value.ToString(), out tryDateDue); if (tryDateDue.Year > 0001) { dateDue = tryDateDue; } } var statusCode = ctx.Statuses.FirstOrDefault(s => s.StatusId == statusId); myForm.Company = ddlCompanyEdit.SelectedValue; myForm.PO = txtPO.Text; myForm.ArmstrongReference = txtArmstrongReference.Text; myForm.Pattern = txtPattern.Text; myForm.Line = txtLine.Text; myForm.OrderNumber = txtOrderNumber.Text; myForm.Customer = txtCustomer.Text; myForm.Warehouse = ctx.Warehouses.FirstOrDefault(x => x.WarehouseText == ddlWarehouse.SelectedText); myForm.Status = statusCode; myForm.RequestedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById); myForm.Priority = ctx.Priorities.FirstOrDefault(x => x.RecordId == priorityId); myForm.DueDate = dateDue; if (ddlAssignedToEdit.SelectedIndex != -1) { myForm.AssignedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId); } else { myForm.AssignedUser = null; } myForm.LastModifiedTimestamp = DateTime.Now; UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); myForm.LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID); ctx.MustIncludeForms.Attach(myForm); ctx.Entry(myForm).State = EntityState.Modified; ctx.SaveChanges(); if (myForm.AssignedUser != null && !newLogic.HasBeenAssigned(myForm.AssignedUser, myForm.RecordId, "Must Include")) { UserAssignmentAssociation uA = new UserAssignmentAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), RelatedFormId = myForm.RecordId, User = myForm.AssignedUser }; ctx.UserAssignments.Add(uA); } if (myForm.RequestedUser != null && !newLogic.HasBeenRequested(myForm.RequestedUser, myForm.RecordId, "Must Include")) { UserRequestAssociation uR = new UserRequestAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), RelatedFormId = myForm.RecordId, User = myForm.RequestedUser }; ctx.UserRequests.Add(uR); } ctx.SaveChanges(); if (myForm.Status.StatusText == "Completed") { Comments updateComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Request Completed By: " + currentUser.DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(updateComment); } else { Comments updateComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Request Updated By: " + currentUser.DisplayName + " --- Status: " + myForm.Status.StatusText + " --- Priority: " + myForm.Priority.PriorityText, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(updateComment); } if (lblEmailsSentTo.Text != "") { SendUpdateEmail(myForm.RecordId, lblEmailsSentTo.Text, cbSendComments.Checked, cbShowSystemComments.Checked); Comments notificationComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = "Request Notifications Sent To: " + lblEmailsSentTo.Text, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(notificationComment); } ctx.SaveChanges(); cbNotifyAssignee.Checked = false; cbNotifyOther.Checked = false; cbNotifyRequester.Checked = false; cbNotifyStandard.Checked = false; cbSendComments.Checked = false; ddlNotifyOther.Text = ""; gvReport.DataBind(); gvReport.SelectedIndex = -1; pnlDetails.Visible = false; pnlReport.Visible = true; pnlFilter.Visible = true; } catch (Exception ex) { throw; } } }
protected void txtGreeting_PreRender(object sender, EventArgs e) { if (Request.IsAuthenticated) { UserLogic uLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = uLogic.GetCurrentUser(user); if (currentUser != null) { txtGreeting.Text = currentUser.Greeting; } } }
protected void Page_Load(object sender, EventArgs e) { UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); if (newLogic.HasAccess(currentUser, "Direct Order")) { string msg = ""; string formAction = Request.QueryString["FormAction"]; if (!String.IsNullOrEmpty(formAction)) { if (formAction == "add") { msg = "Direct Order Form successfully submitted."; pnlCompleted.Visible = true; pnlForm.Visible = false; } else { msg = "Form Submission Failed. Please try again or contact your System Administrator for more information."; pnlCompleted.Visible = false; pnlForm.Visible = true; } } string sendEmail = Request.QueryString["sendEmail"]; if (!String.IsNullOrEmpty(sendEmail)) { if (sendEmail.ToLower() == "false") { msg += " Some or all of the email notifications have failed. Please contact [email protected] for more information."; } } lblMessage.Text = msg; ddlNotifyOther.OpenDropDownOnLoad = false; if (!IsPostBack) { FillEmailAddressLabels(); lblRandomIdentifier.Text = currentUser.SystemUserID + "_" + Guid.NewGuid(); cbNotifyStandard.Checked = false; cbNotifyRequester.Checked = false; cbNotifyOther.Checked = false; cbNotifyAssignee.Checked = false; try { using (FormContext ctx = new FormContext()) { ddlExpediteCode.SelectedValue = ctx.ExpediteCodes.FirstOrDefault(x => x.Code == "EXP800").ExpediteCodeID.ToString(); } } catch (Exception ex) { } } } else { Response.Redirect("/Default"); } }
protected void btnSendNotification_Click(object sender, EventArgs e) { try { string emailListString = lblEmailsSentTo.Text.Replace(" ", ""); List<string> emailList = emailListString.Split(',').ToList<string>(); if (Page.IsValid && emailListString != "") { string notifyAbout = ddlNotifyAbout.SelectedText; string overLast = ddlNotifyOverLast.SelectedText; int days = overLast == "All" ? 9999 : Convert.ToInt32(overLast); DateTime maxDate = DateTime.Now.AddDays(-1 * days); string commentCountText = ddlCommentCount.SelectedText; int commentCount = ddlCommentCount.SelectedText != "All" ? Convert.ToInt32(commentCountText) : 0; Boolean sendComments = cbSendComments.Checked; Boolean anyComments = false; IEnumerable<InventoryComments> finalComments = null; if (_ctx.InventoryApprovalComments.Any(x => x.SystemComment == false)) { anyComments = true; IEnumerable<InventoryComments> commentsList = _ctx.InventoryApprovalComments .Where(x => x.SystemComment == false) .Include(x => x.User) .OrderByDescending(x => x.RecordId) .ToList(); if (commentCount > 0) { commentsList = commentsList.Take(commentCount); } finalComments = commentsList; } System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); SendEmail msg = new SendEmail(); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.AppendLine("<div style=\"width:50%; text-align:center;\"><img src=\"http://www.wctingle.com/img/Logo.jpg\" /><br /><br />") .Append("An Inventory Approval Notification has been sent by ").Append(currentUser.DisplayName).Append("<br /><br />") .AppendLine("<table style=\"border: 4px solid #d0604c;background-color:#FFF;width:100%;margin-lefT:auto; margin-right:auto;\">") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 20px;border: 4px solid #d0604c; color:#FFF; background-color:#bc4445;\">Inventory Approval Notification</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 14px;color:#FFF; background-color:#bc4445;\">") .Append("Notification About ").Append(notifyAbout).Append(" Orders over the last ").Append(overLast).Append(" Days") .AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"2\" style=\"text-align:right;font-size:12px;width:25%;color:#bc4445;\">Company:</td>") .Append(" <td colspan=\"2\" style=\"text-align:left;font-size:12px;width:25%;color:#000;\">").Append(ddlCompanyGlobal.SelectedText).AppendLine("</td>") .Append(" <td colspan=\"2\"></td>") .AppendLine(" <td colspan=\"2\" style=\"text-align:right;font-size:12px;width:25%; color:#bc4445\">Vendor:</td>") .AppendLine(" <td colspan=\"2\" style=\"text-align:left;font-size:12px;width:25%;color:#000\">").Append(ddlVendorsGlobal.SelectedText).Append("</td>") .AppendLine(" </tr>") .AppendLine(" <tr><td colspan=\"10\" style=\"padding-bottom:5px;\"</td></tr>"); if (notifyAbout == "Pending Approval" || notifyAbout == "All") { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 16px;border-top: 4px solid #d0604c; border-bottom: 4px solid #d0604c; color:#000; background-color:#FFF;\">Pending Approval</td>") .AppendLine(" </tr>"); using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.Status.StatusDescription == "Pending Approval" && x.Timestamp >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Vendor</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">PO #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Material Group</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Cost</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Container #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Priority</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Order Entry Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Est. Ship Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">ETA</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Created By</td>") .AppendLine(" </tr>"); foreach (InventoryApprovalForm item in ctx.InventoryApprovalItems.Where(x => x.Status.StatusDescription == "Pending Approval" && x.Timestamp >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.Vendor.VendorName).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.PurchaseOrderNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.MaterialGroup).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Cost.ToString("c0")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ContainerNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Priority.PriorityText).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Timestamp.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.EstimatedShipDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.EstimatedTimeOfArrival.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.SubmittedUser.DisplayName).Append("</td>") .AppendLine(" </tr>"); } } bodyHtml.AppendLine(" <tr><td colspan=\"10\" style=\"padding-bottom:5px;\"</td></tr>"); } } if (notifyAbout == "Approved" || notifyAbout == "All") { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 16px;border-top: 4px solid #d0604c; border-bottom: 4px solid #d0604c; color:#000; background-color:#FFF;\">Approved</td>") .AppendLine(" </tr>"); using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.Status.StatusDescription == "Approved" && x.ApprovedDate.Value >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Vendor</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">PO #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Material Group</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Cost</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Container #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Priority</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Order Entry Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Est. Ship Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">ETA</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Approved</td>") .AppendLine(" </tr>"); foreach (InventoryApprovalForm item in ctx.InventoryApprovalItems.Where(x => x.Status.StatusDescription == "Approved" && x.Timestamp >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.Vendor.VendorName).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.PurchaseOrderNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.MaterialGroup).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Cost.ToString("c0")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ContainerNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Priority.PriorityText).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Timestamp.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.EstimatedShipDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.EstimatedTimeOfArrival.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ApprovedDate.Value.ToString("MM/dd/yy")).Append(" <br />by ").Append(item.ApprovedBy.DisplayName) .Append("</td>") .AppendLine(" </tr>"); } } bodyHtml.AppendLine(" <tr><td colspan=\"10\" style=\"padding-bottom:5px;\"</td></tr>"); } } if (notifyAbout == "Ordered" || notifyAbout == "All") { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 16px;border-top: 4px solid #d0604c; border-bottom: 4px solid #d0604c; color:#000; background-color:#FFF;\">Ordered</td>") .AppendLine(" </tr>"); using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.Status.StatusDescription == "Ordered" && x.OrderDate.Value >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Vendor</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">PO #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Material Group</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Cost</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Container #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Priority</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Order Entry Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Ship Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">ETA</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Ordered</td>") .AppendLine(" </tr>"); foreach (InventoryApprovalForm item in ctx.InventoryApprovalItems.Where(x => x.Status.StatusDescription == "Ordered" && x.OrderDate >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.Vendor.VendorName).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.PurchaseOrderNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.MaterialGroup).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Cost.ToString("c0")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ContainerNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Priority.PriorityText).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Timestamp.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ActualShipDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.EstimatedTimeOfArrival.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.OrderDate.Value.ToString("MM/dd/yy")).Append(" <br />by ").Append(item.OrderedBy.DisplayName) .Append("</td>") .AppendLine(" </tr>"); } } bodyHtml.AppendLine(" <tr><td colspan=\"10\" style=\"padding-bottom:5px;\"</td></tr>"); } } if (notifyAbout == "Arrived" || notifyAbout == "All") { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 16px;border-top: 4px solid #d0604c; border-bottom: 4px solid #d0604c; color:#000; background-color:#FFF;\">Arrived</td>") .AppendLine(" </tr>"); using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.Status.StatusDescription == "Arrived" && x.ArrivalDate.Value >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Vendor</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">PO #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Material Group</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Cost</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Container #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Priority</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Ordered Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Ship Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Arrived</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Time To Arrival</td>") .AppendLine(" </tr>"); foreach (InventoryApprovalForm item in ctx.InventoryApprovalItems.Where(x => x.Status.StatusDescription == "Arrived" && x.ArrivalDate >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.Vendor.VendorName).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.PurchaseOrderNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.MaterialGroup).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Cost.ToString("c0")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ContainerNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Priority.PriorityText).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.OrderDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ActualShipDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ArrivalDate.Value.ToString("MM/dd/yy")).Append(" <br />by ").Append(item.ReceivedBy.DisplayName) .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.TimeToArrival).Append("</td>") .Append("</td>") .AppendLine(" </tr>"); } } bodyHtml.AppendLine(" <tr><td colspan=\"10\" style=\"padding-bottom:5px;\"</td></tr>"); } } if (notifyAbout == "Invoiced" || notifyAbout == "All") { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td colspan=\"10\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 16px;border-top: 4px solid #d0604c; border-bottom: 4px solid #d0604c; color:#000; background-color:#FFF;\">Invoiced</td>") .AppendLine(" </tr>"); using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.Status.StatusDescription == "Invoiced" && x.InvoiceDate.Value >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Vendor</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">PO #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#bc4445;\">Material Group</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Cost</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Container #</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Priority</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Ordered Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Arrival Date</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Time To Arrival</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#bc4445;\">Invoiced</td>") .AppendLine(" </tr>"); foreach (InventoryApprovalForm item in ctx.InventoryApprovalItems.Where(x => x.Status.StatusDescription == "Invoiced" && x.InvoiceDate >= DbFunctions.AddDays(DateTime.Now, -1 * days))) { bodyHtml.AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.Vendor.VendorName).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.PurchaseOrderNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:15%;color:#000;\">").Append(item.MaterialGroup).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Cost.ToString("c0")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ContainerNumber).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.Priority.PriorityText).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.OrderDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.ArrivalDate.Value.ToString("MM/dd/yy")).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.TimeToArrival).Append("</td>") .AppendLine(" <td style=\"text-align:center;font-size:12px;width:10%;color:#000;\">").Append(item.InvoiceDate.Value.ToString("MM/dd/yy")).Append(" <br />by ").Append(item.InvoicedBy.DisplayName) .Append("</td>") .AppendLine(" </tr>"); } } bodyHtml.AppendLine(" <tr><td colspan=\"10\" style=\"padding-bottom:5px;\"</td></tr>"); } } bodyHtml.AppendLine("</table><br /><br />"); if (sendComments && anyComments) { bodyHtml.AppendLine("<div style=\"width:100%; padding-top:10px\">"); foreach (var comment in finalComments) { if (comment.SystemComment == false) { bodyHtml.AppendLine("<div style=\"width:80%; background-color:#bc4445; margin: 0 auto; text-align:left; font-size:12px; color:white;word-wrap: break-word;\">") .AppendLine("<div style=\"width:100%; margin:10px\">").AppendLine(comment.Note).AppendLine("<br /><br />") .AppendLine("<span style=\"padding-right:20px\">by ").AppendLine(comment.User.DisplayName).AppendLine("</span>") .AppendLine(comment.Timestamp.ToString()) .AppendLine("</div></div>"); } //else //{ // bodyHtml.AppendLine("<div style=\"width:80%; background-color:#FFF; margin: 0 auto; text-align:right; font-size:12px; color:#bc4445; word-wrap: break-word;\">") // .AppendLine("<div style=\"width:95%; padding: 5px;\">").AppendLine(comment.Note).AppendLine("<br /><br />") // .AppendLine(comment.Timestamp.ToString()) // .AppendLine("</div></div>"); //} } } bool result = msg.SendInventoryNotification(emailList, bodyHtml.ToString(), currentUser); lblNotificationMessage.Text = "Inventory Approval Notification Sent Successfully."; } else { lblNotificationMessage.Text = "No Email Addresses were selected. Notification not sent."; } } catch (Exception ex) { lblNotificationMessage.Text = "An error occured during the notification. <br /><br />Please contact your System Administrator for more information."; } }
protected void ddlUserStatus_DataBound(object sender, EventArgs e) { if (Request.IsAuthenticated) { UserLogic uLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = uLogic.GetCurrentUser(user); if (currentUser != null) { ddlUserStatus.SelectedText = currentUser.UserStatus.StatusText; } } }
protected void btnPostComment_Click(object sender, EventArgs e) { try { if (!String.IsNullOrWhiteSpace(txtComments.Text)) { System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); using (FormContext ctx = new FormContext()) { InventoryComments newComment = new InventoryComments { Note = txtComments.Text, SystemComment = false, Timestamp = DateTime.Now, User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID) }; ctx.InventoryApprovalComments.Add(newComment); ctx.SaveChanges(); txtComments.Text = ""; rptrComments.DataBind(); lblCommentMessage.Text = ""; } } } catch(Exception ex) { lblCommentMessage.Text = "Unable to Save Comment"; } }
protected void btnApprove_Click(object sender, EventArgs e) { try { int formId = Convert.ToInt32(((RadButton)sender).CommandArgument); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); int userId = currentUser.SystemUserID; using (FormContext ctx = new FormContext()) { if (ctx.InventoryApprovalItems.Any(x => x.RecordId == formId)) { var editForm = ctx.InventoryApprovalItems.FirstOrDefault(x => x.RecordId == formId); editForm.Status = ctx.InventoryApprovalStatuses.FirstOrDefault(x => x.StatusDescription == "Approved"); editForm.ApprovedBy = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); editForm.ApprovedDate = DateTime.Now; editForm.LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); editForm.LastModifiedTimestamp = DateTime.Now; } ctx.SaveChanges(); RebindGrids(); } } catch (Exception ex) { throw ex; } }
protected void btnAddNewItem_Click(object sender, EventArgs e) { try { int vendorId = Convert.ToInt32(ddlVendor.SelectedValue); int priorityId = Convert.ToInt32(ddlPriority.SelectedValue); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); int userId = currentUser.SystemUserID; DateTime tryESD; Nullable<DateTime> esd = null; DateTime tryETA; Nullable<DateTime> eta = null; DateTime.TryParse(txtEstShipDate.Value, out tryESD); if (tryESD.Year > 0001) { esd = tryESD; } DateTime.TryParse(txtETA.Value, out tryETA); if (tryETA.Year > 0001) { eta = tryETA; } using (FormContext ctx = new FormContext()) { InventoryApprovalForm newForm = new InventoryApprovalForm { Timestamp = DateTime.Now, Company = ddlCompany.SelectedText, Vendor = ctx.Vendors.FirstOrDefault(x => x.RecordId == vendorId), PurchaseOrderNumber = txtPO.Text, MaterialGroup = txtMaterialGroup.Text, Cost = Convert.ToDecimal(txtCost.Value), ContainerNumber = txtContainer.Text, Priority = ctx.Priorities.FirstOrDefault(x => x.RecordId == priorityId), EstimatedShipDate = esd, EstimatedTimeOfArrival = eta, LastModifiedTimestamp = DateTime.Now, LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId), Status = ctx.InventoryApprovalStatuses.FirstOrDefault(x => x.StatusDescription == "Pending Approval"), SubmittedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId) }; ctx.InventoryApprovalItems.Add(newForm); ctx.SaveChanges(); gridPendingApproval.Rebind(); ddlCompany.SelectedIndex = 0; ddlVendor.SelectedIndex = 0; txtPO.Text = ""; txtMaterialGroup.Text = ""; txtCost.Text = ""; txtContainer.Text = ""; ddlPriority.SelectedValue = "Normal"; txtEstShipDate.Value = ""; txtETA.Value = ""; } } catch(Exception ex) { throw; } }
protected void fvReport_PreRender(object sender, EventArgs e) { Button btnUpdate = (Button)fvReport.FindControl("btnUpdate"); Button btnCancel = (Button)fvReport.FindControl("btnCancel"); Button btnBack = (Button)fvReport.FindControl("btnDetailsBack"); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); RadDropDownList ddlCompanyEdit = (RadDropDownList)fvReport.FindControl("ddlCompanyEdit"); TextBox txtCustomerEdit = (TextBox)fvReport.FindControl("txtCustomerEdit"); RadDropDownList ddlExpediteCodeEdit = (RadDropDownList)fvReport.FindControl("ddlExpediteCodeEdit"); TextBox txtContactNameEdit = (TextBox)fvReport.FindControl("txtContactNameEdit"); TextBox txtPhoneNumberEdit = (TextBox)fvReport.FindControl("txtPhoneNumberEdit"); TextBox txtAccountNumberEdit = (TextBox)fvReport.FindControl("txtAccountNumberEdit"); TextBox txtPurchaseOrderNumberEdit = (TextBox)fvReport.FindControl("txtPurchaseOrderNumberEdit"); TextBox txtOowOrderNumberEdit = (TextBox)fvReport.FindControl("txtOowOrderNumberEdit"); TextBox txtSMEdit = (TextBox)fvReport.FindControl("txtSMEdit"); TextBox txtShipViaEdit = (TextBox)fvReport.FindControl("txtShipViaEdit"); TextBox txtReserveEdit = (TextBox)fvReport.FindControl("txtReserveEdit"); HtmlInputText txtInstallDateEdit = (HtmlInputText)fvReport.FindControl("txtInstallDateEdit"); TextBox txtShipToNameEdit = (TextBox)fvReport.FindControl("txtShipToNameEdit"); TextBox txtShipToAddressEdit = (TextBox)fvReport.FindControl("txtShipToAddressEdit"); TextBox txtShipToCityEdit = (TextBox)fvReport.FindControl("txtShipToCityEdit"); TextBox txtShipToStateEdit = (TextBox)fvReport.FindControl("txtShipToStateEdit"); TextBox txtShipToZipEdit = (TextBox)fvReport.FindControl("txtShipToZipEdit"); TextBox txtShipToPhoneEdit = (TextBox)fvReport.FindControl("txtShipToPhoneEdit"); RadDropDownList ddlStatusEdit = (RadDropDownList)fvReport.FindControl("ddlStatusEdit"); RadComboBox ddlRequestedByEdit = (RadComboBox)fvReport.FindControl("ddlRequestedByEdit"); RadComboBox ddlAssignedToEdit = (RadComboBox)fvReport.FindControl("ddlAssignedToEdit"); RadDropDownList ddlPriorityEdit = (RadDropDownList)fvReport.FindControl("ddlPriorityEdit"); HtmlInputText txtDueByDateEdit = (HtmlInputText)fvReport.FindControl("txtDueByDateEdit"); CheckBox cbNotifyStandard = (CheckBox)fvReport.FindControl("cbNotifyStandard"); CheckBox cbNotifyAssignee = (CheckBox)fvReport.FindControl("cbNotifyAssignee"); CheckBox cbSendComments = (CheckBox)fvReport.FindControl("cbSendComments"); CheckBox cbNotifyOther = (CheckBox)fvReport.FindControl("cbNotifyOther"); CheckBox cbNotifyRequester = (CheckBox)fvReport.FindControl("cbNotifyRequester"); RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther"); RadButton btnAddNewEmail = (RadButton)fvReport.FindControl("btnAddNewEmail"); Button btnAddComment = (Button)fvReport.FindControl("btnAddComment"); RadButton btnShowNewSKUDiv = (RadButton)fvReport.FindControl("btnShowNewSKUDiv"); GridView gvSkus = (GridView)fvReport.FindControl("gvSkus"); FillEmailAddressLabels(); Label lblRecordId = (Label)fvReport.FindControl("lblRecordId"); int recordId; Int32.TryParse(lblRecordId.Text, out recordId); Boolean isComplete; using (var ctx = new FormContext()) { var directOrderForm = ctx.DirectOrderForms.FirstOrDefault(eof => eof.RecordId == recordId); isComplete = directOrderForm.Status.StatusText == "Completed" ? true : false; } if (currentUser.UserRole.RoleName == "ReportsUser" && isComplete) { ddlCompanyEdit.Enabled = false; txtCustomerEdit.Enabled = false; ddlExpediteCodeEdit.Enabled = false; txtContactNameEdit.Enabled = false; txtPhoneNumberEdit.Enabled = false; btnShowNewSKUDiv.Enabled = false; txtAccountNumberEdit.Enabled = false; txtPurchaseOrderNumberEdit.Enabled = false; txtOowOrderNumberEdit.Enabled = false; txtSMEdit.Enabled = false; txtShipViaEdit.Enabled = false; txtReserveEdit.Enabled = false; txtInstallDateEdit.Disabled = true; txtShipToNameEdit.Enabled = false; txtShipToAddressEdit.Enabled = false; txtShipToCityEdit.Enabled = false; txtShipToStateEdit.Enabled = false; txtShipToZipEdit.Enabled = false; txtShipToPhoneEdit.Enabled = false; ddlStatusEdit.Enabled = false; ddlRequestedByEdit.Enabled = false; ddlAssignedToEdit.Enabled = false; ddlPriorityEdit.Enabled = false; txtDueByDateEdit.Disabled = true; cbNotifyStandard.Enabled = false; cbNotifyAssignee.Enabled = false; cbSendComments.Enabled = false; cbNotifyOther.Enabled = false; cbNotifyRequester.Enabled = false; ddlNotifyOther.Enabled = false; btnAddNewEmail.Enabled = false; btnAddComment.Enabled = false; btnUpdate.Enabled = false; foreach (GridViewRow gvr in gvSkus.Rows) { LinkButton lb = gvr.FindControl("lbDeleteCode") as LinkButton; lb.Visible = false; gvr.Cells[5].Controls[0].Visible = false; gvr.Cells[6].Controls[0].Visible = false; } } }
protected void ddlRequestedBy_DataBound(object sender, EventArgs e) { UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); if (Request.IsAuthenticated) { ddlRequestedBy.SelectedValue = currentUser.SystemUserID.ToString(); lblNotifyRequesterValue.Text = ddlRequestedBy.SelectedItem.Text; } else { Response.Redirect("/default", true); } }
protected void btnAddComment_Click(object sender, EventArgs e) { try { int recordId; Int32.TryParse(lblRecordId.Text, out recordId); UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); using (var ctx = new FormContext()) { var thisForm = ctx.CannotWaitForContainerForms.FirstOrDefault(eof => eof.RecordId == recordId); Comments newComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Cannot Wait For Container"), Note = txtNewComment.Text, RelatedFormId = thisForm.RecordId, SystemComment = false, Timestamp = DateTime.Now, User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID) }; ctx.Comments.Add(newComment); ctx.SaveChanges(); txtNewComment.Text = ""; txtNewComment.Invalid = false; rptrComments.DataBind(); Session["NewComment"] = "true"; } } catch (Exception ex) { throw; } }
protected void gridPendingApproval_UpdateCommand(object sender, GridCommandEventArgs e) { try { using (FormContext ctx = new FormContext()) { System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); int userId = currentUser.SystemUserID; GridBatchEditingEventArgument argument = e.CommandArgument as GridBatchEditingEventArgument; Hashtable oldValues = argument.OldValues; Hashtable newValues = argument.NewValues; int recordId = Convert.ToInt32(oldValues["RecordId"].ToString()); int vendorId = Convert.ToInt32(newValues["Vendor.VendorName"].ToString()); string po = newValues["PurchaseOrderNumber"].ToString(); string materialGroup = newValues["MaterialGroup"].ToString(); decimal cost = Convert.ToDecimal(newValues["Cost"].ToString()); string containerNumber = newValues["ContainerNumber"].ToString(); int priorityId = Convert.ToInt32(newValues["Priority.PriorityText"].ToString()); DateTime estimatedShipDate = Convert.ToDateTime(newValues["EstimatedShipDate"].ToString()); DateTime estimatedTimeOfArrival = Convert.ToDateTime(newValues["EstimatedTimeOfArrival"].ToString()); var updateForm = ctx.InventoryApprovalItems.FirstOrDefault(x => x.RecordId == recordId); updateForm.Vendor = ctx.Vendors.FirstOrDefault(x => x.RecordId == vendorId); updateForm.PurchaseOrderNumber = po; updateForm.MaterialGroup = materialGroup; updateForm.Cost = cost; updateForm.ContainerNumber = containerNumber; updateForm.Priority = ctx.Priorities.FirstOrDefault(x => x.RecordId == priorityId); updateForm.LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == userId); updateForm.LastModifiedTimestamp = DateTime.Now; updateForm.EstimatedShipDate = estimatedShipDate; updateForm.EstimatedTimeOfArrival = estimatedTimeOfArrival; ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (Page.IsValid) { Int32 formId; int statusId; DateTime tryDueDate; Nullable<DateTime> dueDate = null; string emailListString = lblEmailsSentTo.Text.Replace(" ", ""); List<string> emailList = emailListString.Split(',').ToList<string>(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); statusId = Convert.ToInt32(ddlStatus.SelectedValue); if (txtDueByDate.Value != "") { DateTime.TryParse(txtDueByDate.Value, out tryDueDate); if (tryDueDate.Year > 0001) { dueDate = tryDueDate; } } else { dueDate = null; } using (FormContext ctx = new FormContext()) { var status = ctx.Statuses.Where(s => s.StatusId.Equals(statusId)).FirstOrDefault(); Int32 requestedUserId = Convert.ToInt32(ddlRequestedBy.SelectedValue); var requestedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedUserId); var modifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID); Models.LowInventoryForm newForm = new Models.LowInventoryForm { Timestamp = DateTime.Now, Company = ddlCompany.SelectedValue, OrderNumber = txtOrderNumber.Text, Plant = ctx.Plants.FirstOrDefault(x => x.PlantText == ddlPlants.SelectedText), Line = txtLine.Text, Quantity = txtQuantity.Text, SKU = txtSKU.Text, Status = ctx.Statuses.FirstOrDefault(s => s.StatusText == ddlStatus.SelectedItem.Text), RequestedUser = requestedUser, LastModifiedUser = modifiedUser, SubmittedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID), DueDate = dueDate, Priority = ctx.Priorities.FirstOrDefault(x => x.PriorityText == ddlPriority.SelectedText), LastModifiedTimestamp = DateTime.Now }; if (ddlAssignedTo.SelectedIndex != -1) { Int32 assignedUserId = Convert.ToInt32(ddlAssignedTo.SelectedValue); newForm.AssignedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedUserId); } ctx.LowInventoryForms.Add(newForm); ctx.SaveChanges(); if (newForm.AssignedUser != null) { Int32 assignedUserId = Convert.ToInt32(ddlAssignedTo.SelectedValue); UserAssignmentAssociation uA = new UserAssignmentAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), RelatedFormId = newForm.RecordId, User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedUserId) }; ctx.UserAssignments.Add(uA); } if (newForm.RequestedUser != null) { UserRequestAssociation uR = new UserRequestAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), RelatedFormId = newForm.RecordId, User = requestedUser }; ctx.UserRequests.Add(uR); } ctx.SaveChanges(); formId = newForm.RecordId; Comments systemComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), Note = "Request Created By: " + currentUser.DisplayName, RelatedFormId = formId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(systemComment); Comments systemComment2 = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), Note = "Requested By: " + requestedUser.DisplayName, RelatedFormId = formId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(systemComment2); if (ddlAssignedTo.SelectedIndex != -1) { Comments systemComment3 = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), Note = "Request Assigned To: " + requestedUser.DisplayName, RelatedFormId = formId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(systemComment3); } if (txtComments.Text != "") { Comments firstComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), Note = txtComments.Text, RelatedFormId = formId, SystemComment = false, Timestamp = DateTime.Now, User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID), }; ctx.Comments.Add(firstComment); ctx.SaveChanges(); } if (lblEmailsSentTo.Text != "") { Comments notifyComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"), Note = "Request Notifications Sent To: " + lblEmailsSentTo.Text, RelatedFormId = formId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(notifyComment); ctx.SaveChanges(); TForm submittedForm = ctx.TForms.FirstOrDefault(tf => tf.FormName == "Low Inventory"); SendEmail msg = new SendEmail(); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.AppendLine("<div style=\"width:50%; text-align:center;\"><img src=\"http://www.wctingle.com/img/Logo.jpg\" /><br /><br />") .Append("A new Low Inventory Request has been submitted.<br /><br />") .AppendLine("<table style=\"border: 4px solid #d0604c;background-color:#FFF;width:100%;margin-lefT:auto; margin-right:auto;\">") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"4\" style=\"text-align: center;vertical-align: middle;font-weight: bold;font-size: 20px;border: 4px solid #d0604c; color:#FFF; background-color:#bc4445;\">Low Inventory Request</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Company:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(ddlCompany.SelectedText).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%; color:#bc4445\"></td>") .AppendLine(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000\"></td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Order #:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(txtOrderNumber.Text).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Plant:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(ddlPlants.SelectedText).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Line:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(txtLine.Text).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">Quantity:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(txtQuantity.Text).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\">SKU:</td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\">").Append(txtSKU.Text).AppendLine("</td>") .AppendLine(" <td style=\"text-align:right;font-size:16px;font-weight:bold;width:25%;color:#bc4445;\"></td>") .Append(" <td style=\"text-align:left;font-size:16px;font-weight:bold;width:25%;color:#000;\"></td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:100%;\" colspan=\"4\">") .AppendLine(" <table style=\"border:none; width:100%\">") .AppendLine(" <tr>") .AppendLine(" <td colspan=\"4\">") .AppendLine(" <span style=\"font-weight:bold; color:#bc4445; text-decoration:underline\">Assignment and Request Details:</span>") .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:20%; text-align:right\"><span class=\"formRedText\">Requested By:</span></td>") .Append(" <td style=\"width:25%; text-align:left\">").AppendLine(ddlRequestedBy.SelectedItem.Text) .AppendLine(" </td>") .AppendLine(" <td style=\"width:20%; text-align:right\"><span class=\"formRedText\">Assigned To:</span></td>") .Append(" <td style=\"width:25%; text-align:left\">"); if (ddlAssignedTo.SelectedIndex != -1) { bodyHtml.AppendLine(ddlAssignedTo.SelectedItem.Text); } else { bodyHtml.AppendLine("N/A"); } bodyHtml.AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:18%; text-align:right\"><span class=\"formRedText\">Date Created:</span></td>") .AppendLine(" <td style=\"width:18%; text-align:left\">") .AppendLine(DateTime.Now.ToShortDateString()) .AppendLine(" </td>") .AppendLine(" <td style=\"width:18%; text-align:right\"><span class=\"formRedText\">Due By:</span></td>") .Append(" <td style=\"width:18%; text-align:left\">").Append(txtDueByDate.Value).AppendLine("</td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:10%; text-align:right\"><span class=\"formRedText\">Status:</span></td>") .Append(" <td style=\"width:10%; text-align:left\">").AppendLine(ddlStatus.SelectedText) .AppendLine(" </td>") .AppendLine(" <td style=\"width:10%; text-align:right\"><span class=\"formRedText\">Priority:</span></td>") .Append(" <td style=\"width:10%; text-align:left\">").AppendLine(ddlPriority.SelectedText) .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" </table>") .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .Append(" <td style=\"width:100%; text-align:center\" colspan=\"4\">Created By: ").AppendLine(currentUser.DisplayName) .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .Append(" <td style=\"width:100%; text-align:center\" colspan=\"4\"><span style=\"color:#bc4445; font-weight:bold\">Request Notifications Sent To:</span> <br />") .AppendLine(lblEmailsSentTo.Text) .AppendLine(" </td>") .AppendLine(" </tr>") .AppendLine(" <tr>") .AppendLine(" <td style=\"width:100%; text-align:center\" colspan=\"4\"><br /><br /></td>") .AppendLine(" </tr>") .AppendLine("</table><br /><br />"); if (cbSendComments.Checked) { bodyHtml.AppendLine("<div style=\"width:80%; color:#bc4445; margin: 0 auto; text-align:center;\">Comments<br /></div>") .AppendLine("<div style=\"width:80%; background-color:#bc4445; margin: 0 auto; text-align: left; padding:3px; color: white; \">") .Append(txtComments.Text).AppendLine("<br /><br />") .AppendLine("<span style=\"padding-right:15px\">").AppendLine(currentUser.DisplayName).AppendLine("</span>") .AppendLine(DateTime.Now.ToString("MMMM dd, yyyy")) .AppendLine("</div>"); } bodyHtml.AppendLine("</div><br /><br />"); bool result = msg.SendMail("*****@*****.**", emailList, "Low Inventory Request", bodyHtml.ToString(), submittedForm, formId, currentUser); ddlCompany.Enabled = false; txtOrderNumber.Enabled = false; ddlPlants.Enabled = false; txtLine.Enabled = false; txtQuantity.Enabled = false; txtSKU.Enabled = false; ddlRequestedBy.Enabled = false; ddlAssignedTo.Enabled = false; txtDueByDate.Disabled = true; ddlStatus.Enabled = false; ddlPriority.Enabled = false; cbNotifyStandard.Enabled = false; cbNotifyRequester.Enabled = false; cbNotifyOther.Enabled = false; cbNotifyAssignee.Enabled = false; cbSendComments.Enabled = false; txtComments.Enabled = false; string pageUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count()); Response.Redirect(pageUrl + "?FormAction=add&sendEmail=" + result.ToString()); } else { string pageUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count()); Response.Redirect(pageUrl + "?FormAction=add&sendEmail=NotRequired"); } } } } catch (Exception ex) { pnlCompleted.Visible = true; pnlForm.Visible = false; lblMessage.Text = "An error occured during submission of this request. <br /><br />It is possible that the form was completed before this error occurred, <br />so please contact your System Administrator before re-submitting."; } }
protected void btnSaveAccountSettings_Click(object sender, EventArgs e) { if (Page.IsValid) { try { UserLogic uLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = uLogic.GetCurrentUser(user); using (FormContext ctx = new FormContext()) { var updateUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID); updateUser.Greeting = txtGreeting.Text; updateUser.DisplayName = txtDisplayName.Text; updateUser.UserStatus = ctx.UserStatuses.FirstOrDefault(x => x.StatusText == ddlUserStatus.SelectedText); ctx.SaveChanges(); divSaveCancel.Visible = false; divLabelEdit.Visible = true; divDisplayNameEdit.Visible = false; ddlUserStatus.Enabled = false; txtGreeting.Enabled = false; lblUser.Text = txtDisplayName.Text; } } catch (Exception ex) { throw; } } }
protected void Page_Load(object sender, EventArgs e) { UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); if (newLogic.HasAccess(currentUser, "Low Inventory")) { string msg = ""; string formAction = Request.QueryString["FormAction"]; if (!String.IsNullOrEmpty(formAction)) { if (formAction == "add") { msg = "Low Inventory Request successfully submitted."; pnlCompleted.Visible = true; pnlForm.Visible = false; } else { msg = "Request Submission Failed. Please try again or contact your System Administrator for more information."; pnlCompleted.Visible = false; pnlForm.Visible = true; } } string sendEmail = Request.QueryString["sendEmail"]; if (!String.IsNullOrEmpty(sendEmail)) { if (sendEmail.ToLower() == "false") { msg += " Some or all of the email notifications have failed. Please contact [email protected] for more information."; } } lblMessage.Text = msg; ddlNotifyOther.OpenDropDownOnLoad = false; if (!IsPostBack) { FillEmailAddressLabels(); cbNotifyStandard.Checked = false; cbNotifyRequester.Checked = false; cbNotifyOther.Checked = false; cbNotifyAssignee.Checked = false; } } else { Response.Redirect("/Default"); } }
public IQueryable<Tingle_WebForms.Models.RequestForCheckForm> GetRequestForCheckForms( [Control("txtFromDate")] string FromDate, [Control("txtToDate")] string ToDate, [Control("txtDueByDateFrom")] string DueByFrom, [Control("txtDueByDateTo")] string DueByTo, [Control("ddlCompany")] string Company, [Control("txtPayableTo")] string PayableTo, [Control("txtChargeTo")] string ChargeTo, [Control("txtAmount")] string Amount, [Control("txtFor")] string For, [Control("txtRequestedBy")] string RequestedBy, [Control("txtApprovedBy")] string ApprovedBy, [Control("txtShipToName")] string ShipToName, [Control("txtShipToAddress")] string ShipToAddress, [Control("txtShipToCity")] string ShipToCity, [Control("txtShipToState")] string ShipToState, [Control("txtShipToZip")] string ShipToZip, [Control("txtShipToPhone")] string ShipToPhone, [Control("ddlStatus")] Nullable<Int32> StatusId, [Control("ddlGlobalStatus")] string GlobalStatus, [Control("ddlRequestedBy")] Nullable<Int32> RequestedById, [Control("ddlAssignedTo")] Nullable<Int32> AssignedToId, [Control("ddlPriority")] Nullable<Int32> PriorityId, [QueryString("formId")] Nullable<Int32> formId ) { DateTime dtFromDate; DateTime dtToDate; DateTime dtDueByFrom; DateTime dtDueByTo; System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); IQueryable<Tingle_WebForms.Models.RequestForCheckForm> RequestForCheckFormList = ctx.RequestForCheckForms.OrderByDescending(forms => forms.Timestamp); if (GlobalStatus != null) { if (GlobalStatus == "Active") { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Status.StatusText != "Completed"); } else if (GlobalStatus == "Archive") { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Status.StatusText == "Completed"); } } if (currentUser.UserRole.RoleName == "ReportsUser") { var reqHistory = ctx.UserRequests.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Request For Check"); var assHistory = ctx.UserAssignments.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Request For Check"); RequestForCheckFormList = RequestForCheckFormList .Where(eofl => eofl.SubmittedUser.SystemUserID == currentUser.SystemUserID || eofl.AssignedUser.SystemUserID == currentUser.SystemUserID || eofl.RequestedUser.SystemUserID == currentUser.SystemUserID || reqHistory.Any(y => y.RelatedFormId == eofl.RecordId) || assHistory.Any(y => y.RelatedFormId == eofl.RecordId) ); } if (formId != null) { Int32 id = Convert.ToInt32(formId); RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.RecordId.Equals(id)); } if (!String.IsNullOrWhiteSpace(FromDate)) { DateTime.TryParse(FromDate, out dtFromDate); RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Timestamp >= dtFromDate); } if (!String.IsNullOrWhiteSpace(ToDate)) { DateTime.TryParse(ToDate, out dtToDate); dtToDate = dtToDate.AddDays(1); RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Timestamp <= dtToDate); } if (!String.IsNullOrWhiteSpace(Company) && Company != "Any Company") { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Company == Company); } if (!String.IsNullOrWhiteSpace(PayableTo)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.PayableTo.Contains(PayableTo.Trim())); } if (!String.IsNullOrWhiteSpace(ChargeTo)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ChargeToAccountNumber.Contains(ChargeTo.Trim()) || forms.ChargeToOther.Contains(ChargeTo.Trim())); } if (!String.IsNullOrWhiteSpace(For)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.For.Contains(For.Trim())); } if (!String.IsNullOrWhiteSpace(Amount)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Amount.Contains(Amount.Trim())); } if (!String.IsNullOrWhiteSpace(RequestedBy)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.RequestedBy.Contains(RequestedBy.Trim())); } if (!String.IsNullOrWhiteSpace(ApprovedBy)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ApprovedBy.Contains(ApprovedBy.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToName)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ShipToName.Contains(ShipToName.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToAddress)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ShipToAddress.Contains(ShipToAddress.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToCity)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ShipToCity.Contains(ShipToCity.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToState)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ShipToState.Contains(ShipToState.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToZip)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ShipToZip.Contains(ShipToZip.Trim())); } if (!String.IsNullOrWhiteSpace(ShipToPhone)) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.ShipToPhone.Contains(ShipToPhone.Trim())); } if (StatusId != null) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Status.StatusId == StatusId); } if (!String.IsNullOrWhiteSpace(DueByFrom)) { DateTime.TryParse(DueByFrom, out dtDueByFrom); RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.DueDate >= dtDueByFrom); } if (!String.IsNullOrWhiteSpace(DueByTo)) { DateTime.TryParse(DueByTo, out dtDueByTo); RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.DueDate <= dtDueByTo); } if (RequestedById != null) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.RequestedUser.SystemUserID == RequestedById); } if (AssignedToId != null) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.AssignedUser.SystemUserID == AssignedToId); } if (PriorityId != null) { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.Priority.RecordId == PriorityId); } if (Session["MyForms"] != null) { if (Session["MyForms"].ToString() == "Requested") { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.RequestedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Assigned") { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.AssignedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Created") { RequestForCheckFormList = RequestForCheckFormList.Where(forms => forms.SubmittedUser.SystemUserID == currentUser.SystemUserID); } } return RequestForCheckFormList; }
protected void fvReport_PreRender(object sender, EventArgs e) { Button btnUpdate = (Button)fvReport.FindControl("btnUpdate"); Button btnCancel = (Button)fvReport.FindControl("btnCancel"); Button btnBack = (Button)fvReport.FindControl("btnDetailsBack"); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); RadDropDownList ddlCompanyEdit = (RadDropDownList)fvReport.FindControl("ddlCompanyEdit"); Label lblCompanyEdit = (Label)fvReport.FindControl("lblCompanyEdit"); TextBox txtPOEdit = (TextBox)fvReport.FindControl("txtPOEdit"); TextBox txtArmstrongReferenceEdit = (TextBox)fvReport.FindControl("txtArmstrongReferenceEdit"); TextBox txtPatternEdit = (TextBox)fvReport.FindControl("txtPatternEdit"); TextBox txtLineEdit = (TextBox)fvReport.FindControl("txtLineEdit"); TextBox txtOrderNumberEdit = (TextBox)fvReport.FindControl("txtOrderNumberEdit"); TextBox txtCustomerEdit = (TextBox)fvReport.FindControl("txtCustomerEdit"); TextBox txtWarehouseEdit = (TextBox)fvReport.FindControl("txtWarehouseEdit"); RadDropDownList ddlStatusEdit = (RadDropDownList)fvReport.FindControl("ddlStatusEdit"); RadComboBox ddlRequestedByEdit = (RadComboBox)fvReport.FindControl("ddlRequestedByEdit"); RadComboBox ddlAssignedToEdit = (RadComboBox)fvReport.FindControl("ddlAssignedToEdit"); RadDropDownList ddlPriorityEdit = (RadDropDownList)fvReport.FindControl("ddlPriorityEdit"); HtmlInputText txtDueByDateEdit = (HtmlInputText)fvReport.FindControl("txtDueByDateEdit"); CheckBox cbNotifyStandard = (CheckBox)fvReport.FindControl("cbNotifyStandard"); CheckBox cbNotifyAssignee = (CheckBox)fvReport.FindControl("cbNotifyAssignee"); CheckBox cbSendComments = (CheckBox)fvReport.FindControl("cbSendComments"); CheckBox cbNotifyOther = (CheckBox)fvReport.FindControl("cbNotifyOther"); CheckBox cbNotifyRequester = (CheckBox)fvReport.FindControl("cbNotifyRequester"); RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther"); RadButton btnAddNewEmail = (RadButton)fvReport.FindControl("btnAddNewEmail"); Button btnAddComment = (Button)fvReport.FindControl("btnAddComment"); FillEmailAddressLabels(); Label lblRecordId = (Label)fvReport.FindControl("lblRecordId"); int recordId; Int32.TryParse(lblRecordId.Text, out recordId); Boolean isComplete; using (var ctx = new FormContext()) { var thisForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == recordId); isComplete = thisForm.Status.StatusText == "Completed" ? true : false; } if (currentUser.UserRole.RoleName == "ReportsUser" && isComplete) { ddlCompanyEdit.Enabled = false; txtPOEdit.Enabled = false; txtArmstrongReferenceEdit.Enabled = false; txtPatternEdit.Enabled = false; txtLineEdit.Enabled = false; txtOrderNumberEdit.Enabled = false; txtCustomerEdit.Enabled = false; txtWarehouseEdit.Enabled = false; ddlStatusEdit.Enabled = false; ddlRequestedByEdit.Enabled = false; ddlAssignedToEdit.Enabled = false; ddlPriorityEdit.Enabled = false; txtDueByDateEdit.Disabled = true; cbNotifyStandard.Enabled = false; cbNotifyAssignee.Enabled = false; cbSendComments.Enabled = false; cbNotifyOther.Enabled = false; cbNotifyRequester.Enabled = false; ddlNotifyOther.Enabled = false; btnAddNewEmail.Enabled = false; btnAddComment.Enabled = false; btnUpdate.Enabled = false; } }
protected void gvReport_UpdateCommand(object sender, GridCommandEventArgs e) { if (IsValid) { GridEditableItem editedItem = e.Item as GridEditableItem; UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); int id = Convert.ToInt32(((HiddenField)userControl.FindControl("hRecordId")).Value); Tingle_WebForms.Models.OrderCancellationForm myForm = ctx.OrderCancellationForms.FirstOrDefault(eof => eof.RecordId == id); RadDropDownList ddlCompanyEdit = (RadDropDownList)userControl.FindControl("ddlCompanyEdit"); RadTextBox txtOrderNumber = (RadTextBox)userControl.FindControl("txtOrderNumberEdit"); RadTextBox txtArmstrongReference = (RadTextBox)userControl.FindControl("txtArmstrongReferenceEdit"); RadTextBox txtCustomer = (RadTextBox)userControl.FindControl("txtCustomerEdit"); RadTextBox txtPO = (RadTextBox)userControl.FindControl("txtPOEdit"); RadTextBox txtSKU = (RadTextBox)userControl.FindControl("txtSKUEdit"); RadComboBox ddlPOStatusEdit = (RadComboBox)userControl.FindControl("ddlPOStatusEdit"); RadTextBox txtLine = (RadTextBox)userControl.FindControl("txtLineEdit"); RadTextBox txtLineOfPO = (RadTextBox)userControl.FindControl("txtLineOfPOEdit"); RadTextBox txtSize = (RadTextBox)userControl.FindControl("txtSizeEdit"); RadDatePicker txtDateRequired = (RadDatePicker)userControl.FindControl("txtDateRequiredEdit"); RadDatePicker txtDueByDate = (RadDatePicker)userControl.FindControl("txtDueByDateEdit"); RadTextBox txtShipVia = (RadTextBox)userControl.FindControl("txtShipViaEdit"); RadTextBox txtSerial = (RadTextBox)userControl.FindControl("txtSerialEdit"); RadTextBox txtTruckRoute = (RadTextBox)userControl.FindControl("txtTruckRouteEdit"); RadDropDownList ddlStatus = (RadDropDownList)userControl.FindControl("ddlStatusEdit"); int statusId = Convert.ToInt32(ddlStatus.SelectedValue); RadComboBox ddlRequestedByEdit = (RadComboBox)userControl.FindControl("ddlRequestedByEdit"); int requestedById = Convert.ToInt32(ddlRequestedByEdit.SelectedValue); RadComboBox ddlAssignedToEdit = (RadComboBox)userControl.FindControl("ddlAssignedToEdit"); int assignedToId = 0; if (ddlAssignedToEdit.SelectedIndex != -1) { assignedToId = Convert.ToInt32(ddlAssignedToEdit.SelectedValue); } RadDropDownList ddlPriorityEdit = (RadDropDownList)userControl.FindControl("ddlPriorityEdit"); int priorityId = Convert.ToInt32(ddlPriorityEdit.SelectedValue); CheckBox cbSendComments = (CheckBox)userControl.FindControl("cbSendComments"); CheckBox cbShowSystemComments = (CheckBox)userControl.FindControl("cbShowSystemComments"); CheckBox cbNotifyStandard = (CheckBox)userControl.FindControl("cbNotifyStandard"); CheckBox cbNotifyAssignee = (CheckBox)userControl.FindControl("cbNotifyAssignee"); CheckBox cbNotifyOther = (CheckBox)userControl.FindControl("cbNotifyOther"); CheckBox cbNotifyRequester = (CheckBox)userControl.FindControl("cbNotifyRequester"); RadComboBox ddlNotifyOther = (RadComboBox)userControl.FindControl("ddlNotifyOther"); Label lblEmailsSentTo = (Label)userControl.FindControl("lblEmailsSentTo"); Label lblFVMessage = (Label)userControl.FindControl("lblFVMessage"); DateTime tryDateRequired; Nullable<DateTime> dateRequired = null; DateTime tryDateDue; Nullable<DateTime> dateDue = null; try { if (myForm.RequestedUser.SystemUserID.ToString() != ddlRequestedByEdit.SelectedValue) { Comments newRequesterComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Requester Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newRequesterComment); } if (myForm.AssignedUser == null && ddlAssignedToEdit.SelectedIndex != -1) // (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1 && Convert.ToString(myForm.AssignedUser.SystemUserID) != ddlAssignedToEdit.SelectedValue)) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Request Assigned To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1) { if (myForm.AssignedUser.SystemUserID.ToString() != ddlAssignedToEdit.SelectedValue) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Request Assignee Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } } else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex == -1) { Comments newAssignedComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Request Assignment Removed From: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == myForm.AssignedUser.SystemUserID).DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(newAssignedComment); } if (txtDateRequired.SelectedDate != null) { DateTime.TryParse(txtDateRequired.SelectedDate.Value.ToString(), out tryDateRequired); if (tryDateRequired.Year > 0001) { dateRequired = tryDateRequired; } } if (txtDueByDate.SelectedDate != null) { DateTime.TryParse(txtDueByDate.SelectedDate.Value.ToString(), out tryDateDue); if (tryDateDue.Year > 0001) { dateDue = tryDateDue; } } var statusCode = ctx.Statuses.FirstOrDefault(s => s.StatusId == statusId); myForm.Company = ddlCompanyEdit.SelectedValue; myForm.OrderNumber = txtOrderNumber.Text; myForm.ArmstrongReference = txtArmstrongReference.Text; myForm.Customer = txtCustomer.Text; myForm.PO = txtPO.Text; myForm.SKU = txtSKU.Text; myForm.POStatusList = ddlPOStatusEdit.Text; myForm.Line = txtLine.Text; myForm.LineOfPO = txtLineOfPO.Text; myForm.Size = txtSize.Text; myForm.DateRequired = dateRequired.Value; myForm.ShipVia = txtShipVia.Text; myForm.Serial = txtSerial.Text; myForm.TruckRoute = txtTruckRoute.Text; myForm.Status = statusCode; myForm.RequestedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById); myForm.Priority = ctx.Priorities.FirstOrDefault(x => x.RecordId == priorityId); myForm.DueDate = dateDue; if (ddlAssignedToEdit.SelectedIndex != -1) { myForm.AssignedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId); } else { myForm.AssignedUser = null; } myForm.LastModifiedTimestamp = DateTime.Now; UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); myForm.LastModifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID); ctx.SaveChanges(); if (myForm.AssignedUser != null && !newLogic.HasBeenAssigned(myForm.AssignedUser, myForm.RecordId, "Order Cancellation")) { UserAssignmentAssociation uA = new UserAssignmentAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), RelatedFormId = myForm.RecordId, User = myForm.AssignedUser }; ctx.UserAssignments.Add(uA); } if (myForm.RequestedUser != null && !newLogic.HasBeenRequested(myForm.RequestedUser, myForm.RecordId, "Order Cancellation")) { UserRequestAssociation uR = new UserRequestAssociation { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), RelatedFormId = myForm.RecordId, User = myForm.RequestedUser }; ctx.UserRequests.Add(uR); } ctx.SaveChanges(); if (myForm.Status.StatusText == "Completed") { Comments updateComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Request Completed By: " + currentUser.DisplayName, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(updateComment); } else { Comments updateComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Request Updated By: " + currentUser.DisplayName + " --- Status: " + myForm.Status.StatusText + " --- Priority: " + myForm.Priority.PriorityText, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(updateComment); } if (lblEmailsSentTo.Text != "") { SendUpdateEmail(myForm.RecordId, lblEmailsSentTo.Text, cbSendComments.Checked, cbShowSystemComments.Checked); Comments notificationComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Order Cancellation"), Note = "Request Notifications Sent To: " + lblEmailsSentTo.Text, RelatedFormId = myForm.RecordId, SystemComment = true, Timestamp = DateTime.Now }; ctx.Comments.Add(notificationComment); } ctx.SaveChanges(); cbNotifyAssignee.Checked = false; cbNotifyOther.Checked = false; cbNotifyRequester.Checked = false; cbNotifyStandard.Checked = false; cbSendComments.Checked = false; ddlNotifyOther.Text = ""; gvReport.DataBind(); } catch (Exception ex) { throw; } } }
public IQueryable<Tingle_WebForms.Models.MustIncludeForm> GetMustIncludeForms( [Control("txtFromDate")] string FromDate, [Control("txtToDate")] string ToDate, [Control("txtDueByDateFrom")] string DueByFrom, [Control("txtDueByDateTo")] string DueByTo, [Control("ddlCompany")] string Company, [Control("txtPO")] string PO, [Control("txtArmstrongReference")] string ArmstrongReference, [Control("txtPattern")] string Pattern, [Control("txtLine")] string Line, [Control("txtOrderNumber")] string OrderNumber, [Control("txtCustomer")] string Customer, [Control("ddlWarehouse")] Nullable<Int32> WarehouseId, [Control("ddlStatus")] Nullable<Int32> StatusId, [Control("ddlGlobalStatus")] string GlobalStatus, [Control("ddlRequestedBy")] Nullable<Int32> RequestedById, [Control("ddlAssignedTo")] Nullable<Int32> AssignedToId, [Control("ddlPriority")] Nullable<Int32> PriorityId, [QueryString("formId")] Nullable<Int32> formId ) { DateTime dtFromDate; DateTime dtToDate; DateTime dtDueByFrom; DateTime dtDueByTo; System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); IQueryable<Tingle_WebForms.Models.MustIncludeForm> MustIncludeFormList = ctx.MustIncludeForms.OrderByDescending(forms => forms.Timestamp); if (GlobalStatus != null) { if (GlobalStatus == "Active") { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Status.StatusText != "Completed"); } else if (GlobalStatus == "Archive") { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Status.StatusText == "Completed"); } } if (currentUser.UserRole.RoleName == "ReportsUser") { var reqHistory = ctx.UserRequests.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Must Include"); var assHistory = ctx.UserAssignments.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Must Include"); MustIncludeFormList = MustIncludeFormList .Where(eofl => eofl.SubmittedUser.SystemUserID == currentUser.SystemUserID || eofl.AssignedUser.SystemUserID == currentUser.SystemUserID || eofl.RequestedUser.SystemUserID == currentUser.SystemUserID || reqHistory.Any(y => y.RelatedFormId == eofl.RecordId) || assHistory.Any(y => y.RelatedFormId == eofl.RecordId) ); } if (formId != null) { Int32 id = Convert.ToInt32(formId); MustIncludeFormList = MustIncludeFormList.Where(forms => forms.RecordId.Equals(id)); } if (!String.IsNullOrWhiteSpace(FromDate)) { DateTime.TryParse(FromDate, out dtFromDate); MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Timestamp >= dtFromDate); } if (!String.IsNullOrWhiteSpace(ToDate)) { DateTime.TryParse(ToDate, out dtToDate); dtToDate = dtToDate.AddDays(1); MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Timestamp <= dtToDate); } if (!String.IsNullOrWhiteSpace(Company) && Company != "Any Company") { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Company == Company); } if (!String.IsNullOrWhiteSpace(PO)) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.PO.Contains(PO.Trim())); } if (!String.IsNullOrWhiteSpace(ArmstrongReference)) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.ArmstrongReference.Contains(ArmstrongReference.Trim())); } if (!String.IsNullOrWhiteSpace(Pattern)) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Pattern.Contains(Pattern.Trim())); } if (!String.IsNullOrWhiteSpace(Line)) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Line.Contains(Line.Trim())); } if (!String.IsNullOrWhiteSpace(OrderNumber)) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.OrderNumber.Contains(OrderNumber.Trim())); } if (!String.IsNullOrWhiteSpace(Customer)) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Customer.Contains(Customer.Trim())); } if (WarehouseId != null) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Warehouse.RecordId == WarehouseId); } if (StatusId != null) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Status.StatusId == StatusId); } if (!String.IsNullOrWhiteSpace(DueByFrom)) { DateTime.TryParse(DueByFrom, out dtDueByFrom); MustIncludeFormList = MustIncludeFormList.Where(forms => forms.DueDate >= dtDueByFrom); } if (!String.IsNullOrWhiteSpace(DueByTo)) { DateTime.TryParse(DueByTo, out dtDueByTo); MustIncludeFormList = MustIncludeFormList.Where(forms => forms.DueDate <= dtDueByTo); } if (RequestedById != null) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.RequestedUser.SystemUserID == RequestedById); } if (AssignedToId != null) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.AssignedUser.SystemUserID == AssignedToId); } if (PriorityId != null) { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.Priority.RecordId == PriorityId); } if (Session["MyForms"] != null) { if (Session["MyForms"].ToString() == "Requested") { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.RequestedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Assigned") { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.AssignedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Created") { MustIncludeFormList = MustIncludeFormList.Where(forms => forms.SubmittedUser.SystemUserID == currentUser.SystemUserID); } } return MustIncludeFormList; }
protected void Page_Load(object sender, EventArgs e) { UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); if (newLogic.HasAccess(currentUser, "Order Cancellation")) { if (Page.IsPostBack && gvReport.EditItems.Count == 0) { gvReport.Rebind(); } else { if (Request.QueryString["formId"] != null) { ddlCompany.SelectedIndex = 0; ddlGlobalStatus.SelectedIndex = -1; } else { if (Session["Company"] != null) { if (Session["Company"].ToString() == "Tingle") { ddlCompany.SelectedValue = "Tingle"; } else if (Session["Company"].ToString() == "Summit") { ddlCompany.SelectedValue = "Summit"; } else if (Session["Company"].ToString() == "Any") { ddlCompany.SelectedIndex = 0; } } if (Session["GlobalStatus"] != null) { if (Session["GlobalStatus"].ToString() == "Active") { ddlGlobalStatus.SelectedValue = "Active"; } else if (Session["GlobalStatus"].ToString() == "Archive") { ddlGlobalStatus.SelectedValue = "Archive"; } else if (Session["GlobalStatus"].ToString() == "All") { ddlGlobalStatus.SelectedValue = "All"; } } if (Session["MyForms"] != null) { if (Session["MyForms"].ToString() == "Assigned") { ddlAssignedTo.SelectedValue = currentUser.SystemUserID.ToString(); } else if (Session["MyForms"].ToString() == "Requested") { ddlRequestedBy.SelectedValue = currentUser.SystemUserID.ToString(); } } } } } else { Response.Redirect("/Default"); } }
protected void btnAddComment_Click(object sender, EventArgs e) { try { Label lblRecordId = (Label)fvReport.FindControl("lblRecordId"); int recordId; Int32.TryParse(lblRecordId.Text, out recordId); RadTextBox txtNewComment = (RadTextBox)fvReport.FindControl("txtNewComment"); Repeater rptrComments = (Repeater)fvReport.FindControl("rptrComments"); UserLogic newLogic = new UserLogic(); System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; SystemUsers currentUser = newLogic.GetCurrentUser(user); using (var ctx = new FormContext()) { var thisForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == recordId); Comments newComment = new Comments { Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"), Note = txtNewComment.Text, RelatedFormId = thisForm.RecordId, SystemComment = false, Timestamp = DateTime.Now, User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID) }; ctx.Comments.Add(newComment); ctx.SaveChanges(); txtNewComment.Text = ""; txtNewComment.Invalid = false; rptrComments.DataBind(); } } catch (Exception ex) { throw; } }
public IQueryable<Tingle_WebForms.Models.OrderCancellationForm> GetReportData( [Control("txtFromDate")] string FromDate, [Control("txtToDate")] string ToDate, [Control("txtDateRequiredFrom")] string DateRequiredFrom, [Control("txtDateRequiredTo")] string DateRequiredTo, [Control("txtDueByDateFrom")] string DueByFrom, [Control("txtDueByDateTo")] string DueByTo, [Control("ddlCompany")] string Company, [Control("txtOrderNumber")] string OrderNumber, [Control("txtArmstrongReference")] string ArmstrongReference, [Control("txtCustomer")] string Customer, [Control("txtPO")] string PO, [Control("txtSKU")] string SKU, [Control("ddlPOStatus", "CheckedItems")] IList<RadComboBoxItem> poStatuses, [Control("txtLine")] string Line, [Control("txtLineOfPO")] string LineOfPO, [Control("txtSize")] string Size, [Control("txtShipVia")] string ShipVia, [Control("txtSerial")] string Serial, [Control("txtTruckRoute")] string TruckRoute, [Control("ddlStatus")] Nullable<Int32> StatusId, [Control("ddlGlobalStatus")] string GlobalStatus, [Control("ddlRequestedBy")] Nullable<Int32> RequestedById, [Control("ddlAssignedTo")] Nullable<Int32> AssignedToId, [Control("ddlPriority")] Nullable<Int32> PriorityId, [QueryString("formId")] Nullable<Int32> formId ) { DateTime dtFromDate; DateTime dtToDate; DateTime dtDateRequiredFrom; DateTime dtDateRequiredTo; DateTime dtDueByFrom; DateTime dtDueByTo; System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User; UserLogic uLogic = new UserLogic(); SystemUsers currentUser = uLogic.GetCurrentUser(user); IQueryable<Tingle_WebForms.Models.OrderCancellationForm> OrderCancellationFormList = ctx.OrderCancellationForms.OrderByDescending(forms => forms.Timestamp); if (GlobalStatus != null) { if (GlobalStatus == "Active") { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Status.StatusText != "Completed"); } else if (GlobalStatus == "Archive") { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Status.StatusText == "Completed"); } } if (currentUser.UserRole.RoleName == "ReportsUser") { var reqHistory = ctx.UserRequests.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Order Cancellation"); var assHistory = ctx.UserAssignments.Where(x => x.User.SystemUserID == currentUser.SystemUserID && x.Form.FormName == "Order Cancellation"); OrderCancellationFormList = OrderCancellationFormList .Where(eofl => eofl.SubmittedUser.SystemUserID == currentUser.SystemUserID || eofl.AssignedUser.SystemUserID == currentUser.SystemUserID || eofl.RequestedUser.SystemUserID == currentUser.SystemUserID || reqHistory.Any(y => y.RelatedFormId == eofl.RecordId) || assHistory.Any(y => y.RelatedFormId == eofl.RecordId) ); } if (formId != null) { Int32 id = Convert.ToInt32(formId); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.RecordId.Equals(id)); } if (!String.IsNullOrWhiteSpace(FromDate)) { DateTime.TryParse(FromDate, out dtFromDate); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Timestamp >= dtFromDate); } if (!String.IsNullOrWhiteSpace(ToDate)) { DateTime.TryParse(ToDate, out dtToDate); dtToDate = dtToDate.AddDays(1); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Timestamp <= dtToDate); } if (!String.IsNullOrWhiteSpace(DateRequiredFrom)) { DateTime.TryParse(DateRequiredFrom, out dtDateRequiredFrom); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.DateRequired >= dtDateRequiredFrom); } if (!String.IsNullOrWhiteSpace(DateRequiredTo)) { DateTime.TryParse(DateRequiredTo, out dtDateRequiredTo); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.DateRequired <= dtDateRequiredTo); } if (!String.IsNullOrWhiteSpace(Company) && Company != "Any Company") { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Company == Company); } if (!String.IsNullOrWhiteSpace(OrderNumber)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.OrderNumber.Contains(OrderNumber.Trim())); } if (!String.IsNullOrWhiteSpace(ArmstrongReference)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.ArmstrongReference.Contains(ArmstrongReference.Trim())); } if (!String.IsNullOrWhiteSpace(Customer)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Customer.Contains(Customer.Trim())); } if (!String.IsNullOrWhiteSpace(PO)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.PO.Contains(PO.Trim())); } if (!String.IsNullOrWhiteSpace(SKU)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.SKU.Contains(SKU.Trim())); } if (!String.IsNullOrWhiteSpace(Line)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Line.Contains(Line.Trim())); } if (!String.IsNullOrWhiteSpace(LineOfPO)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.LineOfPO.Contains(LineOfPO.Trim())); } if (!String.IsNullOrWhiteSpace(Size)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Size.Contains(Size)); } if (!String.IsNullOrWhiteSpace(ShipVia)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.ShipVia.Contains(ShipVia.Trim())); } if (!String.IsNullOrWhiteSpace(Serial)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Serial.Contains(Serial.Trim())); } if (!String.IsNullOrWhiteSpace(TruckRoute)) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.TruckRoute.Contains(TruckRoute.Trim())); } if (StatusId != null) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Status.StatusId == StatusId); } if (!String.IsNullOrWhiteSpace(DueByFrom)) { DateTime.TryParse(DueByFrom, out dtDueByFrom); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.DueDate >= dtDueByFrom); } if (!String.IsNullOrWhiteSpace(DueByTo)) { DateTime.TryParse(DueByTo, out dtDueByTo); OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.DueDate <= dtDueByTo); } if (RequestedById != null) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.RequestedUser.SystemUserID == RequestedById); } if (AssignedToId != null) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.AssignedUser.SystemUserID == AssignedToId); } if (PriorityId != null) { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.Priority.RecordId == PriorityId); } if (poStatuses != null && poStatuses.Count() > 0) { List<String> poStatusStringList = poStatuses.Select(p => p.Text).ToList(); OrderCancellationFormList = OrderCancellationFormList.Where(forms => poStatusStringList.Any(x => forms.POStatusList.Contains(x))); } if (Session["MyForms"] != null) { if (Session["MyForms"].ToString() == "Requested") { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.RequestedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Assigned") { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.AssignedUser.SystemUserID == currentUser.SystemUserID); } else if (Session["MyForms"].ToString() == "Created") { OrderCancellationFormList = OrderCancellationFormList.Where(forms => forms.SubmittedUser.SystemUserID == currentUser.SystemUserID); } } return OrderCancellationFormList; }