Esempio n. 1
0
        public IList <PRMAvailableBOQQtyForRequisitionEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <PRMAvailableBOQQtyForRequisitionEntity> pRMAvailableBOQQtyForRequisitionEntityList = new List <PRMAvailableBOQQtyForRequisitionEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = PRMAvailableBOQQtyForRequisitionEntity.FLD_NAME_AvailableBOQQtyForRequisitionID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                pRMAvailableBOQQtyForRequisitionEntityList = FCCPRMAvailableBOQQtyForRequisition.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(pRMAvailableBOQQtyForRequisitionEntityList ?? new List <PRMAvailableBOQQtyForRequisitionEntity>());
        }
Esempio n. 2
0
        public IList <PRMAvailableBOQQtyForRequisitionEntity> GetData()
        {
            IList <PRMAvailableBOQQtyForRequisitionEntity> pRMAvailableBOQQtyForRequisitionEntityList = new List <PRMAvailableBOQQtyForRequisitionEntity>();

            try
            {
                pRMAvailableBOQQtyForRequisitionEntityList = FCCPRMAvailableBOQQtyForRequisition.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(pRMAvailableBOQQtyForRequisitionEntityList ?? new List <PRMAvailableBOQQtyForRequisitionEntity>());
        }
Esempio n. 3
0
        protected void btnPnlSaveAdditionalQty_Click(object sender, EventArgs e)
        {
            PRMBOQDetailEntity pRMBOQDetailEntity = FCCPRMBOQDetail.GetFacadeCreate().GetByID(_CurrentBOQDetailIDPopup);

            if (pRMBOQDetailEntity != null && pRMBOQDetailEntity.BOQDetailID > 0)
            {
                Decimal additionalQty = 0;
                Decimal.TryParse(txtQty.Text.Trim().ToString(), out additionalQty);

                PRMAvailableBOQQtyForRequisitionEntity pRMAvailableBOQQtyForRequisitionEntity = new PRMAvailableBOQQtyForRequisitionEntity();

                pRMAvailableBOQQtyForRequisitionEntity.IsBOQ = true;
                pRMAvailableBOQQtyForRequisitionEntity.PreBOQOrBOQDetailID = _CurrentBOQDetailIDPopup;
                pRMAvailableBOQQtyForRequisitionEntity.ItemID              = pRMBOQDetailEntity.ItemID;
                pRMAvailableBOQQtyForRequisitionEntity.Qty                 = additionalQty;
                pRMAvailableBOQQtyForRequisitionEntity.CreateDate          = DateTime.Now;
                pRMAvailableBOQQtyForRequisitionEntity.CreatedByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                PRMBOQEntity pRMBOQEntity = FCCPRMBOQ.GetFacadeCreate().GetByID(pRMBOQDetailEntity.BOQID);
                pRMAvailableBOQQtyForRequisitionEntity.ProjectID = pRMBOQEntity.ProjectID;

                Int64 result = -1;
                result = FCCPRMAvailableBOQQtyForRequisition.GetFacadeCreate().Add(pRMAvailableBOQQtyForRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No);

                if (result > 0)
                {
                    String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetailEntity.FLD_NAME_BOQDetailID, _CurrentBOQDetailIDPopup.ToString(), SQLMatchType.Equal);

                    pRMBOQDetailEntity.TotalQty = pRMBOQDetailEntity.TotalQty + additionalQty;

                    FCCPRMBOQDetail.GetFacadeCreate().Update(pRMBOQDetailEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                    IList <ListViewDataItem> list = lvPRMBOQDetail.Items;

                    if (list != null && list.Count > 0)
                    {
                        Int32 tempDataItemIndex = 0;

                        foreach (ListViewDataItem lvdi in list)
                        {
                            DataKey currentDataKey = lvPRMBOQDetail.DataKeys[tempDataItemIndex++];
                            Int64   intBOQDetailID = (Int64)currentDataKey["BOQDetailID"];

                            if (_CurrentBOQDetailIDPopup == intBOQDetailID)
                            {
                                TextBox txtTotalQtyLV = (TextBox)lvdi.FindControl("txtTotalQtyLV");
                                txtTotalQtyLV.Text = pRMBOQDetailEntity.TotalQty.ToString();
                            }
                        }
                    }

                    BindPRMBOQDetailList();

                    #region BOQ Floor Detail

                    String fe_projectFloor = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQFloorDetailEntity.FLD_NAME_BOQDetailID, _CurrentBOQDetailIDPopup.ToString(), SQLMatchType.Equal);
                    IList <PRMBOQFloorDetailEntity> lstPRMBOQFloorDetail = FCCPRMBOQFloorDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_projectFloor, DatabaseOperationType.LoadWithFilterExpression);

                    if (lstPRMBOQFloorDetail != null && lstPRMBOQFloorDetail.Count > 0)
                    {
                        Int64   totalfloorCount = lstPRMBOQFloorDetail.Count;
                        Decimal avgQty          = pRMBOQDetailEntity.TotalQty / totalfloorCount;

                        foreach (PRMBOQFloorDetailEntity ent in lstPRMBOQFloorDetail)
                        {
                            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQFloorDetailEntity.FLD_NAME_BOQFloorDetailID, ent.BOQFloorDetailID.ToString(), SQLMatchType.Equal);
                            ent.Qty = avgQty;
                            FCCPRMBOQFloorDetail.GetFacadeCreate().Update(ent, fe1, DatabaseOperationType.Update, TransactionRequired.No);
                        }
                    }

                    #endregion

                    this.ModalPopupExtender1.Hide();
                }
            }
        }
