public static RegionalRequestViewModel BindRegionalRequestViewModel(RegionalRequest regionalRequest, List<WorkflowStatus> statuses, string userPrefrence) { var regionalRequestViewModel = new RegionalRequestViewModel(); regionalRequestViewModel.ProgramId = regionalRequest.ProgramId; regionalRequestViewModel.Program = regionalRequest.Program.Name; regionalRequestViewModel.Region = regionalRequest.AdminUnit.Name; regionalRequestViewModel.ReferenceNumber = regionalRequest.ReferenceNumber; regionalRequestViewModel.RegionID = regionalRequest.RegionID; regionalRequestViewModel.RegionalRequestID = regionalRequest.RegionalRequestID; regionalRequestViewModel.Remark = regionalRequest.Remark; regionalRequestViewModel.RequestDate = regionalRequest.RequistionDate.ToCTSPreferedDateFormat(userPrefrence); regionalRequestViewModel.Round = regionalRequest.Round; //RequestDateEt = EthiopianDate.GregorianToEthiopian(regionalRequest.RequistionDate); regionalRequestViewModel.MonthName = RequestHelper.GetMonthList().Find(t => t.Id == regionalRequest.Month).Name; regionalRequest.Month = regionalRequest.Month; regionalRequestViewModel.Status = statuses.Find(t => t.WorkflowID == (int)WORKFLOW.REGIONAL_REQUEST && t.StatusID == regionalRequest.Status).Description; // regionalRequestViewModel. RequistionDate = regionalRequest.RequistionDate; regionalRequestViewModel.StatusID = regionalRequest.Status; regionalRequestViewModel.Ration = regionalRequest.Ration.RefrenceNumber; regionalRequestViewModel.RationID = regionalRequest.RationID; regionalRequestViewModel.Year = regionalRequest.Year; regionalRequestViewModel.PlanId = regionalRequest.PlanID; return regionalRequestViewModel; }
public static RegionalRequest BindRegionalRequest(RegionalRequestViewModel regionalRequestViewModel, RegionalRequest request = null) { if (request == null) request = new RegionalRequest(); request.ProgramId = regionalRequestViewModel.ProgramId; request.ReferenceNumber = regionalRequestViewModel.ReferenceNumber; request.RegionID = regionalRequestViewModel.RegionID; request.RegionalRequestID = regionalRequestViewModel.RegionalRequestID; request.Remark = regionalRequestViewModel.Remark; request.Month = regionalRequestViewModel.Month; request.RequistionDate = regionalRequestViewModel.RequistionDate; request.Round = regionalRequestViewModel.Round; request.Status = regionalRequestViewModel.StatusID; request.Year = regionalRequestViewModel.Year; // request.DonorID= return request; }
public static RegionalRequestViewModel BindRegionalRequestViewModel(RegionalRequest regionalRequest, List<WorkflowStatus> statuses, string userPrefrence) { var regionalRequestViewModel = new RegionalRequestViewModel(); if (regionalRequest == null) { return regionalRequestViewModel; } regionalRequestViewModel.ProgramId = regionalRequest.ProgramId; regionalRequestViewModel.Program = regionalRequest.Program.Name; regionalRequestViewModel.Region = regionalRequest.AdminUnit.Name; regionalRequestViewModel.ReferenceNumber = regionalRequest.ReferenceNumber; regionalRequestViewModel.RegionID = regionalRequest.RegionID; regionalRequestViewModel.RegionalRequestID = regionalRequest.RegionalRequestID; regionalRequestViewModel.Remark = regionalRequest.Remark; regionalRequestViewModel.RequestDate = regionalRequest.RequistionDate.ToCTSPreferedDateFormat(userPrefrence); regionalRequestViewModel.Round = regionalRequest.Round; //RequestDateEt = EthiopianDate.GregorianToEthiopian(regionalRequest.RequistionDate); regionalRequestViewModel.MonthName = RequestHelper.GetMonthList().Find(t => t.Id == regionalRequest.Month).Name; regionalRequest.Month = regionalRequest.Month; regionalRequestViewModel.Status = statuses.Find(t => t.WorkflowID == (int)WORKFLOW.REGIONAL_REQUEST && t.StatusID == regionalRequest.Status).Description; // regionalRequestViewModel. RequistionDate = regionalRequest.RequistionDate; regionalRequestViewModel.StatusID = regionalRequest.Status; if (regionalRequest.Ration != null) regionalRequestViewModel.Ration = regionalRequest.Ration.RefrenceNumber; regionalRequestViewModel.RationID = regionalRequest.RationID; regionalRequestViewModel.Year = regionalRequest.Year; regionalRequestViewModel.PlanId = regionalRequest.PlanID; if (regionalRequest.UserProfile != null) regionalRequestViewModel.RequestedBy = regionalRequest.UserProfile.FirstName + " " + regionalRequest.UserProfile.LastName; if (regionalRequest.UserProfile1 != null && regionalRequest.Status == (int) Cats.Models.Constant.RegionalRequestStatus.Approved) regionalRequestViewModel.ApprovedBy = regionalRequest.UserProfile1.FirstName + " " + regionalRequest.UserProfile1.LastName; return regionalRequestViewModel; }