private void MarkEstimateAsPaid(IARequest request, IARequestEstimate estimate, DateTime approved) { estimate.IsApproved = true; estimate.ApprovedDateTime = approved; request.CreateNote(_customerMemberProtectUserId, estimate.PreAuthorizedPaymentCharged ? string.Format("Estimate payment pre-approved and paid: {0:c}", estimate.Charge) : string.Format("Estimate approved and paid: {0:c}", estimate.Charge)); _dataContext.SubmitChanges(); }
public void RequestAssignStaff(IARequest oIARequest, Guid oMPUserID) { // Only update the staff owner if there is currently no owner if (oIARequest.MPUserIDOwnedByStaff == Guid.Empty) { oIARequest.MPUserIDOwnedByStaff = oMPUserID; oIARequest.CreateNote(oMPUserID, "Production Owner"); } }
protected void OnSubmit(object sender, EventArgs e) { // Validation if (m_radContactPhone.SelectedValue == "other") { if (m_txtContactPhone.Text == string.Empty) { SetMessage("Please select or enter a contact phone number for this request.", MessageTone.Negative); return; } } if (ApplicationContext.IsStaff) { if (string.IsNullOrEmpty(Request.Form["ffb2"])) { SetMessage("Please select the customer you are submitting a request on behalf of.", MessageTone.Negative); return; } } var currentUserId = MemberProtect.CurrentUser.UserID; if (ApplicationContext.IsStaff) { // Grab the customer ID for whom the producer is requesting on behalf of currentUserId = MemberProtect.Utility.ValidateGuid(Request.Form["ffb2"]); if (currentUserId == Guid.Empty) { SetMessage("Please select a valid customer.", MessageTone.Negative); return; } } if (!Page.IsValid) return; m_txtNotificationEmails.Text = ApplicationContext.CleanAddressList(m_txtNotificationEmails.Text); MemberProtect.User.SetDataItem(currentUserId, "NotificationEmails", m_txtNotificationEmails.Text); var iaRequest = new IARequest { MPUserID = currentUserId, PageLoadDateTime = DateTime.Parse(m_hdnPageLoadTime.Value), MPUserIDOwnedByStaff = Guid.Empty, MPUserIDLockedByStaff = Guid.Empty }; switch (m_radContactPhone.SelectedValue) { case "user": iaRequest.ContactPhone = MemberProtect.User.GetDataItem(currentUserId, "Phone"); iaRequest.ContactPhoneExtension = MemberProtect.User.GetDataItem(currentUserId, "PhoneExtension"); break; case "userMobile": iaRequest.ContactPhone = MemberProtect.User.GetDataItem(currentUserId, "MobilePhone"); iaRequest.ContactPhoneExtension = string.Empty; break; case "other": iaRequest.ContactPhone = m_txtContactPhone.Text.Trim(); iaRequest.ContactPhoneExtension = m_txtContactPhoneExtension.Text.Trim(); break; } iaRequest.NotificationEmails = m_txtNotificationEmails.Text.Trim(); iaRequest.IsRushOrder = m_radSameDay.Checked; iaRequest.IsLocked = true; iaRequest.HasBeenViewedByProducer = false; iaRequest.EstimateRequested = "No"; iaRequest.CreatedDateTime = DateTime.Now; iaRequest.ProductionNotes = string.Empty; iaRequest.Script = string.Empty; var sEstimateNote = string.Empty; if (m_radBeginProduction.SelectedValue == "estimate" || !m_radBeginProduction.Visible) { iaRequest.IARequestStatusID = ApplicationContext.GetRequestStatusID(RequestStatus.NeedsEstimate); if (!m_radBeginProduction.Visible) { iaRequest.EstimateRequested = "Auto"; sEstimateNote = "Auto requested estimate"; } else { iaRequest.EstimateRequested = "Customer"; sEstimateNote = "Requested estimate"; } } else { iaRequest.IARequestStatusID = ApplicationContext.GetRequestStatusID(RequestStatus.Submitted); iaRequest.EstimateRequested = "No"; } if (PaymentPreApprovalEstimateButton.Checked) { var id = MemberProtect.Utility.ValidateInteger(PaymentSourceCombo.SelectedValue); if (id > 0) { iaRequest.IACustomerCreditCardID = id; sEstimateNote = "Pre-authorized Payment"; } } DataAccess.IARequests.InsertOnSubmit(iaRequest); DataAccess.SubmitChanges(); var hadError = false; var errorMessage = string.Empty; // Add in the production notes try { iaRequest.ProductionNotes = Regex.Replace(ProductionNotes, @"[^\u0000-\u007F]", ""); DataAccess.SubmitChanges(); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); hadError = true; errorMessage = "problem saving production notes"; } // Add in the script try { // what is this? iaRequest.Script = Regex.Replace(Script, @"[^\u0000-\u007F]", ""); DataAccess.SubmitChanges(); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); errorMessage = (hadError) ? "problem saving production notes and script" : "problem saving script"; hadError = true; } if (sEstimateNote != string.Empty) { iaRequest.CreateNote(MemberProtect.CurrentUser.UserID, sEstimateNote); } DataAccess.SubmitChanges(); if (ApplicationContext.IsStaff) { iaRequest.CreateNote(MemberProtect.CurrentUser.UserID, "Request created on behalf of the customer"); DataAccess.SubmitChanges(); } try { ProcessUploadedFiles(iaRequest.IARequestID); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); errorMessage = (hadError) ? errorMessage + " and uploading files" : "problem uploading files."; } Session["IARequestID"] = iaRequest.IARequestID; Session["errorMessage"] = errorMessage; Response.Redirect("~/create-request-confirm.aspx"); }