Пример #1
0
        public String Hold(int id, string reason, int u_id)
        {
            Result result = new Result();

            try
            {
                User user = iuser.GetUser(u_id);
                if (user != null)
                {
                    OverTimeRequest overTimeRequest = ioverTimeRequest.GetOverTimeRequest(id);
                    overTimeRequest.rq_hold_yn      = "Y";
                    overTimeRequest.rq_hold_by      = u_id;
                    overTimeRequest.rq_hold_by_name = user.u_name;
                    overTimeRequest.rq_hold_date    = DateTime.Now;
                    ioverTimeRequest.Update(overTimeRequest);
                    Hold hold = new Hold();
                    hold.h_doc_id     = overTimeRequest.rq_doc_id;
                    hold.h_fun_doc_id = overTimeRequest.rq_id;
                    hold.h_reasons    = reason;
                    hold.h_type       = "Hold";
                    hold.h_cre_by     = user.u_id;
                    hold.h_cre_date   = DateTime.Now;
                    ihold.Add(hold);
                    result.Objects = null;
                    result.Message = "Success";
                    return(JsonConvert.SerializeObject(result));
                }
                else
                {
                    result.Objects = null;
                    result.Message = "You have No privilage to Hold";
                    return(JsonConvert.SerializeObject(result));
                }
            }
            catch (Exception ex)
            {
                result.Objects = null;
                result.Message = ex.Message;
                return(JsonConvert.SerializeObject(result));
            }
        }
 // GET: OvertimeRequest/Edit/5
 public ActionResult Edit(int id, string from)
 {
     if (getCurrentUser() == null)
     {
         return(RedirectToAction("Index", "Login"));
     }
     else
     {
         ViewBag.from           = from;
         ViewBag.DepartmentList = (idepartment.GetDepartments);
         return(View(ioverTimeRequest.GetOverTimeRequest(id)));
     }
 }