Exemple #1
0
        public void Test_Create()
        {
            NoteBLL bll = new NoteBLL(_unit);

            Note note = new Note {
                Comment   = "Test comment",
                Create    = DateTime.Now,
                ShareId   = 1585,
                Type      = NoteType.General.ToString(),
                CreatedBy = "2b658482-6a38-4ed3-b356-77fe9b1569f1"
            };

            bll.Create(note);
        }
Exemple #2
0
        public async Task <IHttpActionResult> GetByShareZone(int shareId, int?zoneId)
        {
            List <Note> nlist = null;

            try
            {
                var currentUser = await base.GetCurrentUser();

                NoteBLL bll = new NoteBLL(_unit);

                nlist = bll.GetNoteListByZone(shareId, zoneId, currentUser.Id);
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                return(InternalServerError(ex));
            }

            return(Ok(nlist));
        }
Exemple #3
0
        public async Task <IHttpActionResult> Delete(int id)
        {
            try
            {
                var currentUser = await GetCurrentUser();

                NoteBLL bll = new NoteBLL(_unit);

                bool isAdmin = await AppUserManager.IsInRoleAsync(currentUser.Id, "Admin");

                if (isAdmin)
                {
                    bll.Delete(id);
                }
                else
                {
                    var w = bll.GetByID(id);

                    if (w.CreatedBy == currentUser.Id)
                    {
                        bll.Delete(id);
                    }
                    else
                    {
                        BadRequest("You don't have permission to delete this note.");
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                return(InternalServerError(ex));
            }


            return(Ok());
        }
Exemple #4
0
        public void Test_GetNotesByShareAndUser()
        {
            NoteBLL bll = new NoteBLL(_unit);

            List <Note> nList = bll.GetNotesByShareAndUser(2433, 20160527, "2b658482-6a38-4ed3-b356-77fe9b1569f1");
        }
 private DataSet GetCalledPhoneList()
 {
     string where = "NoteType=1 and CompanyID={0} and CaseID={1}";
     where        = string.Format(where, CompanyID, CaseID);
     return(NoteBLL.GetNoteList(where));
 }
 private string GetTime(string companyID, string caseID)
 {
     return(NoteBLL.GetTime(companyID, caseID));
 }