public IList <INVStoreIssueNoteItemMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <INVStoreIssueNoteItemMapEntity> iNVStoreIssueNoteItemMapEntityList = new List <INVStoreIssueNoteItemMapEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = INVStoreIssueNoteItemMapEntity.FLD_NAME_StoreIssueNoteItemMapID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                iNVStoreIssueNoteItemMapEntityList = FCCINVStoreIssueNoteItemMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(iNVStoreIssueNoteItemMapEntityList ?? new List <INVStoreIssueNoteItemMapEntity>());
        }
Ejemplo n.º 2
0
        protected void lvINVStoreIssueNoteItemMap_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 StoreIssueNoteItemMapID;

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

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(INVStoreIssueNoteItemMapEntity.FLD_NAME_StoreIssueNoteItemMapID, StoreIssueNoteItemMapID.ToString(), SQLMatchType.Equal);

                        INVStoreIssueNoteItemMapEntity iNVStoreIssueNoteItemMapEntity = new INVStoreIssueNoteItemMapEntity();


                        result = FCCINVStoreIssueNoteItemMap.GetFacadeCreate().Delete(iNVStoreIssueNoteItemMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _StoreIssueNoteItemMapID        = 0;
                            _INVStoreIssueNoteItemMapEntity = new INVStoreIssueNoteItemMapEntity();
                            PrepareInitialView();
                            BindINVStoreIssueNoteItemMapList();

                            MiscUtil.ShowMessage(lblMessage, "I NVStore Issue Note Item Map has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete I NVStore Issue Note Item Map.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <INVStoreIssueNoteItemMapEntity> GetData()
        {
            IList <INVStoreIssueNoteItemMapEntity> iNVStoreIssueNoteItemMapEntityList = new List <INVStoreIssueNoteItemMapEntity>();

            try
            {
                iNVStoreIssueNoteItemMapEntityList = FCCINVStoreIssueNoteItemMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(iNVStoreIssueNoteItemMapEntityList ?? new List <INVStoreIssueNoteItemMapEntity>());
        }
        private void BuildINVStoreIssueNoteItemMapEntity(Int64 sinID, Int64 projectID)
        {
            try
            {
                String fe_itemMap = SqlExpressionBuilder.PrepareFilterExpression(PRMMaterialReceiveItemMapEntity.FLD_NAME_MaterialReceiveID, ddlMaterialReceiveID.SelectedValue.ToString(), SQLMatchType.Equal);
                IList <PRMMaterialReceiveItemMapEntity> lst = FCCPRMMaterialReceiveItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_itemMap, DatabaseOperationType.LoadWithFilterExpression);

                if (lst != null && lst.Count > 0)
                {
                    foreach (PRMMaterialReceiveItemMapEntity ent in lst)
                    {
                        INVStoreIssueNoteItemMapEntity iNVStoreIssueNoteItemMapEntity = new INVStoreIssueNoteItemMapEntity();

                        REQRequisitionItemEntity rEQRequisitionItemEntity = FCCREQRequisitionItem.GetFacadeCreate().GetByID(ent.RequisitionItemID);

                        if (rEQRequisitionItemEntity != null && rEQRequisitionItemEntity.ItemID > 0)
                        {
                            iNVStoreIssueNoteItemMapEntity.StoreIssueNoteID = sinID;
                            iNVStoreIssueNoteItemMapEntity.ItemID           = rEQRequisitionItemEntity.ItemID;
                            iNVStoreIssueNoteItemMapEntity.FolioNo          = String.Empty;
                            iNVStoreIssueNoteItemMapEntity.RequestQty       = ent.ReceiveQty;
                            iNVStoreIssueNoteItemMapEntity.IssueQty         = ent.ReceiveQty;
                        }

                        String fe_transaction1 = SqlExpressionBuilder.PrepareFilterExpression(INVTransactionEntity.FLD_NAME_ItemID, rEQRequisitionItemEntity.ItemID.ToString(), SQLMatchType.Equal);
                        String fe_transaction2 = SqlExpressionBuilder.PrepareFilterExpression(INVTransactionEntity.FLD_NAME_MRRNumber, ddlMaterialReceiveID.Text.ToString(), SQLMatchType.Equal);
                        String fe_transaction  = SqlExpressionBuilder.PrepareFilterExpression(fe_transaction1, SQLJoinType.AND, fe_transaction2);

                        IList <INVTransactionEntity> lstINVTransactionEntity = FCCINVTransaction.GetFacadeCreate().GetIL(null, null, String.Empty, fe_transaction, DatabaseOperationType.LoadWithFilterExpression);

                        if (lstINVTransactionEntity != null && lstINVTransactionEntity.Count > 0)
                        {
                            iNVStoreIssueNoteItemMapEntity.BatchNo = lstINVTransactionEntity[0].BatchNumber;
                        }

                        //    iNVStoreIssueNoteItemMapEntity.BatchNo = txtBatchNo.Text.Trim();
                        String fe_store1 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreEntity.FLD_NAME_ProjectID, projectID.ToString(), SQLMatchType.Equal);
                        String fe_store2 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreEntity.FLD_NAME_IsDefault, "1", SQLMatchType.Equal);
                        String fe_store  = SqlExpressionBuilder.PrepareFilterExpression(fe_store1, SQLJoinType.AND, fe_store2);

                        IList <INVStoreEntity> lstINVStoreEntity = FCCINVStore.GetFacadeCreate().GetIL(null, null, String.Empty, fe_store, DatabaseOperationType.LoadWithFilterExpression);

                        if (lstINVStoreEntity != null && lstINVStoreEntity.Count > 0)
                        {
                            iNVStoreIssueNoteItemMapEntity.IssuedFromStoreID = lstINVStoreEntity[0].StoreID;

                            String fe_storeUnit1 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreUnitEntity.FLD_NAME_StoreID, lstINVStoreEntity[0].StoreID.ToString(), SQLMatchType.Equal);
                            String fe_storeUnit2 = SqlExpressionBuilder.PrepareFilterExpression(INVStoreUnitEntity.FLD_NAME_IsDefault, "1", SQLMatchType.Equal);
                            String fe_storeUnit  = SqlExpressionBuilder.PrepareFilterExpression(fe_storeUnit1, SQLJoinType.AND, fe_storeUnit2);

                            IList <INVStoreUnitEntity> lstINVStoreUnitEntity = FCCINVStoreUnit.GetFacadeCreate().GetIL(null, null, String.Empty, fe_storeUnit, DatabaseOperationType.LoadWithFilterExpression);

                            if (lstINVStoreUnitEntity != null && lstINVStoreUnitEntity.Count > 0)
                            {
                                iNVStoreIssueNoteItemMapEntity.IssuedFromStoreUnitID = lstINVStoreUnitEntity[0].StoreUnitID;
                            }
                        }


                        iNVStoreIssueNoteItemMapEntity.ReceivedDate         = System.DateTime.Now;
                        iNVStoreIssueNoteItemMapEntity.ReceivedByEmployeeID = 168;

                        iNVStoreIssueNoteItemMapEntity.ReturnQty            = null;
                        iNVStoreIssueNoteItemMapEntity.ReturnDate           = null;
                        iNVStoreIssueNoteItemMapEntity.ReturnToStoreID      = null;
                        iNVStoreIssueNoteItemMapEntity.ReturnToStoreUnitID  = null;
                        iNVStoreIssueNoteItemMapEntity.ReturnedByEmployeeID = null;

                        iNVStoreIssueNoteItemMapEntity.ActualUse = null;
                        iNVStoreIssueNoteItemMapEntity.Amount    = ent.WOItemTotalRate / ent.ReceiveQty;

                        iNVStoreIssueNoteItemMapEntity.PurposeOfWorks = "Adjustment Entry";

                        INVStoreEntity storeEntity = INVManager.GetDefaultStore(projectID);

                        INVStoreUnitEntity storeUnitEntity = INVManager.GetDefaultStoreUnit(storeEntity.StoreID);

                        iNVStoreIssueNoteItemMapEntity.IssuedFromStoreID = storeEntity.StoreID;
                        iNVStoreIssueNoteItemMapEntity.IssuedFromStoreID = storeUnitEntity.StoreUnitID;

                        FCCINVStoreIssueNoteItemMap.GetFacadeCreate().Add(iNVStoreIssueNoteItemMapEntity, DatabaseOperationType.Add, TransactionRequired.No);

                        #region Inventory


                        String  batchNumber    = String.Empty;
                        Decimal transactionQty = 0;
                        Boolean invResult      = false;

                        invResult = INVManager.RemoveItemsFromStoreUnit(rEQRequisitionItemEntity.ItemID, rEQRequisitionItemEntity.BrandID, rEQRequisitionItemEntity.RegionID, rEQRequisitionItemEntity.CountryID, lstINVTransactionEntity[0].BatchNumber, Int64.Parse(transactionQty.ToString()), MiscUtil.GetLocalIP(), MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember), 0, String.Empty, String.Empty, String.Empty, "", projectID, storeEntity.StoreID, storeUnitEntity.StoreUnitID);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Some Error Occured " + ex.Message, true);
            }
        }