protected void SaveButton_Click(object sender, ImageClickEventArgs e) { int employeeId = CurrentPrincipal.CffUser.EmployeeId; ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString : (!string.IsNullOrWhiteSpace(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null; if (PermanentNoteCheckBox.Checked) { var permanentNote = new PermanentCustomerNote(CommentTextBox.EncodedText, ((xCustomer == null)?0:xCustomer.Id), employeeId); presenter.SavePermanentNote(permanentNote); } else { if (!string.IsNullOrEmpty(NextCallDueTextBox.EncodedText)) { var calendar = new Calendar(); var nextCallDueDate = new Date(DateTime.Parse(NextCallDueTextBox.EncodedText)); presenter.UpdateCustomerNextCallDue(nextCallDueDate, ((xCustomer == null) ? 0 : xCustomer.Id), calendar.Now, employeeId); if (NextCallDueUpdated != null) { NextCallDueUpdated(nextCallDueDate, new EventArgs()); } } ActivityType activityType = ActivityType.Parse(int.Parse(ActivityTypeDropDownList.SelectedValue)); NoteType noteType = NoteType.Parse(int.Parse(NoteTypeDropDownList.SelectedValue)); var customerNote = new CustomerNote(activityType, noteType, CommentTextBox.EncodedText, ((xCustomer == null) ? 0 : xCustomer.Id), employeeId); presenter.SaveCustomerNote(customerNote); } }
private void SaveNoteForCustomer(string comment, int employeeId, int customerId, string nextCallDueText, ActivityType activityType, NoteType noteType) { if (!string.IsNullOrEmpty(comment)) { //comment = comment.Replace("\n", ";"); //dbb comment = comment.Replace("\n", " "); } if (PermanentNoteCheckBox.Checked) { var permanentNote = new PermanentCustomerNote(comment, customerId, employeeId); presenter.SavePermanentNote(permanentNote); } else { if (!string.IsNullOrEmpty(nextCallDueText)) { var nextCallDueDate = new Date(DateTime.Parse(nextCallDueText)); UpdateNextCallDueDate(nextCallDueDate, customerId, new Calendar().Now, employeeId); } SaveCustomerNote(employeeId, comment, customerId, activityType, noteType); } }