Ejemplo n.º 1
0
 public string EditMain(WeekReportMain main)
 {
     try
     {
         dbContext.Entry(main).State = System.Data.Entity.EntityState.Modified;
         dbContext.SaveChanges();
         return Constants.AJAX_EDIT_SUCCESS_RETURN;
     }
     catch (Exception e1)
     {
         return "<p class='alert alert-danger'>出错了: " + e1.Message + "</p>";
     }
 }
Ejemplo n.º 2
0
        // 填报:重点工作
        public ActionResult AddMain()
        {
            // 工作类型下拉列表
            SelectList sl = MyTools.GetSelectList(Constants.WorkTypeList);
            ViewBag.WorkTypeList = sl;

            // 默认加上当前的用户UID和姓名
            User user = this.GetSessionCurrentUser();
            if (user == null)
            {
                user = Constants.UserList.FirstOrDefault<User>(); // 若获取不到则去第一个
            }

            WeekReportMain main = new WeekReportMain() { WorkTime = 0, RptPersonID = user.UID, Person = user.Realname, WorkYear = DateTime.Now.Year.ToString() };
            return View(main);
        }
Ejemplo n.º 3
0
 public string AddMain(WeekReportMain main)
 {
     try
     {
         dbContext.WeekReportMains.Add(main);
         dbContext.SaveChanges();
         return Constants.AJAX_CREATE_SUCCESS_RETURN;
     }
     catch (Exception e1)
     {
         return "<p class='alert alert-danger'>出错了: " + e1.Message + "</p>";
     }
 }