public string loadAllRejectedRequisitions(String accessToken) { OAuthController oAuth = new OAuthController(); User user = oAuth.actionGetUserByToken(accessToken); RequisitionController requisitionController = new RequisitionController(); // hard coded user id = 6 // List<Requisition> requisition_entities =requisitionController.actionGetPendingRequisitionsByUserID(6); List<Requisition> requisition_entities = requisitionController.actionGetRejectedRequisitionsByUserID(user.id); List<RequisitionModel> model = new List<RequisitionModel>(); StationeryController stationeryController = new StationeryController(); List<StationaryRequests> stationeryRequests = new List<StationaryRequests>(); foreach (Requisition r in requisition_entities) { StationaryRequests stationaryRequests = new StationaryRequests(); stationaryRequests.Quantity = r.quantity; stationaryRequests.StationaryName = stationeryController.actionGetStationeryByID(r.stationery).stationery_name; stationaryRequests.RequestedDate = r.datetime_requested.ToString(); stationaryRequests.RejectReason = r.reject_remark; stationeryRequests.Add(stationaryRequests); } return JsonConvert.SerializeObject(stationeryRequests); }
public static string loadRejectedRequests() { User user = (User)HttpContext.Current.Session["user"]; if (user == null) { return null; } int empId = user.id; //-------------------------------------------------------------- JavaScriptSerializer js = new JavaScriptSerializer(); RequisitionController requisitionController = new RequisitionController(); // hard coded user id = 6 // List<Requisition> requisition_entities =requisitionController.actionGetPendingRequisitionsByUserID(6); List<Requisition> requisition_entities = requisitionController.actionGetRejectedRequisitionsByUserID(empId); List<RequisitionModel> model = new List<RequisitionModel>(); StationeryController stationeryController = new StationeryController(); List<StationaryRequests> stationeryRequests = new List<StationaryRequests>(); foreach (Requisition r in requisition_entities) { StationaryRequests stationaryRequests = new StationaryRequests(); stationaryRequests.Quantity = r.quantity; stationaryRequests.StrationeryName = stationeryController.actionGetStationeryByID(r.stationery).stationery_name; stationaryRequests.RequestedDate = r.datetime_requested.ToString("MMMM dd, yyyy"); stationaryRequests.RejectReason = r.reject_remark; stationeryRequests.Add(stationaryRequests); } // System.Diagnostics.Debug.WriteLine("check @@@@@@@@@@@@ Rejected:" + js.Serialize(stationeryRequests)); return js.Serialize(stationeryRequests); }