Ejemplo n.º 1
0
        public static int Update(TimesheetApproveReject objItem)
        {
            var result = 0;

            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PutAsJsonAsync(Resource + $"/", objItem).GetAwaiter().GetResult();
                if (response.IsSuccessStatusCode)
                {
                    result = response.Content.ReadAsAsync <int>().GetAwaiter().GetResult();
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public JsonResult ButtonSubmitEvent(ScanTimeApprovalCollection objItem, string Event)
        {
            var result = 0;
            var timesheetCollection = new TimesheetEntryCollection();
            TimesheetApproveReject timesheetApproveReject = new TimesheetApproveReject();

            foreach (ScanTimeApproval item in objItem)
            {
                if (item.isSelect == "on")
                {
                    var timesheetEntry = new TimesheetEntry()
                    {
                        EmployeeCode  = item.EmployeeCode,
                        WorkDate      = item.WorkDate,
                        ManualIn      = item.ManualIn,
                        ManualOut     = item.ManualOut,
                        RequestorNote = item.RequestorNote,
                        ApproverNote  = item.ApproverNote,
                    };

                    timesheetCollection.Add(timesheetEntry);
                }
            }
            switch (Event)
            {
            case "approve":
                timesheetApproveReject.IsApproved = true;
                break;

            case "reject":
                timesheetApproveReject.IsApproved = false;
                break;
            }
            timesheetApproveReject.TimesheetEntryCollection = timesheetCollection;
            timesheetApproveReject.UserLoggedIn             = CurrentUser.EmployeeCode;
            if (timesheetCollection.Count > 0)
            {
                result = ScanTimeApprovalManager.Update(timesheetApproveReject);
            }


            return(Json(new
            {
                objItem,
                Event,
                result,
                JsonRequestBehavior.AllowGet
            }));
        }
Ejemplo n.º 3
0
 public int Put([FromBody] TimesheetApproveReject value)
 {
     return(ScanTimeApprovalManager.UpdateItems(value));
 }