コード例 #1
0
        public IList <INVStoreUnitItemEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <INVStoreUnitItemEntity> iNVStoreUnitItemEntityList = new List <INVStoreUnitItemEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = INVStoreUnitItemEntity.FLD_NAME_StoreUnitItemID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                iNVStoreUnitItemEntityList = FCCINVStoreUnitItem.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (iNVStoreUnitItemEntityList != null && iNVStoreUnitItemEntityList.Count > 0)
                {
                    totalRowCount = iNVStoreUnitItemEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(iNVStoreUnitItemEntityList ?? new List <INVStoreUnitItemEntity>());
        }
コード例 #2
0
        protected void lvINVStoreUnitItem_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 StoreUnitItemID;

            Int64.TryParse(e.CommandArgument.ToString(), out StoreUnitItemID);

            if (StoreUnitItemID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _StoreUnitItemID = StoreUnitItemID;

                    PrepareEditView();
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(INVStoreUnitItemEntity.FLD_NAME_StoreUnitItemID, StoreUnitItemID.ToString(), SQLMatchType.Equal);

                        INVStoreUnitItemEntity iNVStoreUnitItemEntity = new INVStoreUnitItemEntity();


                        result = FCCINVStoreUnitItem.GetFacadeCreate().Delete(iNVStoreUnitItemEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _StoreUnitItemID        = 0;
                            _INVStoreUnitItemEntity = new INVStoreUnitItemEntity();
                            PrepareInitialView();
                            BindINVStoreUnitItemList();

                            MiscUtil.ShowMessage(lblMessage, "I NVStore Unit Item has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete I NVStore Unit Item.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #3
0
        public IList <INVStoreUnitItemEntity> GetData()
        {
            IList <INVStoreUnitItemEntity> iNVStoreUnitItemEntityList = new List <INVStoreUnitItemEntity>();

            try
            {
                iNVStoreUnitItemEntityList = FCCINVStoreUnitItem.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (iNVStoreUnitItemEntityList != null && iNVStoreUnitItemEntityList.Count > 0)
                {
                    totalRowCount = iNVStoreUnitItemEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(iNVStoreUnitItemEntityList ?? new List <INVStoreUnitItemEntity>());
        }
コード例 #4
0
        public static Boolean RemoveItemsFromStoreUnit(Int64 itemID, Int64 brandID, Int64 regionID, Int64 countryID, String batchNumber, Int64 transactionQty, String iPAddress, Int64 employeeID, Decimal unitPrice, String requisitionNumber, String wordOrderNumber, String mRRNumber, String billNumber, Int64?projectID, Int64 storeID, Int64 storeUnitID, Boolean isTransfer)
        {
            Boolean result = false;

            try
            {
                #region Tran

                INVTransactionEntity ent = new INVTransactionEntity();

                ent.ItemID               = itemID;
                ent.BrandID              = brandID;
                ent.RegionID             = regionID;
                ent.CountryID            = countryID;
                ent.BatchNumber          = batchNumber;
                ent.TransactionQty       = transactionQty;
                ent.TransactionDate      = DateTime.Now;
                ent.TransactionDirection = false;
                ent.IPAddress            = iPAddress;
                ent.EmployeeID           = employeeID;
                ent.UnitPrice            = unitPrice;
                ent.RequisitionNumber    = requisitionNumber;
                ent.WordOrderNumber      = wordOrderNumber;
                ent.MRRNumber            = mRRNumber;
                ent.BillNumber           = billNumber;
                ent.IsTransfer           = isTransfer;
                ent.ProjectID            = projectID;
                ent.StoreID              = storeID;
                ent.StoreUnitID          = storeUnitID;

                FCCINVTransaction.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);

                #endregion


                #region Unit Item

                String fe11 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreUnitItemEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);
                String fe12 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreUnitItemEntity.FLD_NAME_StoreUnitID, storeUnitID.ToString(), SQLMatchType.Equal);
                String fe1  = SqlExpressionBuilder.PrepareFilterExpression(fe11, SQLJoinType.AND, fe12);
                IList <INVStoreUnitItemEntity> lst1 = FCCINVStoreUnitItem.GetFacadeCreate().GetIL(null, null, String.Empty, fe1, DatabaseOperationType.LoadWithFilterExpression);

                if (lst1 != null && lst1.Count > 0)
                {
                    INVStoreUnitItemEntity ent1 = lst1[0];

                    //Rayan vaiya recommand to do this
                    //if (ent1.UnitCurrentStock - transactionQty > 0) ent1.UnitCurrentStock -= transactionQty;
                    //else
                    //{
                    //    return false;
                    //}
                    //This code skipped by rayan vaiya over phone - 22-Jul-13


                    ent1.UnitCurrentStock -= transactionQty;

                    String fe_up1 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreUnitItemEntity.FLD_NAME_StoreUnitItemID, ent1.StoreUnitItemID.ToString(), SQLMatchType.Equal);

                    FCCINVStoreUnitItem.GetFacadeCreate().Update(ent1, fe_up1, DatabaseOperationType.Update, TransactionRequired.No);
                }
                else
                {
                    INVStoreUnitItemEntity ent1 = new INVStoreUnitItemEntity();

                    ent1.StoreUnitID       = storeUnitID;
                    ent1.ItemID            = itemID;
                    ent1.BrandID           = brandID;
                    ent1.RegionID          = regionID;
                    ent1.CountryID         = countryID;
                    ent1.UnitCurrentStock  = 0;
                    ent1.UnitCurrentStock -= transactionQty;

                    FCCINVStoreUnitItem.GetFacadeCreate().Add(ent1, DatabaseOperationType.Add, TransactionRequired.No);
                }

                #endregion


                #region Total Item

                String fe2 = SqlExpressionBuilder.PrepareFilterExpression(INVCurrentStockEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);
                IList <INVCurrentStockEntity> lst2 = FCCINVCurrentStock.GetFacadeCreate().GetIL(null, null, String.Empty, fe2, DatabaseOperationType.LoadWithFilterExpression);

                if (lst2 != null && lst2.Count > 0)
                {
                    INVCurrentStockEntity ent2 = lst2[0];

                    ent2.UnitCurrentStock -= transactionQty;

                    String fe_up2 = SqlExpressionBuilder.PrepareFilterExpression(INVCurrentStockEntity.FLD_NAME_CurrentStockID, ent2.CurrentStockID.ToString(), SQLMatchType.Equal);

                    FCCINVCurrentStock.GetFacadeCreate().Update(ent2, fe_up2, DatabaseOperationType.Update, TransactionRequired.No);
                }
                else
                {
                    INVCurrentStockEntity ent2 = new INVCurrentStockEntity();

                    ent2.ItemID            = itemID;
                    ent2.BrandID           = brandID;
                    ent2.RegionID          = regionID;
                    ent2.CountryID         = countryID;
                    ent2.UnitCurrentStock  = 0;
                    ent2.UnitCurrentStock -= transactionQty;

                    FCCINVCurrentStock.GetFacadeCreate().Add(ent2, DatabaseOperationType.Add, TransactionRequired.No);
                }

                #endregion


                result = true;
            }
            catch (Exception ex)
            {
            }

            return(result);
        }