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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = BDProjectFloorEntity.FLD_NAME_ProjectFloorID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                bDProjectFloorEntityList = FCCBDProjectFloor.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(bDProjectFloorEntityList ?? new List <BDProjectFloorEntity>());
        }
コード例 #2
0
        private void SaveBDProjectFloorEntity()
        {
            if (IsValid)
            {
                try
                {
                    BDProjectFloorEntity bDProjectFloorEntity = BuildBDProjectFloorEntity();

                    Int64 result = -1;

                    if (bDProjectFloorEntity.IsNew)
                    {
                        result = FCCBDProjectFloor.GetFacadeCreate().Add(bDProjectFloorEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDProjectFloorEntity.FLD_NAME_ProjectFloorID, bDProjectFloorEntity.ProjectFloorID.ToString(), SQLMatchType.Equal);
                        result = FCCBDProjectFloor.GetFacadeCreate().Update(bDProjectFloorEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ProjectFloorID       = 0;
                        _BDProjectFloorEntity = new BDProjectFloorEntity();
                        PrepareInitialView();
                        BindBDProjectFloorList();

                        if (bDProjectFloorEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Floor Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Floor Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (bDProjectFloorEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Project Floor Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Project Floor Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
コード例 #3
0
        protected void lvBDProjectFloor_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ProjectFloorID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProjectFloorEntity.FLD_NAME_ProjectFloorID, ProjectFloorID.ToString(), SQLMatchType.Equal);

                        BDProjectFloorEntity bDProjectFloorEntity = new BDProjectFloorEntity();


                        result = FCCBDProjectFloor.GetFacadeCreate().Delete(bDProjectFloorEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ProjectFloorID       = 0;
                            _BDProjectFloorEntity = new BDProjectFloorEntity();
                            PrepareInitialView();
                            BindBDProjectFloorList();

                            MiscUtil.ShowMessage(lblMessage, "Project Floor has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Floor.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #4
0
        public IList <BDProjectFloorEntity> GetData()
        {
            IList <BDProjectFloorEntity> bDProjectFloorEntityList = new List <BDProjectFloorEntity>();

            try
            {
                bDProjectFloorEntityList = FCCBDProjectFloor.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(bDProjectFloorEntityList ?? new List <BDProjectFloorEntity>());
        }
コード例 #5
0
        protected void lvPRMBOQDetail_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            #region Modify Qty

            if (e.CommandName == "ModifyQty")
            {
                Int64 ItemID;

                Int64.TryParse(e.CommandArgument.ToString(), out ItemID);
                Label   lblBOQDetailLV = (Label)e.Item.FindControl("lblBOQDetailIDLV");
                TextBox txtRateLV      = (TextBox)e.Item.FindControl("txtRateLV");

                Int64 BOQDetailID = Int64.Parse(lblBOQDetailLV.Text);
                _CurrentBOQDetailIDPopup = BOQDetailID;

                if (ItemID > 0)
                {
                    _CurrentItemID        = ItemID;
                    this.lblItemName.Text = ((Label)e.Item.FindControl("lblItemNameLV")).Text;

                    PRMBOQDetailEntity bOQDetailEntity = FCCPRMBOQDetail.GetFacadeCreate().GetByID(BOQDetailID);

                    if (bOQDetailEntity != null && bOQDetailEntity.BOQDetailID > 0)
                    {
                        String fe3 = SqlExpressionBuilder.PrepareFilterExpression(BDProjectFloorEntity.FLD_NAME_ProjectID, this.OverviewProjectID.ToString(), SQLMatchType.Equal);
                        IList <BDProjectFloorEntity> bDProjectFloorList = FCCBDProjectFloor.GetFacadeCreate().GetIL(null, null, String.Empty, fe3, DatabaseOperationType.LoadWithFilterExpression);

                        if (bDProjectFloorList != null && bDProjectFloorList.Count > 0)
                        {
                            foreach (BDProjectFloorEntity bdProjectfloorent in bDProjectFloorList)
                            {
                                String fe4            = String.Empty;
                                String feFloorDetail1 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQFloorDetailEntity.FLD_NAME_ProjectFloorID, bdProjectfloorent.ProjectFloorID.ToString(), SQLMatchType.Equal);
                                String feFloorDetail2 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQFloorDetailEntity.FLD_NAME_BOQDetailID, BOQDetailID.ToString(), SQLMatchType.Equal);
                                fe4 = SqlExpressionBuilder.PrepareFilterExpression(feFloorDetail1, SQLJoinType.AND, feFloorDetail2);

                                IList <PRMBOQFloorDetailEntity> list = FCCPRMBOQFloorDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe4, DatabaseOperationType.LoadWithFilterExpression);

                                if (list == null || list.Count <= 0)
                                {
                                    PRMBOQFloorDetailEntity ent = new PRMBOQFloorDetailEntity();
                                    ent.BOQDetailID    = Int64.Parse(BOQDetailID.ToString());
                                    ent.ProjectFloorID = Int64.Parse(bdProjectfloorent.ProjectFloorID.ToString());
                                    Decimal dividedQty;
                                    Decimal RateLV;

                                    Decimal.TryParse(txtRateLV.Text, out RateLV);
                                    Decimal.TryParse((bOQDetailEntity.TotalQty / (this.OverviewProject.NoOfBasement + this.OverviewProject.NoOfStoried)).ToString(), out dividedQty);

                                    switch (bdProjectfloorent.FloorCategoryID)
                                    {
                                    case MasterDataConstants.FloorCategory.BASEMENT:
                                        dividedQty = dividedQty / 4;     //Assumuation
                                        break;

                                    case MasterDataConstants.FloorCategory.FLOOR:
                                        dividedQty = dividedQty * 1;     //Assumuation
                                        break;

                                    case MasterDataConstants.FloorCategory.PENTHOUSE:
                                        dividedQty = dividedQty * 2;     //Assumuation
                                        break;

                                    case MasterDataConstants.FloorCategory.HEAD_ROOM:
                                        dividedQty = dividedQty * 3;     //Assumuation
                                        break;

                                    default:
                                        dividedQty = 0;
                                        break;
                                    }

                                    ent.Rate      = RateLV;
                                    ent.Qty       = dividedQty;
                                    ent.Remarks   = String.Empty;
                                    ent.EntryDate = System.DateTime.Now;
                                    FCCPRMBOQFloorDetail.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);
                                }
                            }

                            BindPRMBOQFloorDetailList();

                            this.Panel1_ModalPopupExtender.Show();
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "No Floor Available.", true);
                        }
                    }
                }
            }

            #endregion

            #region Modify Price Info

            if (e.CommandName == "ModifyPrice")
            {
                Int64 ItemID;

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

                if (ItemID > 0)
                {
                    MiscUtil.PopulateMDBrandByItemID(ddlBrandID, false, Int64.Parse(ItemID.ToString()));
                    this.lblItemNameModifyPriceLV.Text = ((Label)e.Item.FindControl("lblItemNameLV")).Text;

                    if (ddlBrandID != null && ddlBrandID.Items.Count > 0)
                    {
                        this.ddlBrandID.SelectedValue = ((Label)e.Item.FindControl("lblBrandID")).Text;
                    }

                    BuildSupplierByBrand();

                    if (ddlSupplierID != null && ddlSupplierID.Items.Count > 0)
                    {
                        this.ddlSupplierID.SelectedValue = ((Label)e.Item.FindControl("lblSupplierID")).Text;
                    }
                    _CurrentItemID = ItemID;

                    if (ddlOriginRegionID != null && ddlOriginRegionID.Items.Count > 0)
                    {
                        this.ddlOriginRegionID.SelectedValue = ((Label)e.Item.FindControl("lblRegionID")).Text;
                    }

                    BuildCountryDropdownByRegion();

                    if (ddlOriginCountryID != null && ddlOriginCountryID.Items.Count > 0)
                    {
                        this.ddlOriginCountryID.SelectedValue = ((Label)e.Item.FindControl("lblCountryID")).Text;
                    }

                    GetCurrentPrice();
                }

                this.Panel2_ModalPopupExtender.Show();
            }

            if (e.CommandName == "AdditionalQty")
            {
                Int64 boqDetailID;

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

                if (boqDetailID > 0)
                {
                    _CurrentBOQDetailIDPopup = boqDetailID;

                    this.ModalPopupExtender1.Show();
                }
            }

            #endregion
        }
コード例 #6
0
        protected void lvPRMMaterialReceive_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 WorkOrderItemMapID;

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

            if (WorkOrderItemMapID > 0)
            {
                if (e.CommandName == "FloorWiseRateAndQty")
                {
                    CurrentWorkOrderItemIDPopup = WorkOrderItemMapID;

                    Label lblItemLV               = (Label)e.Item.FindControl("lblItemLV");
                    Label lblRequisitionIDLV      = (Label)e.Item.FindControl("lblRequisitionIDLV");
                    Label lblRequisitionItemIDLV  = (Label)e.Item.FindControl("lblRequisitionItemIDLV");
                    Label lblWorkOrderItemMapIDLV = (Label)e.Item.FindControl("lblWorkOrderItemMapIDLV");

                    Label lblProjectIDLV   = (Label)e.Item.FindControl("lblProjectIDLV");
                    Label lblWorkOrderIDLV = (Label)e.Item.FindControl("lblWorkOrderIDLV");

                    Int64 itemID;
                    Int64.TryParse(lblItemLV.Text.Trim(), out itemID);

                    String fe_floor = SqlExpressionBuilder.PrepareFilterExpression(BDProjectFloorEntity.FLD_NAME_ProjectID, lblProjectIDLV.Text.ToString(), SQLMatchType.Equal);
                    IList <BDProjectFloorEntity> lstBDProjectFloor = FCCBDProjectFloor.GetFacadeCreate().GetIL(null, null, String.Empty, fe_floor, DatabaseOperationType.LoadWithFilterExpression);

                    if (lstBDProjectFloor != null && lstBDProjectFloor.Count > 0)
                    {
                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, lblProjectIDLV.Text.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;

                            switch (preBOQList[0].IsLocked)
                            {
                            case true:

                                #region GET Item From BOQ

                                String fe_boq = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal);
                                IList <PRMBOQEntity> lstPRMBOQ = FCCPRMBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe_boq, DatabaseOperationType.LoadWithFilterExpression);

                                if (lstPRMBOQ != null && lstPRMBOQ.Count > 0)
                                {
                                    String fe_BOQDetail1 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetailEntity.FLD_NAME_BOQID, lstPRMBOQ[0].BOQID.ToString(), SQLMatchType.Equal);
                                    String fe_BOQDetail2 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetailEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);

                                    String fe_BOQDetail = SqlExpressionBuilder.PrepareFilterExpression(fe_BOQDetail1, SQLJoinType.AND, fe_BOQDetail2);

                                    IList <PRMBOQDetailEntity> lstPRMBOQDetail = FCCPRMBOQDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_BOQDetail, DatabaseOperationType.LoadWithFilterExpression);

                                    if (lstPRMBOQDetail != null && lstPRMBOQDetail.Count > 0)
                                    {
                                        String fe_floorDetail = SqlExpressionBuilder.PrepareFilterExpression("PRMBOQFloorDetail." + PRMBOQFloorDetailEntity.FLD_NAME_BOQDetailID, lstPRMBOQDetail[0].BOQDetailID.ToString(), SQLMatchType.Equal);
                                        IList <PRMBOQFloorDetail_DetailedEntity> lstPRMPreBOQFloorDetail = FCCPRMBOQFloorDetail_Detailed.GetFacadeCreate().GetIL(100000, 1, String.Empty, fe_floorDetail);

                                        lvREQRequisitionItemFloorDetail.DataSource = lstPRMPreBOQFloorDetail;
                                        lvREQRequisitionItemFloorDetail.DataBind();
                                    }
                                }

                                #endregion

                                break;

                            case false:

                                #region Get Item From Pre-BOQ

                                String fe_preBOQDetail1 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal);
                                String fe_preBOQDetail2 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);

                                String fe_preBOQDetail = SqlExpressionBuilder.PrepareFilterExpression(fe_preBOQDetail1, SQLJoinType.AND, fe_preBOQDetail2);

                                IList <PRMPreBOQDetailEntity> lstPRMPreBOQDetail = FCCPRMPreBOQDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_preBOQDetail, DatabaseOperationType.LoadWithFilterExpression);

                                if (lstPRMPreBOQDetail != null && lstPRMPreBOQDetail.Count > 0)
                                {
                                    String fe_floorDetail = SqlExpressionBuilder.PrepareFilterExpression("PRMPreBOQFloorDetail." + PRMPreBOQFloorDetailEntity.FLD_NAME_PreBOQDetailID, lstPRMPreBOQDetail[0].PreBOQDetailID.ToString(), SQLMatchType.Equal);
                                    IList <PRMPreBOQFloorDetail_DetailedEntity> lstPRMPreBOQFloorDetail = FCCPRMPreBOQFloorDetail_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_floorDetail);

                                    lvREQRequisitionItemFloorDetail.DataSource = lstPRMPreBOQFloorDetail;
                                    lvREQRequisitionItemFloorDetail.DataBind();
                                }

                                #endregion

                                break;

                            default:
                                break;
                            }
                        }
                    }

                    Label lblItemNameLV = (Label)e.Item.FindControl("lblItemNameLV");

                    //BindREQRequisitionFloorDetailList();
                    //lblFloorWiseItemName.Text = lblItemNameLV.Text.ToString();
                    this.ModalPopupExtender2.Show();

                    if (lvREQRequisitionItemFloorDetail.DataSource != null)
                    {
                        btnFloorPopupSave.Enabled = true;
                    }
                    else
                    {
                        btnFloorPopupSave.Enabled = false;
                    }

                    if (CurrentPRMWorkOrderEntity.WorkOrderStatusID != MasterDataConstants.WorkOrderStatus.APPROVED)
                    {
                        lblLockMessage.Visible = false;
                    }

                    else if (CurrentPRMWorkOrderEntity.WorkOrderStatusID == MasterDataConstants.WorkOrderStatus.APPROVED)
                    {
                        btnFloorPopupSave.Enabled = false;
                        lblLockMessage.Visible    = true;
                    }
                }
            }
        }