Exemplo n.º 1
0
        public async Task MemoRegister(object sender, RoutedEventArgs e)
        {
            try
            {
                // Control Progress Dialog
                var progressDialog = new RegisterProgressDialog();
                var showingDialog  = progressDialog.ShowAsync();

                if (IsEachTaskIdEmpty())
                {
                    CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Msg1001"));
                    return;
                }

                if (!string.IsNullOrWhiteSpace(MemoContent))
                {
                    MemoModel.Register(SelectedEachTaskId, MemoContent);
                }

                showingDialog.Cancel();
                progressDialog.Hide();

                // Control Progress Dialog
                var completeDialog       = new RegisterCompleteDialog();
                var noticeCompleteDialog = completeDialog.ShowAsync();
                await Task.Delay(700);

                noticeCompleteDialog.Cancel();
                completeDialog.Hide();
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="memoModel"></param>
 public void DoneMemo(MemoModel memoModel)
 {
     memoModel.IsComplete = true;
     _memoDB.SubmitChanges();
     this.MemoListTodo.Remove(memoModel);
     this.MemoListDone.Add(memoModel);
 }
Exemplo n.º 3
0
        public async Task <StatusCodeResult> Create(MemoModel model)
        {
            await _memoService.CreateAsync(model.DistributionGroups, model.Subject, model.Date, model.To,
                                           model.Description);

            return(new StatusCodeResult(StatusCodes.Status201Created));
        }
Exemplo n.º 4
0
        public ActionResult Create()
        {
            ViewData["created"] = false;
            var emptyModel = new MemoModel();

            return(PartialView("Diary/Memo/CreateForm", emptyModel));
        }
        public Task <int> UpdateAsync(int id, MemoModel model)
        {
            EntityExtension.FlagForUpdate(model, _identityService.Username, UserAgent);

            var itemIds = _dbContext.MemoItems.Where(entity => entity.MemoId == id).Select(entity => entity.Id).ToList();

            foreach (var itemId in itemIds)
            {
                var item = model.Items.FirstOrDefault(element => element.Id == itemId);
                if (item == null)
                {
                    var itemToDelete = _dbContext.MemoItems.FirstOrDefault(entity => entity.Id == itemId);
                    EntityExtension.FlagForDelete(itemToDelete, _identityService.Username, UserAgent);
                    _dbContext.MemoItems.Update(itemToDelete);
                }
                else
                {
                    EntityExtension.FlagForUpdate(item, _identityService.Username, UserAgent);
                    _dbContext.MemoItems.Update(item);
                }
            }

            foreach (var item in model.Items)
            {
                if (item.Id <= 0)
                {
                    EntityExtension.FlagForCreate(item, _identityService.Username, UserAgent);
                    _dbContext.MemoItems.Add(item);
                }
            }

            _dbContext.Memos.Update(model);

            return(_dbContext.SaveChangesAsync());
        }
Exemplo n.º 6
0
        public static MemoModel Map(Note note)
        {
            var memo = new MemoModel
            {
                Id       = note.Id,
                Title    = note.Title,
                DateTime = note.DateTime,
                Done     = note.Done
            };

            return(memo);
        }
Exemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void appBarPost_Click(object sender, EventArgs e)
 {
     if (!this.chatBubbleTextBoxMemo.Text.IsNullOrEmpty())
     {
         var newMemo = new MemoModel {
             MemoContent = this.chatBubbleTextBoxMemo.Text
         };
         this.ViewModel.AddMemo(newMemo);
         this.listBoxMemoList.ScrollIntoView(newMemo);
         this.chatBubbleTextBoxMemo.Text = string.Empty;
     }
 }
Exemplo n.º 8
0
        public void MemoRegister(object sender, RoutedEventArgs e)
        {
            if (IsEachTaskIdEmpty())
            {
                NotifySystemMessage("タスクを選択してください");
                return;
            }

            if (!string.IsNullOrWhiteSpace(MemoContent))
            {
                MemoModel.Register(SelectedEachTaskId, MemoContent);
            }
        }
Exemplo n.º 9
0
        public void ShorOtherDateLog()
        {
            TaskListData.Clear();

            List <EachTask> specificTaskList = GetSpecificDateEachTaskList(LogDate);

            specificTaskList.ForEach(eachTask => TaskListData.Add(eachTask));

            ActivityLog.Clear();
            ModelsHelpers.GetSpecificDateActivityLog(LogDate).ForEach(activity => ActivityLog.Add(activity));

            NoteList.Clear();
            ChangeMemoListToNoteList(MemoModel.GetSpecificDateMemo(LogDate)).ForEach(memo => NoteList.Add(memo));
        }
Exemplo n.º 10
0
        bool IMemoService.Create(MemoModel model)
        {
            var note = new Note()
            {
                Title    = model.Title,
                Type     = NoteType.Memo,
                DateTime = model.DateTime,
                Done     = false
            };

            var createdMemo = _noteRepository.Create(note);

            return(true);
        }
Exemplo n.º 11
0
        bool IMemoService.Update(MemoModel model)
        {
            var note = new Note()
            {
                Id       = model.Id,
                Title    = model.Title,
                Type     = NoteType.Memo,
                DateTime = model.DateTime,
            };

            var updated = _noteRepository.Update(note);

            return(updated);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 标记订单 View
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Mark(string id)
        {
            var model   = new MemoModel();
            int tradeid = 0;

            if (int.TryParse(id, out tradeid))
            {
                model = YunClient.Instance.Execute(
                    new GetTradeRequest
                {
                    Id = tradeid
                }).Trade.SellerMemo;
            }
            return(View(model));
        }
        public Task <int> CreateAsync(MemoModel model)
        {
            model.DocumentNo = GetMemoDocumentNo(model);

            EntityExtension.FlagForCreate(model, _identityService.Username, UserAgent);

            foreach (var item in model.Items)
            {
                EntityExtension.FlagForCreate(item, _identityService.Username, UserAgent);
            }

            _dbContext.Memos.Add(model);

            return(_dbContext.SaveChangesAsync());
        }
Exemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memoModel"></param>
        internal void DeleteMemo(MemoModel memoModel)
        {
            this.MemoGroupListAll.First(p => p.MemoGroupTitleDate.Equals(memoModel.MemoDateTime.Date)).MemoGroupList.Remove(memoModel);

            if (memoModel.IsComplete)
            {
                this.MemoListDone.Remove(memoModel);
            }
            else
            {
                this.MemoListTodo.Remove(memoModel);
            }

            _memoDB.MemoTable.DeleteOnSubmit(memoModel);
            _memoDB.SubmitChanges();
        }
        private string GetMemoDocumentNo(MemoModel model)
        {
            var now   = model.Date;
            var year  = now.ToString("yy");
            var month = now.ToString("MM");

            var documentNo = $"{year}{month}MEM{model.BuyerCode}";

            var countSameDocumentNo = _dbContext.Memos.Count(entity => entity.DocumentNo.Contains(documentNo));

            if (countSameDocumentNo > 0)
            {
                documentNo += _alphabets[countSameDocumentNo];
            }

            return(documentNo);
        }
Exemplo n.º 16
0
        public ActionResult Create(MemoModel model)
        {
            bool created;

            if (ModelState.IsValid)
            {
                created = _memoService.Create(model);
            }
            else
            {
                created = false;
            }

            ViewData["created"] = created;

            return(PartialView("Diary/Memo/CreateForm", model));
        }
Exemplo n.º 17
0
        public void ShowSpecificTaskLog()
        {
            ActivityLog.Clear();
            List <Activity> SpecificDateActivityList = ModelsHelpers.GetSpecificDateActivityLog(LogDate);

            NoteList.Clear();
            List <Note> SpecificDateNote = ChangeMemoListToNoteList(MemoModel.GetSpecificDateMemo(LogDate));

            if (SelectedEachTaskId != null)
            {
                SpecificDateActivityList = SpecificDateActivityList.Where(activity => activity.EachTaskId == SelectedEachTaskId).ToList();
                SpecificDateNote         = SpecificDateNote.Where(note => note.EachTaskId == SelectedEachTaskId).ToList();
            }

            SpecificDateActivityList.ForEach(activity => ActivityLog.Add(activity));
            SpecificDateNote.ForEach(note => NoteList.Add(note));
        }
Exemplo n.º 18
0
        public ActionResult Update(MemoModel model)
        {
            bool updated;

            if (ModelState.IsValid)
            {
                updated = _memoService.Update(model);
            }
            else
            {
                updated = false;
            }

            ViewData["updated"] = updated;

            return(PartialView("Diary/Memo/UpdateForm", model));
        }
Exemplo n.º 19
0
        public async Task CreateAsync(MemoModel model)
        {
            var memo = new Memo
            {
                DistributionGroups = model.DistributionGroups,
                Subject            = model.Subject,
                Date             = model.Date,
                To               = model.To,
                Description      = model.Description,
                PdfUrl           = model.PdfUrl,
                CreationDateTime = DateTime.UtcNow
            };

            _dbContext.Memos.Add(memo);
            await _dbContext.SaveChangesAsync();

            _backgroundJobClient.Enqueue <EmailRecipientJob>(job =>
                                                             job.CreateForMemo(memo.Id));
        }
Exemplo n.º 20
0
        public void ShouldReturnFalseIfNotUpdated()
        {
            var model = new MemoModel()
            {
                Id       = 1,
                Title    = "title",
                DateTime = DateTime.UtcNow,
            };

            var noteRepositoryMock = MockRepository.GenerateMock <INoteRepository>();

            noteRepositoryMock.Expect(repo => repo.Update(Arg <Note> .Matches(x => x.Id == model.Id))).Return(false);

            IMemoService memoService = new MemoService(noteRepositoryMock);

            var result = memoService.Update(model);

            Assert.IsFalse(result);
            noteRepositoryMock.VerifyAllExpectations();
        }
Exemplo n.º 21
0
        public void ShorOtherDateLog()
        {
            try
            {
                TaskListData.Clear();

                List <EachTask> specificTaskList = GetSpecificDateEachTaskList(LogDate);
                specificTaskList.ForEach(eachTask => TaskListData.Add(eachTask));

                ActivityLog.Clear();
                ModelsHelpers.GetSpecificDateActivityLog(LogDate).ForEach(activity => ActivityLog.Add(activity));

                NoteList.Clear();
                ChangeMemoListToNoteList(MemoModel.GetSpecificDateMemo(LogDate)).ForEach(memo => NoteList.Add(memo));
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Exemplo n.º 22
0
        public void ShouldUpdate()
        {
            var model = new MemoModel()
            {
                Id       = 1,
                Title    = "title",
                DateTime = DateTime.UtcNow,
            };

            var noteRepositoryMock = MockRepository.GenerateMock <INoteRepository>();

            noteRepositoryMock.Expect(repo => repo.Update(Arg <Note> .Matches(x => x.Id == model.Id && x.Title == model.Title && x.DateTime == model.DateTime && x.Type == NoteType.Memo))).Return(true);

            IMemoService memoService = new MemoService(noteRepositoryMock);

            var result = memoService.Update(model);

            Assert.IsTrue(result);
            noteRepositoryMock.VerifyAllExpectations();
        }
Exemplo n.º 23
0
        public void ShowSpecificTaskLog()
        {
            try
            {
                ActivityLog.Clear();
                List <Activity> SpecificDateActivityList = ModelsHelpers.GetSpecificDateActivityLog(LogDate);
                NoteList.Clear();
                List <Note> SpecificDateNote = ChangeMemoListToNoteList(MemoModel.GetSpecificDateMemo(LogDate));

                if (SelectedEachTaskId != null)
                {
                    SpecificDateActivityList = SpecificDateActivityList.Where(activity => activity.EachTaskId == SelectedEachTaskId).ToList();
                    SpecificDateNote         = SpecificDateNote.Where(note => note.EachTaskId == SelectedEachTaskId).ToList();
                }

                SpecificDateActivityList.ForEach(activity => ActivityLog.Add(activity));
                SpecificDateNote.ForEach(note => NoteList.Add(note));
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Exemplo n.º 24
0
        public async Task <StatusCodeResult> Create(MemoModel model)
        {
            await _memoService.CreateAsync(model);

            return(new StatusCodeResult(StatusCodes.Status201Created));
        }
Exemplo n.º 25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="memoModel"></param>
 public void DeleteMemo(MemoModel memoModel)
 {
     MemoList.Remove(memoModel);
     memoDB.MemoTable.DeleteOnSubmit(memoModel);
     memoDB.SubmitChanges();
 }
Exemplo n.º 26
0
        /// <summary>
        /// 标记订单 View
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Mark(string id)
        {

            var model = new MemoModel();
            int tradeid = 0;
            if (int.TryParse(id, out tradeid))
            {
                model = YunClient.Instance.Execute(
                    new GetTradeRequest
                    {
                        Id = tradeid
                    }, Member.Token).Trade.SellerMemo;
            }
            return View(model);
        } 
Exemplo n.º 27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="memoModel"></param>
 public void AddMemo(MemoModel memoModel)
 {
     memoDB.MemoTable.InsertOnSubmit(memoModel);
     memoDB.SubmitChanges();
     MemoList.Add(memoModel);
 }
Exemplo n.º 28
0
        public ActionResult Memo(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            Style style = db.Styles.Find(id);

            if (style == null)
            {
                return(HttpNotFound());
            }
            // Move a Style in or out of Memo

            MemoViewModel m = new MemoViewModel();

            m.style = new StyleModel()
            {
                Id    = style.Id,
                Image = style.Image,
                Name  = style.StyleName,
                //Num = style.StyleNum,
                Qty   = style.Quantity,
                Memod = style.Memos.Sum(s => s.Quantity)
            };

            m.Memos = new List <MemoModel>();
            m.numPresentersWithStyle = 0;

            foreach (Memo i in db.Memos.Where(x => x.StyleID == style.Id).Include(x => x.Presenter))
            {
                MemoModel mm = new MemoModel()
                {
                    Id             = i.Id,
                    Quantity       = i.Quantity,
                    date           = i.Date,
                    PresenterName  = i.Presenter.Name,
                    PresenterPhone = i.Presenter.Phone,
                    PresenterEmail = i.Presenter.Email,
                    Notes          = i.Notes
                };
                m.Memos.Add(mm);
                m.numPresentersWithStyle++;
            }

            m.Presenters = new List <SelectListItem>();
            m.CompanyId  = style.Collection.CompanyId;
            m.NewExistingPresenterRadio = 2;
            foreach (Presenter i in db.Presenters.Where(w => w.CompanyId == m.CompanyId))
            {
                SelectListItem sli = new SelectListItem()
                {
                    Text  = i.Name,
                    Value = i.Id.ToString(),
                };
                m.Presenters.Add(sli);
                // select only new presenter if there aren't any presenters
                m.NewExistingPresenterRadio = 1;
            }
            m.SendReturnMemoRadio = 1;
            m.PresenterName       = "";

            ViewBag.CollectionId = style.CollectionId;
            return(View(m));
        }
Exemplo n.º 29
0
        public void Search(object sender, RoutedEventArgs e)
        {
            try
            {
                CommonViewModel.RecentSearchWord = this.SearchWord;

                List <Memo> result = new List <Memo>();

                if (this.IsSearchConditionTaskName)
                {
                    result = MemoModel.SearchTaskName(SearchWord);
                    CommonViewModel.IsRecentSearchConditionTaskName    = true;
                    CommonViewModel.IsRecentSearchConditionMemoContent = false;
                }
                else
                {
                    result = MemoModel.SearchMemoContent(SearchWord);
                    CommonViewModel.IsRecentSearchConditionTaskName    = false;
                    CommonViewModel.IsRecentSearchConditionMemoContent = true;
                }

                SearchResult.Clear();

                result.ForEach(memo =>
                {
                    string targetContent = string.Empty;
                    string contentHtml   = string.Empty;
                    int index            = 0;

                    if (this.IsSearchConditionTaskName)
                    {
                        targetContent = memo.EachTask.Content.Replace("\r", "<br>");
                    }
                    else
                    {
                        targetContent = memo.Content.Replace("\r", "<br>");
                    }

                    while (true)
                    {
                        index = targetContent.IndexOf(this.SearchWord, StringComparison.OrdinalIgnoreCase);
                        if (index < 0)
                        {
                            contentHtml += targetContent;
                            break;
                        }
                        else if (index > 0)
                        {
                            contentHtml = targetContent.Substring(0, index);
                        }

                        contentHtml  += $"<strong>{targetContent.Substring(index, this.SearchWord.Length)}</strong>";
                        targetContent = targetContent.Substring(index + this.SearchWord.Length);
                    }
                    contentHtml = $"<span>{contentHtml}</span>";
                    EachSearchResult eachSearchResult = new EachSearchResult();

                    if (this.IsSearchConditionTaskName)
                    {
                        eachSearchResult.TaskName    = contentHtml;
                        eachSearchResult.Date        = $"[{memo.EachTask.PlanDate.Date.ToString().Substring(0, 10)}({memo.EachTask.PlanDate.DayOfWeek.ToString().Substring(0, 3)})]";
                        eachSearchResult.ContentHtml = memo.Content;
                    }
                    else
                    {
                        eachSearchResult.TaskName    = memo.EachTask.Content;
                        eachSearchResult.Date        = $"[{memo.EachTask.PlanDate.Date.ToString().Substring(0, 10)}({memo.EachTask.PlanDate.DayOfWeek.ToString().Substring(0, 3)})]";
                        eachSearchResult.ContentHtml = contentHtml;
                    }
                    SearchResult.Add(eachSearchResult);
                });

                CommonViewModel.RecentSearchResult = new ObservableCollection <EachSearchResult>(SearchResult);
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Exemplo n.º 30
0
 public MainPage()
 {
     this.InitializeComponent();
     initializeMemoGrid();
     model = new MemoModel();
 }
        /// <summary>
        /// 标记订单 View
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Mark(string id)
        {
            //获取自定义商品类型
            ViewData["tradecustomtype"] = ReadCustomType("tradecustomtype");

            var model = new MemoModel();
            int tradeid;
            if (int.TryParse(id, out tradeid))
            {
                var trade = YunClient.Instance.Execute(
                    new GetTradeRequest
                    {
                        Id = tradeid
                    }).Trade;

                if (trade == null)
                {
                    Error500Message = "订单不存在,请返回上一页";
                    return RedirectToAction("Error500", "Home");
                }

                //越权判断
                var ultraViresResult = UltraViresJudgment(trade.PartnerId, trade.CompanyId);
                if (ultraViresResult != null)
                {
                    return ultraViresResult;
                }

                model = trade.SellerMemo;
            }

            return PartialView(model);
        }
Exemplo n.º 32
0
        /// <summary>
        /// 标记订单 View
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Mark(string id)
        {
            //获取自定义商品类型
            ViewData["tradecustomtype"] = ReadCustomType("tradecustomtype");

            var model = new MemoModel();
            int tradeid;
            if (int.TryParse(id, out tradeid))
            {
                model = YunClient.Instance.Execute(
                    new GetTradeRequest
                    {
                        Id = tradeid
                    }).Trade.SellerMemo;
            }

            return PartialView(model);
        }