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


C# OrderDetail.LoadByPrimaryKey方法代码示例

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


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

示例1: LoadOptionsForOrderDetail

        /// <summary>
        /// The code supports manufacturer preference here too but we choose not to prefer manufacturers when looking into the stores.
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="orderDetailID"></param>
        /// <param name="pricedUnpricedBoth"></param>
        /// <param name="bal"> </param>
        /// <param name="markStockoutBit"> </param>
        /// <param name="usableStock"> </param>
        /// <param name="approved"> </param>
        public decimal LoadOptionsForOrderDetail(int userID, int orderDetailID, PriceSettings pricedUnpricedBoth, Balance bal, bool markStockoutBit, out decimal usableStock, out decimal approved)
        {
            decimal avQuantity = 0;

            BLL.OrderDetail orderDetail = new OrderDetail();
            orderDetail.LoadByPrimaryKey(orderDetailID);
            BLL.Order order = new Order();
            order.LoadByPrimaryKey(orderDetail.OrderID);

            Institution ru = new Institution();
            ru.LoadByPrimaryKey(order.RequestedBy);

            int month = EthiopianDate.EthiopianDate.Now.Month;
            int year = EthiopianDate.EthiopianDate.Now.Year;

            decimal availableQty = 0;
            usableStock = 0;
            approved = 0;
            int? manufacturerPrefrence = null, unitID = null;
            if (!orderDetail.IsColumnNull("PreferredManufacturerID"))
            {
                manufacturerPrefrence = orderDetail.PreferredManufacturerID;
            }

            DateTime? expPreferrence = null;
            if(!orderDetail.IsColumnNull("PreferredExpiryDate"))
            {
                expPreferrence = orderDetail.PreferredExpiryDate;
            }

            int? preferredPhysicalStoreID = null;
            if (!orderDetail.IsColumnNull("PreferredPhysicalStoreID"))
            {
                preferredPhysicalStoreID = orderDetail.PreferredPhysicalStoreID;
            }

            //--------------------------------------------------------------------------
            //manufacturerPrefrence = null; //We are overriding the manufacturer preference.
            //expPreferrence = null;
            //--------------------------------------------------------------------------
            if (!orderDetail.IsColumnNull("UnitID"))
            {
                unitID = orderDetail.UnitID;
            }

            BLL.UserActivity userStore = new UserActivity();

            // Definitely a danger zone
            userStore.LoadByUserIDAndStoreType(userID, order.FromStore, orderDetail.ItemID, unitID.Value);

            while (!userStore.EOF)
            {
                var activity = new Activity();
                 activity.LoadByPrimaryKey(userStore.ActivityID);

                if(order.FromStore == Mode.Constants.RDF && !BLL.Settings.IsCenter && !BLL.Settings.PrivateCanGetFromMDGAndPBS && ru.Ownership == OwnershipType.Constants.Private && activity.IsSubsidized ){
                    userStore.MoveNext();
                    continue;
                }

               // Load the Activity Selection that has PRiced Commodities.
                Balance balance = new Balance();
                if (pricedUnpricedBoth == PriceSettings.PRICED_ONLY || pricedUnpricedBoth == PriceSettings.BOTH)
                {
                    BLL.Order.MakeStockCalculations(userID, month, year, PriceSettings.PRICED_ONLY, orderDetail,
                                                    userStore.ActivityID, orderDetail.ItemID, order, balance, unitID,
                                                    manufacturerPrefrence, expPreferrence, preferredPhysicalStoreID, out usableStock, out approved,
                                                    out availableQty, markStockoutBit);
                    avQuantity += availableQty;

                    if (availableQty > 0)
                    {

                        this.AddNew();
                        this.ID = userStore.ActivityID;
                        this.Name = string.Format("{0} ({1})", activity.FullActivityName, availableQty.ToString("#,##0"));
                        PrepareColumnsForApproval();
                        this.SetColumn("AvailableSKU", availableQty);
                        this.SetColumn("IsDeliveryNote", false);
                        this.SetColumn("TextID",string.Format("N{0}",this.ID));
                    }
                }

                // Load Activity Selections for Delivery Note Items.
                if (pricedUnpricedBoth == PriceSettings.DELIVERY_NOTE_ONLY || pricedUnpricedBoth == PriceSettings.BOTH)
                {
                    BLL.Order.MakeStockCalculations(userID, month, year, PriceSettings.DELIVERY_NOTE_ONLY, orderDetail,
                                                    userStore.ActivityID, orderDetail.ItemID, order, balance, unitID,
                                                    manufacturerPrefrence, expPreferrence, preferredPhysicalStoreID, out usableStock, out approved,
                                                    out availableQty, markStockoutBit);
//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:101,代码来源:Activity.cs


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