Exemplo n.º 1
0
        public static tbl_PurchaseOrderDetails MapToModel(PurchasOrderDetailsViewModel objectToBeMapped)
        {
            var detail1 = objectToBeMapped;
            var retVal  = detail1.Iserial == null ? new tbl_PurchaseOrderDetails
            {
                Color                            = detail1.StyleColor ?? "",
                PurchasePrice                    = detail1.Price,
                StyleCode                        = detail1.StyleHeader,
                DelivaryDate                     = detail1.DelivaryDate,
                Trans_TransactionHeader          = detail1.ParentTransID,
                tbl_PurchaseOrder_AdditionalCost =
                    new ObservableCollection <tbl_PurchaseOrder_AdditionalCost>(detail1.AdditionalCostList)
            }
                :
            new tbl_PurchaseOrderDetails
            {
                Iserial                          = (int)detail1.Iserial,
                Color                            = detail1.StyleColor ?? "",
                PurchasePrice                    = detail1.Price,
                StyleCode                        = detail1.StyleHeader,
                DelivaryDate                     = detail1.DelivaryDate,
                Trans_TransactionHeader          = detail1.ParentTransID,
                tbl_PurchaseOrder_AdditionalCost =
                    new ObservableCollection <tbl_PurchaseOrder_AdditionalCost>(detail1.AdditionalCostList)
            }
            ;

            retVal.tbl_PurchaseOrderSizeDetails = new ObservableCollection <tbl_PurchaseOrderSizeDetails>
                                                  (
                detail1.PurchaseOrderSizes
                .Where(x => x.IsTextBoxEnabled)
                .Select(sizeDetail => sizeDetail.Iserial != null ? new tbl_PurchaseOrderSizeDetails
            {
                Iserial = (int)sizeDetail.Iserial,
                Size    = sizeDetail.SizeCode,
                Qty     =
                    int.Parse(
                        sizeDetail.SizeConsumption.ToString(CultureInfo.InvariantCulture))
                ,
                Ratio =
                    double.Parse(
                        sizeDetail.SizeRatio.ToString(CultureInfo.InvariantCulture))
            } : new tbl_PurchaseOrderSizeDetails
            {
                Size = sizeDetail.SizeCode,
                Qty  =
                    int.Parse(
                        sizeDetail.SizeConsumption.ToString(CultureInfo.InvariantCulture))
                ,
                Ratio =
                    double.Parse(
                        sizeDetail.SizeRatio.ToString(CultureInfo.InvariantCulture))
            })
                                                  );

            return(retVal);
        }
Exemplo n.º 2
0
 public static _proxy.tbl_PurchaseOrderDetails MapToModelObject(PurchasOrderDetailsViewModel objectToBeMapped)
 {
     return(null);
 }