Ejemplo n.º 1
0
        public TimeSheetRegisterModel MapTimesheetRegisterModel(TimeSheetViewModel timesheetviewmodel)
        {
            var MapRegisterData = new TimeSheetRegisterModel()
            {
                ProjectID           = timesheetviewmodel.TimeSheetRegisterModel.ProjectID,
                WarehouseNameId     = timesheetviewmodel.TimeSheetRegisterModel.WarehouseNameId,
                OpportunityNumberID = timesheetviewmodel.TimeSheetRegisterModel.OpportunityNumberID,
                CandidateNameId     = timesheetviewmodel.TimeSheetRegisterModel.CandidateNameId,
                ServiceActivityId   = timesheetviewmodel.ServiceActivityID,
                OLATarget           = timesheetviewmodel.TimeSheetRegisterModel.OLATarget,
                ActualQuantity      = timesheetviewmodel.TimeSheetRegisterModel.ActualQuantity,
                Colour            = timesheetviewmodel.TimeSheetRegisterModel.Colour,
                StartTime         = timesheetviewmodel.TimeSheetRegisterModel.StartTime,
                EndTime           = timesheetviewmodel.TimeSheetRegisterModel.EndTime,
                Day               = timesheetviewmodel.TimeSheetRegisterModel.Day,
                TimeSheetComments = timesheetviewmodel.TimeSheetRegisterModel.TimeSheetComments,
            };

            return(MapRegisterData);
        }
Ejemplo n.º 2
0
        public static async Task <ReturnModel> RegisterTimesheetModel(TimeSheetRegisterModel RegisterModel)
        {
            ReturnModel ReturnResult = new ReturnModel();

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(TimeSheetAPIURl);
                HttpResponseMessage response = client.PostAsJsonAsync(string.Format("TimeSheet/Register"), RegisterModel).Result;
                if (response.IsSuccessStatusCode)
                {
                    ReturnResult = await response.Content.ReadAsAsync <ReturnModel>();

                    HttpContext.Current.Session["ResultMessage"] = ReturnResult.Message;
                }
                else
                {
                    HttpContext.Current.Session["ErrorMessage"] = ReturnResult.Message;
                }
            }
            return(ReturnResult);
        }
Ejemplo n.º 3
0
        public ActionResult PostResourceData(TimeSheetViewModel theModel)
        {
            for (int i = 0; i < theModel.ResourceIDs.Count; i++)
            {
                TimeSheetRegisterModel regModel = new TimeSheetRegisterModel();
                regModel.CandidateNameId = theModel.ResourceIDs[i];
                regModel.Colour          = theModel.Colour;
                regModel.Day             = theModel.Day;
                regModel.EndTime         = theModel.EndTime;
                regModel.Id                  = theModel.Id;
                regModel.OLATarget           = theModel.OLATarget;
                regModel.OpportunityNumberID = theModel.OpportunityID;
                regModel.ProjectID           = theModel.ProjectID;
                regModel.ServiceActivityId   = theModel.ServiceActivityID;
                regModel.StartTime           = theModel.StartTime;
                regModel.StatusID            = theModel.StatusID;
                regModel.WarehouseNameId     = theModel.WarehouseID;

                var test = RegisterTimesheetService.RegisterTimesheetModel(regModel);
            }
            return(RedirectToAction("Index", "ManageCalender"));
        }