Пример #1
0
 private static void MapNoteAddRequest(AddNoteRequest model, int createdById, SqlParameterCollection col)
 {
     col.AddWithValue("@Notes", model.Notes);
     col.AddWithValue("@SeekerId", model.SeekerId);
     col.AddWithValue("@TagId", model.TagId);
     col.AddWithValue("@CreatedBy", createdById);
 }
Пример #2
0
        public AddNoteResponse Add(AddNoteRequest request)
        {
            Note note = new Note(request.WMUserId, request.Text);

            _repository.Add(note);

            return((AddNoteResponse)note);
        }
Пример #3
0
        public IActionResult AddNode(AddNoteRequest request)
        {
            TreeNode <NodeData> newNode = _treeData.AddNode(request.NodeData, request.ParentId, request.Index);

            if (newNode != null)
            {
                return(Ok("Added node successfully"));
            }

            return(Ok("Could not add node"));
        }
Пример #4
0
        public void AddNote(AddNoteRequest AddNote)
        {
            RestRequest   elm  = CreateRequest <AddNoteRequest>("Orders/Notes", Method.POST, AddNote);
            IRestResponse resp = Client.Execute(elm);

            if (resp.StatusCode == HttpStatusCode.Unauthorized)
            {
                throw new UnauthorizedException();
            }
            else if (resp.StatusCode != HttpStatusCode.OK)
            {
                throw new eDockAPIException();
            }
        }
Пример #5
0
        public ActionResult Create(NoteDetailView noteDetailView)
        {
            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("Note_Insert");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(noteDetailView));
            }
            #endregion

            if (ModelState.IsValid)
            {
                try
                {
                    AddNoteRequest request = new AddNoteRequest();
                    request.CreateEmployeeID = GetEmployee().ID;
                    request.CustomerID       = noteDetailView.NoteView.CustomerID;
                    //request.LevelID = noteDetailView.NoteView.LevelID;
                    request.NoteDescription = noteDetailView.NoteView.NoteDescription;

                    GeneralResponse response = this._noteService.AddNote(request);

                    if (response.success)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        foreach (string error in response.ErrorMessages)
                        {
                            ModelState.AddModelError("", error);
                        }
                        return(View(noteDetailView));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return(View(noteDetailView));
                }
            }

            return(View(noteDetailView));
        }
Пример #6
0
        public ActionResult AddNote(AddNoteRequest addNoteRequest)
        {
            var  user = Session["user"] as User;
            Note note;

            using (var db = new DbConnectionDataContext())
            {
                note = new Note
                {
                    Description = addNoteRequest.Description,
                    UserId      = user.ID,
                };

                db.Notes.InsertOnSubmit(note);
                db.SubmitChanges();
            }

            return(Json(new { id = note.ID }));
        }
Пример #7
0
        //ADD, UPDATE, DELETE Note
        public int Add(AddNoteRequest model, int createdById)
        {
            int    id       = 0;
            string procName = "[dbo].[Notes_Insert]";

            _data.ExecuteNonQuery(procName, delegate(SqlParameterCollection col)
            {
                MapNoteAddRequest(model, createdById, col);

                SqlParameter idOut = new SqlParameter("@Id", SqlDbType.Int);
                idOut.Direction    = ParameterDirection.Output;
                col.Add(idOut);
            }, delegate(SqlParameterCollection returnCollection)
            {
                object oId = returnCollection["@Id"].Value;
                int.TryParse(oId.ToString(), out id);
            });

            return(id);
        }
Пример #8
0
        public ActionResult <ItemResponse <int> > Add(AddNoteRequest model)
        {
            int          iCode    = 201;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                int id     = _service.Add(model, userId);
                response = new ItemResponse <int> {
                    Item = id
                };
            }
            catch (Exception ex)
            {
                iCode = 500;
                base.Logger.LogError(ex.ToString());
                response = new ErrorResponse($"Server Error {ex.Message}");
            }
            return(StatusCode(iCode, response));
        }
Пример #9
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);
    }
Пример #10
0
        public GeneralResponse AddNote(AddNoteRequest request)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                Note note = new Note();
                note.ID              = Guid.NewGuid();
                note.CreateDate      = PersianDateTime.Now;
                note.CreateEmployee  = _employeeRepository.FindBy(request.CreateEmployeeID);
                note.Customer        = this._customerRepository.FindBy(request.CustomerID);
                note.Level           = this._levelRepository.FindBy(note.Customer.Level.ID);
                note.NoteDescription = request.NoteDescription;
                note.RowVersion      = 1;

                #region Validation

                if (note.GetBrokenRules().Count() > 0)
                {
                    foreach (BusinessRule businessRule in note.GetBrokenRules())
                    {
                        response.ErrorMessages.Add(businessRule.Rule);
                    }

                    return(response);
                }

                #endregion

                _noteRepository.Add(note);
                _uow.Commit();
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
            }

            return(response);
        }
Пример #11
0
 public override Task <AddNoteResponse> AddNote(AddNoteRequest request, ServerCallContext context)
 => _addNoteHandler.Handle(request, context).AsTask();
Пример #12
0
        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);
            }
        }
Пример #13
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);
            }
        }
Пример #14
0
        //[ApiLog]
        public async Task <IHttpActionResult> AddNote([FromBody] AddNoteRequest addNoteRequest)
        {
            var response = await AddNoteManager.Execute(addNoteRequest);

            return(CreateResponse(response));
        }