コード例 #1
0
    private bool UpdatePointNote(int fileId, DateTime dtNow, string senderName, out string err)
    {
        bool exported = false;

        err = string.Empty;
        try
        {
            LPWeb.BLL.PointFiles   pfMgr   = new PointFiles();
            LPWeb.Model.PointFiles pfModel = pfMgr.GetModel(fileId);
            if (pfModel == null || pfModel.FolderId <= 0 || string.IsNullOrEmpty(pfModel.Name) || string.IsNullOrEmpty(pfModel.CurrentImage))
            {
                exported = true;
                return(exported);
            }
            var req = new AddNoteRequest
            {
                FileId   = fileId,
                Created  = dtNow,//DateTime.Now,
                NoteTime = dtNow,
                Note     = this.txtNote.Text.Trim(),
                Sender   = senderName,
                hdr      = new ReqHdr
                {
                    UserId = this.CurrUser.iUserID
                }
            };
            ServiceManager sm = new ServiceManager();
            using (LP2ServiceClient client = sm.StartServiceClient())
            {
                AddNoteResponse res = client.AddNote(req);
                exported = !res.hdr.Successful ? false : true;
                err      = res.hdr.StatusInfo;
            }
        }
        catch (Exception ex)
        {
            return(exported);
        }
        return(exported);
    }
コード例 #2
0
        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);
            }
        }