Esempio n. 1
0
        private void Edit(int id)
        {
            var obj = WorkInstance.Find(f => f.id == id && f.Deleted == false);

            if (null == obj)
            {
                ShowNotification("../service/as_work_dispatch.aspx", "No work exist.", false);
            }
            else
            {
                WorkInstance.Update(f => f.id == id && f.Deleted == false, act =>
                {
                    act.Description = description.Value;
                    act.Director    = director.Value.Trim();
                    if (!string.IsNullOrEmpty(end1.Value))
                    {
                        act.ScheduleEnd = DateTime.Parse(end1.Value.Trim());
                    }
                    if (!string.IsNullOrEmpty(start1.Value.Trim()))
                    {
                        act.ScheduleStart = DateTime.Parse(start1.Value);
                    }
                    act.Title = title.Value.Trim();
                });

                SaveHistory(new TB_AccountHistory()
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("EditWork")).id,
                    ObjectA  = WorkInstance.ToString(obj)
                });

                ShowNotification("../service/as_work_dispatch.aspx", "The work has changed.");
            }
        }
Esempio n. 2
0
        private void ShowWorkInfo()
        {
            var id   = ParseInt(Utility.Decrypt(hidKey.Value));
            var work = WorkInstance.Find(f => f.id == id && f.Deleted == false);

            if (null != work)
            {
                var ymd = "yyyy/MM/dd";
                workinfo.Rows[1].Cells[1].InnerText = work.Title;
                workinfo.Rows[2].Cells[1].InnerText = work.RegisterTime.Value.ToString(ymd);
                workinfo.Rows[3].Cells[1].InnerText = work.ScheduleStart.Value.ToString(ymd) + " - " + work.ScheduleEnd.Value.ToString(ymd);
                workinfo.Rows[4].Cells[1].InnerText = work.Director;
                workinfo.Rows[5].Cells[1].InnerText = work.TB_WorkDetail.Count.ToString();
                workinfo.Rows[6].Cells[1].InnerHtml = work.Description.Replace("\r\n", "<br />");
            }
            ShowWorkDetails(work);
        }
Esempio n. 3
0
        private void SaveWorkDetail()
        {
            var id   = ParseInt(Utility.Decrypt(hidKey.Value));
            var work = WorkInstance.Find(f => f.id == id && f.Deleted == false);

            if (null != work)
            {
                var obj = WorkDetailInstance.GetObject();
                if (!string.IsNullOrEmpty(hiddenTerminal.Value))
                {
                    obj.BookedTerminal = int.Parse(hiddenTerminal.Value);
                }
                obj.Equipment = int.Parse(hiddenEquipment.Value);
                obj.Type      = byte.Parse(hiddenType.Value);
                obj.Details   = detail.Value;
                obj.Work      = work.id;
                WorkDetailInstance.Add(obj);

                // 更新终端的预定状态
                if ((int?)null != obj.BookedTerminal)
                {
                    TerminalInstance.Update(f => f.id == obj.BookedTerminal && f.Delete == false, act =>
                    {
                        act.Booked = true;
                    });
                }
                // 保存操作历史记录
                SaveHistory(new TB_AccountHistory()
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("EditWorkDetail")).id,
                    ObjectA  = WorkDetailInstance.ToString(obj)
                });

                ShowNotification("../service/as_work_details.aspx?key=" + hidKey.Value, "Add new work.");
            }
            else
            {
                ShowNotification("../service/as_work_dispatch.aspx", "This work is not exist.", false);
            }
        }