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 fileId = int.Parse(hfdFileId.Value); var curUser = new LoginUser(); string senderName = curUser.sFirstName + " " + curUser.sLastName; string sLocalTime = hfLocalTime.Value; DateTime dtNow = Convert.ToDateTime(sLocalTime); bool exported = UpdatePointNote(fileId, dtNow, senderName, out err); var model = new Model.LoanNotes { Note = tbxNote.Text, FileId = fileId, Created = dtNow, //DateTime.Now, Sender = senderName, Exported = exported, ExternalViewing = cbExternalViewing.Checked }; var bllLoanNotes = new LoanNotes(); bllLoanNotes.Add(model); if (!exported) { PageCommon.WriteJs(this, err, "parent.ClosePopupWindow();"); } else { PageCommon.WriteJs(this, "Added note successfully.", "parent.ClosePopupWindow();"); //PageCommon.WriteJsEnd(this, "Add note Failed.", PageCommon.Js_RefreshSelf); } } catch (Exception exception) { err = "Failed to add note, reason:" + exception.Message + " LocalTime:" + hfLocalTime.Value; LPLog.LogMessage(err); PageCommon.WriteJsEnd(this, err, PageCommon.Js_RefreshSelf); } }
protected void cbExternalViewing_OnCheckedChanged(object sender, EventArgs e) { CheckBox cb = (CheckBox)sender; int Id = Convert.ToInt32(cb.ToolTip); BLL.LoanNotes bll = new BLL.LoanNotes(); Model.LoanNotes model = bll.GetModel(Id); model.ExternalViewing = cb.Checked; bll.Update(model); }
private void BindPage(int fileId, int noteId) { var bllLoans = new Loans(); var bllLoanNotes = new LoanNotes(); var bllContact = new Contacts(); Model.Loans modelLoan = bllLoans.GetModel(fileId); if (modelLoan != null) { lblProperty.Text = modelLoan.PropertyAddr + " " + modelLoan.PropertyCity + " " + modelLoan.PropertyState + " " + modelLoan.PropertyZip; } var curUser = this.CurrUser; lblSender.Text = curUser.sFirstName + " " + curUser.sLastName; lblBorrower.Text = bllContact.GetBorrower(fileId); if (noteId > 0) { Model.LoanNotes modelNotes = bllLoanNotes.GetModel(noteId); tbxNote.Text = modelNotes.Note; lblSender.Text = modelNotes.Sender; cbExternalViewing.Checked = modelNotes.ExternalViewing; #region 加载Condition信息 DataTable LoanNotesInfo = bllLoanNotes.GetLoanNotesInfo(noteId); if (LoanNotesInfo.Rows.Count > 0) { if (LoanNotesInfo.Rows[0]["LoanConditionId"] != DBNull.Value) { int iConditionID = Convert.ToInt32(LoanNotesInfo.Rows[0]["LoanConditionId"]); BLL.LoanConditions LoanConditionsMgr = new BLL.LoanConditions(); DataTable ConditionInfo = LoanConditionsMgr.GetLoanConditionsInfo(iConditionID); if (ConditionInfo.Rows.Count > 0) { this.lbCondition.Text = ConditionInfo.Rows[0]["CondName"].ToString(); } } } #endregion } }
private bool SaveLoanNotes() { if (NoteSaved) { return(true); } string err = ""; string Note = Request.Form["tbxNote"].ToString().Trim(); bool cbExternalViewing = true; if (Request.Form["cbExternalViewing"] == null || string.IsNullOrEmpty(Request.Form["cbExternalViewing"].ToString())) { cbExternalViewing = false; } else { cbExternalViewing = Request.Form["cbExternalViewing"].ToString().ToUpper() == "ON" ? true : false; } try { if (Note == "") { //PageCommon.AlertMsg(this, "Please input the note!"); //ErrorMsg("Please input the note!"); return(true); //gdc CR43 为空时不添加Note ,需要在调用前综合判定 Note 和 Attachment } //if (Note.Length > 500) //{ // //PageCommon.AlertMsg(this, "The note length must be less than 500 characters!"); // ErrorMsg("The note length must be less than 500 characters!"); // return false; //} int fileId = iLoanID; var curUser = new LoginUser(); string senderName = curUser.sFirstName + " " + curUser.sLastName; DateTime dtNow = Convert.ToDateTime(sLocalTime); dtNow.AddMinutes(2); dtNow.AddSeconds(5); var req = new AddNoteRequest { FileId = fileId, Created = dtNow,//DateTime.Now, NoteTime = dtNow, Note = Note, 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; var model = new Model.LoanNotes { Note = Note, FileId = fileId, Created = dtNow,//DateTime.Now, Sender = senderName, Exported = exported, ExternalViewing = cbExternalViewing }; var bllLoanNotes = new LoanNotes(); bllLoanNotes.Add(model); NoteSaved = true; if (!exported) { //PageCommon.WriteJs(this, res.hdr.StatusInfo, "parent.ClosePopupWindow();"); ErrorMsg(res.hdr.StatusInfo); return(false); } else { //PageCommon.WriteJs(this, "Add note successfully.", "parent.ClosePopupWindow();"); //PageCommon.WriteJsEnd(this, "Add note Failed.", PageCommon.Js_RefreshSelf); return(true); } } } catch (System.ServiceModel.EndpointNotFoundException ee) { LPLog.LogMessage(ee.Message); //PageCommon.AlertMsg(this, "Failed to add note, reason: Point Manager is not running."); ErrorMsg("Failed to add note, reason: Point Manager is not running."); return(false); } catch (Exception exception) { err = "Failed to add note, reason:" + exception.Message + " LocalTime:" + sLocalTime; LPLog.LogMessage(err); // PageCommon.WriteJsEnd(this, err, PageCommon.Js_RefreshSelf); ErrorMsg(err); return(false); } }