当前位置: 首页>>代码示例>>C#>>正文


C# Inventory.CopyPropertiesFrom方法代码示例

本文整理汇总了C#中Inventory.CopyPropertiesFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Inventory.CopyPropertiesFrom方法的具体用法?C# Inventory.CopyPropertiesFrom怎么用?C# Inventory.CopyPropertiesFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Inventory的用法示例。


在下文中一共展示了Inventory.CopyPropertiesFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            inventoryManager = new InventoryManager(this);
            Inventory inventory = new Inventory();
            original_Inventory = inventoryManager.GetInventory(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProductId"]), Convert.ToInt32(Page.ViewState["DepositId"]));

            if (original_Inventory == null)
                return;
            inventory.CopyPropertiesFrom(original_Inventory);
            inventory.FiscalNumber = txtFiscalNumber.Text;
            inventory.SupplierId = Convert.ToInt32(cboSupplier.SelectedValue);
            inventory.MinimumRequired = ucCurrFieldMinimunRequired.IntValue;
            inventory.Localization = txtLocalization.Text;
            inventory.RealCost = uctxtRealCost.CurrencyValue.Value;
            inventory.Profit = uctxtProfit.CurrencyValue.Value;
            inventory.UnitPrice = uctxtUnitPrice1.CurrencyValue.Value;
            if (!String.IsNullOrEmpty(cboCurrencyRate.SelectedValue))
                inventory.CurrencyRateId = Convert.ToInt32(cboCurrencyRate.SelectedValue);
            if (uctxtUnitPrice2.CurrencyValue.HasValue)
                inventory.UnitPrice2 = uctxtUnitPrice2.CurrencyValue.Value;
            if (uctxtUnitPrice3.CurrencyValue.HasValue)
                inventory.UnitPrice3 = uctxtUnitPrice3.CurrencyValue.Value;
            if (uctxtUnitPrice4.CurrencyValue.HasValue)
                inventory.UnitPrice4 = uctxtUnitPrice4.CurrencyValue.Value;
            if (uctxtUnitPrice5.CurrencyValue.HasValue)
                inventory.UnitPrice5 = uctxtUnitPrice5.CurrencyValue.Value;

            inventoryManager.Update(original_Inventory, inventory);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "parent.location='Inventories.aspx';", true);
        }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:31,代码来源:Inventory_General.aspx.cs

示例2: TransferStockDeposit

        /// <summary>
        /// this method transfer a product Between two deposit
        /// </summary>
        /// <param name="moviment"></param>
        public void TransferStockDeposit(InventoryMoviment moviment, Int32 userId)
        {
            //company Source Inventory Moviment
            InventoryMoviment sourceInventoryMoviment = RetrievePendingTransfers(moviment.InventoryMovementId);

            //company Souce Inventory
            Inventory sourceInventory = GetProductInventory(moviment.CompanyId, moviment.ProductId, moviment.DepositId);

            //company targeting Inventory
            Inventory destinationInventory = GetProductInventory(moviment.CompanyId, moviment.ProductId,
                                                                 moviment.DepositDestinationId);

            //insert Inventory History
            var history = new InventoryHistory();
            history.Quantity = sourceInventory.Quantity;
            history.CurrencyRateId = sourceInventory.CurrencyRateId;
            history.FiscalNumber = sourceInventory.FiscalNumber;
            history.Localization = sourceInventory.Localization;
            history.MinimumRequired = sourceInventory.MinimumRequired;
            history.ProductId = sourceInventory.ProductId;
            history.Profit = sourceInventory.Profit;
            history.RealCost = sourceInventory.RealCost;
            history.SupplierId = sourceInventory.SupplierId;
            history.UnitPrice = sourceInventory.UnitPrice;
            history.CompanyId = moviment.CompanyId;
            history.DepositId = sourceInventory.DepositId;
            history.DestinationDepositId = moviment.DepositDestinationId;
            history.InventoryEntryTypeId = (int)EntryType.Transfer;
            history.LogDate = DateTime.Now;
            history.UserId = userId;
            //insert History
            InsertHistory(history);

            if (destinationInventory != null)
            {
                //set the new AverageCost
                destinationInventory.AverageCosts =
                    ((destinationInventory.Quantity * destinationInventory.UnitPrice
                      + sourceInventoryMoviment.Quantity * sourceInventory.UnitPrice) /
                     (sourceInventoryMoviment.Quantity + destinationInventory.Quantity));

                //set the new Quantity
                destinationInventory.Quantity += sourceInventoryMoviment.Quantity;
            }
            else
            {
                //insert a Inventory if the product not exists in the target inventory
                //set the new depositId and companyId
                var newInventory = new Inventory();
                newInventory.CopyPropertiesFrom(sourceInventory);
                newInventory.DepositId = moviment.DepositDestinationId;
                newInventory.CompanyId = moviment.CompanyId;
                Insert(newInventory);
            }


            //delete Moviment
            DeleteMovement(moviment);

            //submit changes
            DbContext.SubmitChanges();
        }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:66,代码来源:StockManager.extender.cs


注:本文中的Inventory.CopyPropertiesFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。