Example #1
0
 public static void ConvertReqItemsToModelItems(RequisitionRequest request, CoreModel.Requisition modelReq)
 {
     modelReq.RequisitionItems = new List <CoreModel.RequisitionItem>();
     foreach (RequisitionItemRequest item in request.Items)
     {
         modelReq.RequisitionItems.Add(
             new CoreModel.RequisitionItem()
         {
             SupplierItemID = item.ItemId,
             NeededQuantity = item.NeededQuantity
         });
     }
 }
Example #2
0
    public static RequisitionResponse ConvertReqModelToResDC(CoreModel.Requisition req)
    {
        UserController uCtrl = new UserController();

        return(new RequisitionResponse()
        {
            ApprovedBy = uCtrl.GetUserNameByUserId(req.ApprovedRejectedByID),
            ApprovedDate = req.ApprovedDate.HasValue ? req.ApprovedDate.Value.ToString("dd-MMM-yy") : DateTime.Now.ToString("dd-MMM-yy"),
            CreatedBy = uCtrl.GetUserNameByUserId(req.RequesterID),
            DepartmentCode = req.Department.DepartmentCode,
            DepartmentName = req.Department.DepartmentName,
            RequisitionDate = req.ReqDate.ToString("dd-MMM-yy"),
            RequisitionNum = req.ReqNumber,
            UserId = req.RequesterID.ToString(),
            RequisitionId = req.ReqID
        });
    }
 public bool CreateRequisition(RequisitionRequest request)
 {
     CoreModel.Requisition modelReq = Convertor.ConvertReqDCToReqModel(request);
     Convertor.ConvertReqItemsToModelItems(request, modelReq);
     return(new ApplyReqController().CreateRequisition(modelReq));
 }