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 SaveCustomerNote(int employeeId, string comment, int customerId, ActivityType activityType, NoteType noteType) { if (!string.IsNullOrEmpty(comment)) { //comment = comment.Replace("\n", ";"); //dbb comment = comment.Replace("\n", " "); } var customerNote = new CustomerNote(activityType, noteType, comment, customerId, employeeId); presenter.SaveCustomerNote(customerNote); }