Exemple #1
0
        public JsonResult SaveDetailWorkCalendar(UnitWorkCalendar objWorkCalendar)
        {
            try
            {
                UnitWorkCalendarDAL objCtrl = new UnitWorkCalendarDAL();

                if (objWorkCalendar.DayWorkCalendar != null)
                {
                    objWorkCalendar.DayWorkCalendar = objWorkCalendar.DayWorkCalendar.ToLocalTime();
                }

                if (objWorkCalendar.Id > 0)
                {
                    objWorkCalendar.UpdatedBy = SysBaseInfor.GetCurrentUserId();
                    objCtrl.UpdateItem(objWorkCalendar);
                    return(Json(new { Msg = "Success", Type = "Edit" }));
                }
                else
                {
                    objWorkCalendar.Status    = 0;
                    objWorkCalendar.CreatedBy = SysBaseInfor.GetCurrentUserId();
                    objWorkCalendar.UnitId    = SysBaseInfor.GetCurrentUnitId().ToInt32();
                    objCtrl.CreateItem(objWorkCalendar);
                    return(Json(new { Msg = "Success", Type = "Create" }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Msg = "Fail" }));
            }
        }
Exemple #2
0
 public JsonResult PublishWorkCalendar(int workCalendarId, int?TypeSelect)
 {
     try
     {
         UnitWorkCalendarDAL objCtrl = new UnitWorkCalendarDAL();
         UnitWorkCalendar    obj     = objCtrl.GetItemByID("Id", workCalendarId);
         if (obj.Id > 0)
         {
             obj.PublishedBy = SysBaseInfor.GetCurrentUserId();
             obj.PublishedAt = DateTime.Now;
             if (TypeSelect > 0)
             {
                 obj.Status = 0;
             }
             else
             {
                 obj.Status = 1;
             }
             objCtrl.UpdateItem(obj);
         }
         return(Json(new { Msg = "Success" }));
     }
     catch (Exception ex)
     {
         return(Json(new { Msg = "Fail" }));
     }
 }