Esempio n. 4
0
        protected void btnAddToProject_Click(object sender, EventArgs e)
        {
            if (ddlProjectID.Items.Count > 0 && ddlProjectID.SelectedValue != "0")
            {
                Int64 itemID = 0;
                if (ViewState["LastUpdatedItemID"] != null)
                {
                    itemID = (Int64)ViewState["LastUpdatedItemID"];
                }

                if (itemID > 0)
                {
                    String fe_itemDefault = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);
                    IList <MDItemDefaultEntity> lstmDItemDefaultEntity = FCCMDItemDefault.GetFacadeCreate().GetIL(null, null, String.Empty, fe_itemDefault, DatabaseOperationType.LoadWithFilterExpression);

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, ddlProjectID.SelectedValue.ToString(), SQLMatchType.Equal);
                    IList <PRMPreBOQEntity> preBOQList = FCCPRMPreBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                    if (preBOQList != null && preBOQList.Count > 0)
                    {
                        Int64   preBOQID = preBOQList[0].PreBOQID;
                        Decimal totalQty = 0;
                        Decimal.TryParse(txtQty.Text.Trim().ToString(), out totalQty);
                        Decimal currentPrice = MiscUtil.GetCurrentPrice(itemID, lstmDItemDefaultEntity[0].BrandID, lstmDItemDefaultEntity[0].SupplierID, lstmDItemDefaultEntity[0].RegionID, lstmDItemDefaultEntity[0].CountryID);

                        switch (preBOQList[0].IsLocked)
                        {
                        case true:
                            #region Add Item to BOQ

                            try
                            {
                                String fe_boq = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQEntity.FLD_NAME_ProjectID, ddlProjectID.SelectedValue.ToString(), SQLMatchType.Equal);
                                IList <PRMBOQEntity> lstPRMBOQ = FCCPRMBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe_boq, DatabaseOperationType.LoadWithFilterExpression);

                                if (lstPRMBOQ != null && lstPRMBOQ.Count > 0)
                                {
                                    PRMBOQDetailEntity pRMBOQDeatEntity = new PRMBOQDetailEntity();
                                    pRMBOQDeatEntity.BOQID      = lstPRMBOQ[0].BOQID;
                                    pRMBOQDeatEntity.ItemID     = itemID;
                                    pRMBOQDeatEntity.BrandID    = lstmDItemDefaultEntity[0].BrandID;
                                    pRMBOQDeatEntity.RegionID   = lstmDItemDefaultEntity[0].RegionID;
                                    pRMBOQDeatEntity.CountryID  = lstmDItemDefaultEntity[0].CountryID;
                                    pRMBOQDeatEntity.SupplierID = lstmDItemDefaultEntity[0].SupplierID;
                                    pRMBOQDeatEntity.Remarks    = "Directly Added From Item";
                                    pRMBOQDeatEntity.IsRemoved  = false;
                                    pRMBOQDeatEntity.Rate       = currentPrice;
                                    pRMBOQDeatEntity.EntryDate  = System.DateTime.Now;
                                    pRMBOQDeatEntity.TotalQty   = totalQty;

                                    Int64 result_boq = -1;

                                    result_boq = FCCPRMBOQDetail.GetFacadeCreate().Add(pRMBOQDeatEntity, DatabaseOperationType.Add, TransactionRequired.No);

                                    if (result_boq > 0)
                                    {
                                        PRMAvailableBOQQtyForRequisitionEntity pRMAvailableBOQQtyForRequisitionEntity = new PRMAvailableBOQQtyForRequisitionEntity();

                                        pRMAvailableBOQQtyForRequisitionEntity.IsBOQ = true;
                                        pRMAvailableBOQQtyForRequisitionEntity.PreBOQOrBOQDetailID = result_boq;
                                        pRMAvailableBOQQtyForRequisitionEntity.ItemID              = itemID;
                                        pRMAvailableBOQQtyForRequisitionEntity.Qty                 = totalQty;
                                        pRMAvailableBOQQtyForRequisitionEntity.CreateDate          = DateTime.Now;
                                        pRMAvailableBOQQtyForRequisitionEntity.CreatedByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                                        pRMAvailableBOQQtyForRequisitionEntity.ProjectID           = Int64.Parse(ddlProjectID.SelectedValue);


                                        Int64 result_available = -1;
                                        result_available = FCCPRMAvailableBOQQtyForRequisition.GetFacadeCreate().Add(pRMAvailableBOQQtyForRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No);

                                        MiscUtil.ShowMessage(lblMessage, "Qty Added Successfully to Project Cost.", false);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Some Error Occured.", true);
                            }

                            #endregion

                            break;

                        case false:

                            #region Add Item to Pre-BOQ

                            try
                            {
                                String fe_preBOQ = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, ddlProjectID.SelectedValue.ToString(), SQLMatchType.Equal);
                                IList <PRMPreBOQEntity> lstPRMPreBOQ = FCCPRMPreBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe_preBOQ, DatabaseOperationType.LoadWithFilterExpression);

                                if (lstPRMPreBOQ != null && lstPRMPreBOQ.Count > 0)
                                {
                                    PRMPreBOQDetailEntity pRMPreBOQDeatEntity = new PRMPreBOQDetailEntity();
                                    pRMPreBOQDeatEntity.PreBOQID   = lstPRMPreBOQ[0].PreBOQID;
                                    pRMPreBOQDeatEntity.ItemID     = itemID;
                                    pRMPreBOQDeatEntity.BrandID    = lstmDItemDefaultEntity[0].BrandID;
                                    pRMPreBOQDeatEntity.RegionID   = lstmDItemDefaultEntity[0].RegionID;
                                    pRMPreBOQDeatEntity.CountryID  = lstmDItemDefaultEntity[0].CountryID;
                                    pRMPreBOQDeatEntity.SupplierID = lstmDItemDefaultEntity[0].SupplierID;
                                    pRMPreBOQDeatEntity.TotalQty   = totalQty;
                                    pRMPreBOQDeatEntity.Remarks    = "Directly Added From Item";
                                    pRMPreBOQDeatEntity.IsRemoved  = false;
                                    pRMPreBOQDeatEntity.Rate       = currentPrice;
                                    pRMPreBOQDeatEntity.EntryDate  = System.DateTime.Now;

                                    Int64 result_preboq = -1;

                                    result_preboq = FCCPRMPreBOQDetail.GetFacadeCreate().Add(pRMPreBOQDeatEntity, DatabaseOperationType.Add, TransactionRequired.No);

                                    if (result_preboq > 0)
                                    {
                                        PRMAvailableBOQQtyForRequisitionEntity pRMAvailableBOQQtyForRequisitionEntity = new PRMAvailableBOQQtyForRequisitionEntity();

                                        pRMAvailableBOQQtyForRequisitionEntity.IsBOQ = false;
                                        pRMAvailableBOQQtyForRequisitionEntity.PreBOQOrBOQDetailID = result_preboq;
                                        pRMAvailableBOQQtyForRequisitionEntity.ItemID              = itemID;
                                        pRMAvailableBOQQtyForRequisitionEntity.Qty                 = totalQty;
                                        pRMAvailableBOQQtyForRequisitionEntity.CreateDate          = DateTime.Now;
                                        pRMAvailableBOQQtyForRequisitionEntity.CreatedByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                                        pRMAvailableBOQQtyForRequisitionEntity.ProjectID           = Int64.Parse(ddlProjectID.SelectedValue);

                                        Int64 result_available = -1;
                                        result_available = FCCPRMAvailableBOQQtyForRequisition.GetFacadeCreate().Add(pRMAvailableBOQQtyForRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No);

                                        MiscUtil.ShowMessage(lblMessage, "Qty Added Successfully to BOQ.", false);
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Some Error Occured.", true);
                            }

                            #endregion

                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }