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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = REQRequisitionItemEntity.FLD_NAME_RequisitionItemID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                rEQRequisitionItemEntityList = FCCREQRequisitionItem.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(rEQRequisitionItemEntityList ?? new List <REQRequisitionItemEntity>());
        }
예제 #2
0
        private void SaveREQRequisitionItemEntity()
        {
            if (IsValid)
            {
                try
                {
                    REQRequisitionItemEntity rEQRequisitionItemEntity = BuildREQRequisitionItemEntity();

                    Int64 result = -1;

                    if (rEQRequisitionItemEntity.IsNew)
                    {
                        result = FCCREQRequisitionItem.GetFacadeCreate().Add(rEQRequisitionItemEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionItemID, rEQRequisitionItemEntity.RequisitionItemID.ToString(), SQLMatchType.Equal);
                        result = FCCREQRequisitionItem.GetFacadeCreate().Update(rEQRequisitionItemEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _RequisitionItemID        = 0;
                        _REQRequisitionItemEntity = new REQRequisitionItemEntity();
                        PrepareInitialView();
                        BindREQRequisitionItemList();

                        if (rEQRequisitionItemEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "R EQRequisition Item Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "R EQRequisition Item Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (rEQRequisitionItemEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add R EQRequisition Item Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update R EQRequisition Item Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #3
0
        private void SaveREQRequisitionItemEntity()
        {
            try
            {
                IList <ListViewDataItem> list = lvREQRequisitionItem.Items;

                if (list != null && list.Count > 0)
                {
                    foreach (ListViewDataItem lvdi in list)
                    {
                        Decimal PresentRequiredQty;
                        Int64   ItemID;

                        Label   lblItemID             = (Label)lvdi.FindControl("lblItemLV");
                        Label   lblQtyLV              = (Label)lvdi.FindControl("lblQtyLV");
                        Label   lblPurchasedQty       = (Label)lvdi.FindControl("lblPurchasedQty");
                        TextBox txtPresentRequiredQty = (TextBox)lvdi.FindControl("txtPresentRequiredQty");
                        TextBox txtRequiredDate       = (TextBox)lvdi.FindControl("txtRequiredDate");
                        TextBox txtRemarksLV          = (TextBox)lvdi.FindControl("txtRemarksLV");


                        if (txtPresentRequiredQty.Enabled != false)
                        {
                            Decimal.TryParse(txtPresentRequiredQty.Text.Trim(), out PresentRequiredQty);
                            Int64.TryParse(lblItemID.Text, out ItemID);

                            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionID, REQRequisitionID.ToString(), SQLMatchType.Equal);
                            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal);
                            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                            IList <REQRequisitionItemEntity> RequisitionItemList = FCCREQRequisitionItem.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                            if (RequisitionItemList != null && RequisitionItemList.Count > 0)
                            {
                                REQRequisitionItemEntity rEQRequisitionItem = RequisitionItemList[0];
                                rEQRequisitionItem.RequisitionID      = REQRequisitionID;
                                rEQRequisitionItem.PresentRequiredQty = PresentRequiredQty;
                                rEQRequisitionItem.ItemID             = ItemID;
                                //Another Entity Item may be added Here.
                                FCCREQRequisitionItem.GetFacadeCreate().Update(rEQRequisitionItem, fe, DatabaseOperationType.Update, TransactionRequired.No);
                            }
                        }
                    }
                }
                BindREQRequisitionItemList();
                MiscUtil.ShowMessage(lblMessage, "Requisition Item Information has been saved successfully.", false);
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to save Requisition Item Information.", true);
            }
        }
예제 #4
0
        protected void lvREQRequisitionItem_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 RequisitionItemID;

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

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionItemID, RequisitionItemID.ToString(), SQLMatchType.Equal);

                        REQRequisitionItemEntity rEQRequisitionItemEntity = new REQRequisitionItemEntity();


                        result = FCCREQRequisitionItem.GetFacadeCreate().Delete(rEQRequisitionItemEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _RequisitionItemID        = 0;
                            _REQRequisitionItemEntity = new REQRequisitionItemEntity();
                            PrepareInitialView();
                            BindREQRequisitionItemList();

                            MiscUtil.ShowMessage(lblMessage, "R EQRequisition Item has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete R EQRequisition Item.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <REQRequisitionItemEntity> GetData()
        {
            IList <REQRequisitionItemEntity> rEQRequisitionItemEntityList = new List <REQRequisitionItemEntity>();

            try
            {
                rEQRequisitionItemEntityList = FCCREQRequisitionItem.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(rEQRequisitionItemEntityList ?? new List <REQRequisitionItemEntity>());
        }
예제 #6
0
        private void PrepareEditView()
        {
            REQRequisitionEntity rEQRequisitionEntity = CurrentREQRequisitionEntity;


            if (!rEQRequisitionEntity.IsNew)
            {
                if (ddlProjectID.Items.Count > 0 && rEQRequisitionEntity.ProjectID != null)
                {
                    ddlProjectID.SelectedValue = rEQRequisitionEntity.ProjectID.ToString();
                }

                txtRequisitionNo.Text   = rEQRequisitionEntity.RequisitionNo.ToString();
                txtRequisitionDate.Text = rEQRequisitionEntity.RequisitionDate.ToString(UIConstants.SHORT_DATE_FORMAT);
                txtRemarks.Text         = rEQRequisitionEntity.Remarks.ToString();
                if (ddlRequisitionStatusID.Items.Count > 0 && rEQRequisitionEntity.RequisitionStatusID != null)
                {
                    ddlRequisitionStatusID.SelectedValue = rEQRequisitionEntity.RequisitionStatusID.ToString();
                }
                String fe = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionID, _RequisitionID.ToString(), SQLMatchType.Equal);
                UpdatedMappedRequisitionItem = FCCREQRequisitionItem.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);
                if (UpdatedMappedRequisitionItem != null && UpdatedMappedRequisitionItem.Count > 0)
                {
                    REQRequisitionItemList = UpdatedMappedRequisitionItem;
                }
                else
                {
                    UpdatedMappedRequisitionItem = new List <REQRequisitionItemEntity>();
                }
                BindREQRequisitionList();
            }
            if (_ProjectID > 0)
            {
                if (ddlProjectID.Items.Count > 0)
                {
                    ddlProjectID.SelectedValue = this.OverviewProjectID.ToString();
                    ddlProjectID.Enabled       = false;
                }
            }
        }
        private void SavePRMMaterialReceiveEntity()
        {
            if (IsValid)
            {
                try
                {
                    PRMMaterialReceiveEntity pRMMaterialReceiveEntity = BuildPRMMaterialReceiveEntity();

                    #region Requisition

                    String RequisitionNo = String.Empty;

                    if (txtRequisition.Text.IsNotNullOrEmpty())
                    {
                        RequisitionNo = "BL-" + txtRequisition.Text.ToString();
                    }

                    Int64 resultRequisition     = -1;
                    Int64 resultRequisitionItem = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionEntity.FLD_NAME_RequisitionNo, RequisitionNo, SQLMatchType.Equal);
                    IList <REQRequisitionEntity> lstRequisition = FCCREQRequisition.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                    REQRequisitionItemEntity rEQRequisitionItemEntity = null;

                    if (lstRequisition != null && lstRequisition.Count > 0)
                    {
                        rEQRequisitionItemEntity = BuildREQRequisitionItemEntity(lstRequisition[0].RequisitionID);
                        pRMMaterialReceiveEntity.RequisitionID = lstRequisition[0].RequisitionID;
                    }
                    else
                    {
                        REQRequisitionEntity rEQRequisitionEntity = BuildREQRequisitionEntity();
                        resultRequisition = FCCREQRequisition.GetFacadeCreate().Add(rEQRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        pRMMaterialReceiveEntity.RequisitionID = resultRequisition;

                        if (resultRequisition > 0)
                        {
                            rEQRequisitionItemEntity = BuildREQRequisitionItemEntity(resultRequisition);
                        }
                    }

                    if (rEQRequisitionItemEntity != null)
                    {
                        resultRequisitionItem = FCCREQRequisitionItem.GetFacadeCreate().Add(rEQRequisitionItemEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }

                    #endregion

                    #region MRR

                    Int64 resultOne = -1;

                    if (pRMMaterialReceiveEntity.IsNew)
                    {
                        resultOne = FCCPRMMaterialReceive.GetFacadeCreate().Add(pRMMaterialReceiveEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMMaterialReceiveEntity.FLD_NAME_MaterialReceiveID, pRMMaterialReceiveEntity.MaterialReceiveID.ToString(), SQLMatchType.Equal);
                        resultOne = FCCPRMMaterialReceive.GetFacadeCreate().Update(pRMMaterialReceiveEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (resultOne > 0 && resultRequisitionItem > 0)
                    {
                        #region Material Receive Item Map

                        Int64 resultTwo = -1;

                        PRMMaterialReceiveItemMapEntity pRMMaterialReceiveItemMapEntity = BuildPRMMaterialReceiveItemMapEntity(resultOne, resultRequisitionItem);
                        resultTwo = FCCPRMMaterialReceiveItemMap.GetFacadeCreate().Add(pRMMaterialReceiveItemMapEntity, DatabaseOperationType.Add, TransactionRequired.No);

                        #endregion

                        try
                        {
                            #region Inventory

                            Int64 _employeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                            Int64 _projectID  = Int64.Parse(ddlProjectID.SelectedValue);

                            INVStoreEntity storeEntity = INVManager.GetDefaultStore(_projectID);
                            Int64          storeID     = storeEntity.StoreID;

                            INVStoreUnitEntity storeUnitEntity = INVManager.GetDefaultStoreUnit(storeID);
                            Int64 storeUnitID = storeUnitEntity.StoreUnitID;

                            String fe_requisitionItem = SqlExpressionBuilder.PrepareFilterExpression("REQRequisitionItem." + REQRequisitionItemEntity.FLD_NAME_RequisitionItemID, resultRequisitionItem.ToString(), SQLMatchType.Equal);
                            IList <REQRequisitionItem_DetailedEntity> lst = FCCREQRequisitionItem_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_requisitionItem);

                            Int64   _itemID   = 0;
                            Decimal _rate     = 0;
                            Int64   brandID   = MasterDataConstants.ItemDefaults.DEFAULT_BRAD;
                            Int64   regionID  = MasterDataConstants.ItemDefaults.DEFAULT_REGION;
                            Int64   countryID = MasterDataConstants.ItemDefaults.DEFAULT_COUNTRY;

                            if (lst != null && lst.Count > 0)
                            {
                                _itemID   = lst[0].ItemID;
                                brandID   = (Int64)lst[0].BrandID;
                                regionID  = (Int64)lst[0].RegionID;
                                countryID = (Int64)lst[0].CountryID;
                                _rate     = lst[0].Rate;
                            }

                            Boolean invResult = INVManager.AddItemsToStoreUnit(_itemID, brandID, regionID, countryID, "", Int64.Parse(txtReceiveQty.Text.ToString()), MiscUtil.GetLocalIP(), _employeeID, _rate, txtRequisition.Text, ddlWorkOrderID.SelectedItem.Text, resultOne.ToString(), "", Int64.Parse(ddlProjectID.SelectedValue), storeID, storeUnitID);

                            #endregion
                        }
                        catch (Exception ex)
                        {
                        }

                        _MaterialReceiveID = resultOne;
                        PrepareInitialViewSave();
                        btnAddNew.Visible = true;

                        if (pRMMaterialReceiveEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Material Receive Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Material Receive Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (pRMMaterialReceiveEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Material Receive Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Material Receive Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #8
0
        private void SaveREQRequisitionEntity()
        {
            if (IsValid)
            {
                try
                {
                    REQRequisitionEntity rEQRequisitionEntity = BuildREQRequisitionEntity();

                    Int64 result = -1;

                    if (rEQRequisitionEntity.IsNew)
                    {
                        //Prepared By ID Only for Save Operation; not for Update.
                        rEQRequisitionEntity.PreparedByMemberID = this.CurrentMember.MemberID;
                        result = FCCREQRequisition.GetFacadeCreate().Add(rEQRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionEntity.FLD_NAME_RequisitionID, rEQRequisitionEntity.RequisitionID.ToString(), SQLMatchType.Equal);
                        result = FCCREQRequisition.GetFacadeCreate().Update(rEQRequisitionEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }
                    BindRequisitionItemInfo();

                    IList <REQRequisitionItemEntity> deleteList = UpdatedMappedRequisitionItem.Except(REQRequisitionItemList, new CustomerComparer()).ToList();
                    IList <REQRequisitionItemEntity> addNewList = REQRequisitionItemList.Except(UpdatedMappedRequisitionItem, new CustomerComparer()).ToList();

                    foreach (REQRequisitionItemEntity ent in deleteList)
                    {
                        String fe1 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), SQLMatchType.Equal);
                        String fe2 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal);
                        String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                        FCCREQRequisitionItem.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No);
                    }

                    StringBuilder xmlStr    = new StringBuilder();
                    String        subXmlStr = String.Empty;

                    xmlStr.Append("<m>");

                    foreach (REQRequisitionItemEntity ent in addNewList)
                    {
                        subXmlStr = subXmlStr + "<i><a>" + result + "</a><b>" + ent.AccountsCode + "</b><c>" + ent.ItemID + "</c><d>" + ent.TotalRequiredQty + "</d><e>" + ent.PurchasedQtyTillToDate + "</e><f>" + ent.PresentRequiredQty + "</f><g>" + ent.RequiredDate + "</g><h>" + ent.Remarks + "</h><j>" + ent.Rate + "</j></i>";
                    }
                    xmlStr.Append(subXmlStr.ToString());
                    xmlStr.Append("</m>");
                    FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.RequisitionItemInfo);

                    if (result > 0)
                    {
                        _RequisitionID        = 0;
                        _REQRequisitionEntity = new REQRequisitionEntity();
                        PrepareInitialView();
                        ClearAllRequisitionItem();

                        if (rEQRequisitionEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Requisition Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Requisition Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (rEQRequisitionEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Requisition Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Requisition Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        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);
            }
        }
예제 #10
0
        protected void lvREQRequisitionItem_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 RequisitionItemID;

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

            if (RequisitionItemID > 0)
            {
                LinkButton lnkBtnEdit            = (LinkButton)e.Item.FindControl("lnkBtnEdit");
                TextBox    txtPresentRequiredQty = (TextBox)e.Item.FindControl("txtPresentRequiredQty");

                if (string.Equals(e.CommandName, "EditItem") && txtPresentRequiredQty.Enabled == true)
                {
                    txtPresentRequiredQty.Text    = ItemQty.ToString();
                    txtPresentRequiredQty.Enabled = false;
                    lnkBtnEdit.Text = "Edit";
                }

                else if (string.Equals(e.CommandName, "EditItem") && txtPresentRequiredQty.Enabled == false)
                {
                    _RequisitionItemID = RequisitionItemID;

                    PrepareEditView();

                    txtPresentRequiredQty.Enabled = true;
                    ItemQty         = Decimal.Parse(txtPresentRequiredQty.Text);
                    lnkBtnEdit.Text = "Cancel";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe1 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionItemID, RequisitionItemID.ToString(), SQLMatchType.Equal);
                        String fe2 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionID, REQRequisitionID.ToString(), SQLMatchType.Equal);
                        String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                        REQRequisitionItemEntity rEQRequisitionItemEntity = new REQRequisitionItemEntity();


                        result = FCCREQRequisitionItem.GetFacadeCreate().Delete(rEQRequisitionItemEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _RequisitionItemID        = 0;
                            _REQRequisitionItemEntity = new REQRequisitionItemEntity();
                            PrepareInitialView();
                            BindREQRequisitionItemList();

                            MiscUtil.ShowMessage(lblMessage, "Requisition Item has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Requisition Item.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }