コード例 #1
0
        //勾選退件
        public JsonResult getFailString(string d)
        {
            string[]   ids  = d.Split('\\', '"', '[', ',', ']');
            List <int> list = new List <int>();

            foreach (var item in ids)
            {
                if (item != "")
                {
                    list.Add(int.Parse(item));
                }
            }
            foreach (var i in list)
            {
                dbMyCompanyContext        db     = new dbMyCompanyContext();
                TTravelExpenseApplication travel = db.TTravelExpenseApplications.FirstOrDefault(c => c.CApplyNumber == i);
                if (travel != null)
                {
                    if (travel.CCheckStatus == 1)
                    {
                        travel.CCheckStatus = 3;
                        db.SaveChanges();
                    }
                }
            }
            return(Json(d));
        }
コード例 #2
0
        public IActionResult Edit(int?id)
        {
            if (id.HasValue == false)
            {
                return(RedirectToAction("List"));
            }

            TTravelExpenseApplication et = db.TTravelExpenseApplications.Where(e => e.CApplyNumber == id).FirstOrDefault();

            if (et == null)
            {
                return(RedirectToAction("List"));
            }

            var result = new CTravelViewModel
            {
                CAmont           = et.CAmont,
                CApplyNumber     = et.CApplyNumber,
                CCheckStatus     = et.CCheckStatus,
                CDepartmentId    = et.CDepartmentId,
                CEmployeeId      = et.CEmployeeId,
                CReason          = et.CReason,
                CTravelEndTime   = et.CTravelEndTime,
                CTravelStartTime = et.CTravelStartTime
            };

            ViewBag.Departments = db.TUserDepartments.ToList();
            ViewBag.Status      = db.TCheckStatuses.ToList();

            return(View(result));
        }
コード例 #3
0
        public IActionResult Delete(int?id)
        {
            if (id != null)
            {
                TTravelExpenseApplication d = db.TTravelExpenseApplications.FirstOrDefault(t => t.CApplyNumber == id);

                if (d != null)
                {
                    db.TTravelExpenseApplications.Remove(d);
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("List"));
        }
コード例 #4
0
 public IActionResult fail(int?id)
 {
     if (id != null)
     {
         dbMyCompanyContext        db     = new dbMyCompanyContext();
         TTravelExpenseApplication travel = db.TTravelExpenseApplications.FirstOrDefault(t => t.CApplyNumber == id);
         if (travel != null)
         {
             if (travel.CCheckStatus == 1)
             {
                 travel.CCheckStatus = 3;
                 db.SaveChanges();
             }
         }
     }
     return(RedirectToAction("List"));
 }
コード例 #5
0
 public Travel_Expense_ApplicationViewModel()
 {
     iv_travel = new TTravelExpenseApplication();
     iv_User   = new TUser();
 }
コード例 #6
0
 public Travel_Expense_ApplicationViewModel(TTravelExpenseApplication t, TUser u)
 {
     iv_travel = t;
     iv_User   = u;
 }