/// <summary> /// load data /// </summary> /// <param name="contactId"></param> /// <param name="noteId"></param> private void BindPage(int contactId, int noteId) { var bllProspectNotes = new ProspectNotes(); var bllContact = new Contacts(); Model.Contacts modelContact = bllContact.GetModel(contactId); if (modelContact != null) { lblProperty.Text = modelContact.MailingAddr + " " + modelContact.MailingCity + " " + modelContact.MailingState + " " + modelContact.MailingZip; } var curUser = new LoginUser(); lblSender.Text = curUser.sFirstName + " " + curUser.sLastName; lblBorrower.Text = modelContact.LastName + ", " + modelContact.FirstName + " " + modelContact.MiddleName; if (noteId > 0) { tbxNote.Text = bllProspectNotes.GetModel(noteId).Note; } }
protected void btnSave_Click(object sender, EventArgs e) { string err = ""; try { if (tbxNote.Text.Trim() == "") { PageCommon.AlertMsg(this, "Please input the note!"); return; } //if (tbxNote.Text.Trim().Length > 500) //{ // PageCommon.AlertMsg(this, "The note length must be less than 500 characters!"); // return; //} int contactId = int.Parse(hfdContactId.Value); var curUser = new LoginUser(); string senderName = curUser.sFirstName + " " + curUser.sLastName; var req = new AddNoteRequest { FileId = contactId, Created = DateTime.Now, Note = tbxNote.Text.Trim(), Sender = senderName, hdr = new ReqHdr { UserId = curUser.iUserID } }; ServiceManager sm = new ServiceManager(); using (LP2ServiceClient client = sm.StartServiceClient()) { //AddNoteResponse res = client.AddNote(req); //bool exported = !res.hdr.Successful ? false : true; bool exported = true; var model = new Model.ProspectNotes { Note = tbxNote.Text, ContactId = contactId, Created = DateTime.Now, Sender = senderName, Exported = exported }; var bllProspectNotes = new ProspectNotes(); bllProspectNotes.Add(model); //if (!exported) //{ // PageCommon.WriteJs(this, res.hdr.StatusInfo, "parent.ClosePopupWindow();"); //} //else //{ PageCommon.WriteJs(this, "Add note successfully.", "parent.ClosePopupWindow();"); //PageCommon.WriteJsEnd(this, "Add note Failed.", PageCommon.Js_RefreshSelf); //} } } catch (System.ServiceModel.EndpointNotFoundException ee) { LPLog.LogMessage(ee.Message); PageCommon.AlertMsg(this, "Failed to add note, reason: Point Manager is not running."); } catch (Exception exception) { err = "Failed to add note, reason:" + exception.Message; LPLog.LogMessage(err); PageCommon.WriteJsEnd(this, err, PageCommon.Js_RefreshSelf); } }