Exemplo 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.");
            }
        }
Exemplo n.º 2
0
        private void New()
        {
            var obj = WorkInstance.GetObject();

            obj.ScheduleEnd   = DateTime.Parse(end.Value);
            obj.ScheduleStart = DateTime.Parse(start.Value);
            obj.Description   = description.Value;
            obj.Director      = director.Value.Trim();
            obj.Title         = title.Value.Trim();
            WorkInstance.Add(obj);

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

            ShowNotification("../service/as_work_dispatch.aspx", "You added a new work.");
        }