public IList <PRMPreBOQEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <PRMPreBOQEntity> pRMPreBOQEntityList = new List <PRMPreBOQEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = PRMPreBOQEntity.FLD_NAME_PreBOQID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; pRMPreBOQEntityList = FCCPRMPreBOQ.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (pRMPreBOQEntityList != null && pRMPreBOQEntityList.Count > 0) { totalRowCount = pRMPreBOQEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMPreBOQEntityList ?? new List <PRMPreBOQEntity>()); }
private void SavePRMPreBOQEntity() { if (IsValid) { try { PRMPreBOQEntity pRMPreBOQEntity = BuildPRMPreBOQEntity(); Int64 result = -1; if (pRMPreBOQEntity.IsNew) { result = FCCPRMPreBOQ.GetFacadeCreate().Add(pRMPreBOQEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_PreBOQID, pRMPreBOQEntity.PreBOQID.ToString(), SQLMatchType.Equal); result = FCCPRMPreBOQ.GetFacadeCreate().Update(pRMPreBOQEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { PrepareInitialView(); PrepareEditView(); if (pRMPreBOQEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "BOQ Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "BOQ Information has been updated successfully.", false); } } else { if (pRMPreBOQEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add BOQ Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update BOQ Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
public IList <PRMPreBOQEntity> GetData() { IList <PRMPreBOQEntity> pRMPreBOQEntityList = new List <PRMPreBOQEntity>(); try { pRMPreBOQEntityList = FCCPRMPreBOQ.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (pRMPreBOQEntityList != null && pRMPreBOQEntityList.Count > 0) { totalRowCount = pRMPreBOQEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMPreBOQEntityList ?? new List <PRMPreBOQEntity>()); }
private void SavePRMPreBOQEntity() { if (IsValid) { try { Int64 result = 0; IList <PreBOQtoBOQMigration_CustomEntity> list = FCCPreBOQtoBOQMigration_Custom.GetFacadeCreate().GetIL(CurrentPRMPreBOQEntity.PreBOQID, this.CurrentMember.MemberID); if (list != null && list.Count > 0) { if (list[0].BOQID != null) { result = list[0].BOQID.Value; } } if (result > 0) { PRMPreBOQEntity _pRMPreBOQEntity = CurrentPRMPreBOQEntity; _pRMPreBOQEntity.PreBOQStatusID = MasterDataConstants.PreBOQStatus.COMPLETED; String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_PreBOQID, CurrentPRMPreBOQEntity.PreBOQID.ToString(), SQLMatchType.Equal); FCCPRMPreBOQ.GetFacadeCreate().Update(_pRMPreBOQEntity, fe, DatabaseOperationType.Update, TransactionRequired.No); PrepareInitialView(); MiscUtil.ShowMessage(lblMessage, "BOQ to Project Cost migration is successful.", UIConstants.MessageType.GREEN); } else { MiscUtil.ShowMessage(lblMessage, "BOQ to Project Cost migration Failed.", UIConstants.MessageType.RED); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, UIConstants.MessageType.RED); } } }
public string[] GetCompletionItemList(string prefixText, int count, string contextKey) { #region GET ITEM Int64 projectID; Int64.TryParse(contextKey.ToString(), out projectID); List <string> items = new List <string>(count); #region DEFAULT_PROJECT if (projectID == MasterDataConstants.Project.DEFAULT_PROJECT) { String fePrefix = SqlExpressionBuilder.PrepareFilterExpression(MDItemEntity.FLD_NAME_ItemName, prefixText, SQLMatchType.LikeWithSuffixMath); IList <MDItemEntity> itemListBySuffix = FCCMDItem.GetFacadeCreate().GetIL(null, null, String.Empty, fePrefix, DatabaseOperationType.LoadWithFilterExpression); String feBothfix = SqlExpressionBuilder.PrepareFilterExpression(MDItemEntity.FLD_NAME_ItemName, prefixText, SQLMatchType.LikeWithBothMath); IList <MDItemEntity> itemListByBoth = FCCMDItem.GetFacadeCreate().GetIL(null, null, String.Empty, feBothfix, DatabaseOperationType.LoadWithFilterExpression); if (itemListBySuffix == null || itemListBySuffix.Count <= 0) { itemListBySuffix = new List <MDItemEntity>(); } if (itemListByBoth == null || itemListByBoth.Count <= 0) { itemListByBoth = new List <MDItemEntity>(); } IList <MDItemEntity> tempBOQItemList = itemListByBoth.Except(itemListBySuffix, new ItemComparer()).ToList(); IList <MDItemEntity> itemList = new List <MDItemEntity>(); itemList = itemListBySuffix; if (tempBOQItemList != null && tempBOQItemList.Count > 0) { foreach (MDItemEntity ent in tempBOQItemList) { itemList.Add(ent); } } if (itemList != null && itemList.Count > 0) { foreach (MDItemEntity entItem in itemList) { if (prefixText.Equals(entItem.ItemName)) { return(new string[0]); } items.Add(AutoCompleteExtender.CreateAutoCompleteItem(entItem.ItemName.ToString(), entItem.ItemID.ToString())); } } else { items.Add(AutoCompleteExtender.CreateAutoCompleteItem("No Items Available", "0")); } } #endregion if (projectID > 0 && projectID != MasterDataConstants.Project.DEFAULT_PROJECT) { String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, projectID.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 feBOQSufix1 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetail_DetailedCustomEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); String feBOQSuffix2 = SqlExpressionBuilder.PrepareFilterExpression("MDItem." + PRMPreBOQDetail_DetailedCustomEntity.FLD_NAME_ItemName, prefixText, SQLMatchType.LikeWithSuffixMath); String fiterExpressionBysuffix = SqlExpressionBuilder.PrepareFilterExpression(feBOQSufix1, SQLJoinType.AND, feBOQSuffix2); IList <PRMBOQDetail_DetailedCustomEntity> prmBOQDetailListBySuffix = FCCPRMBOQDetail_DetailedCustom.GetFacadeCreate().GetIL(fiterExpressionBysuffix); String feBothBOQ = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetail_DetailedCustomEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); String feBOQBoth = SqlExpressionBuilder.PrepareFilterExpression("MDItem." + MDItemEntity.FLD_NAME_ItemName, prefixText, SQLMatchType.LikeWithBothMath); String filterExpressionBoth = SqlExpressionBuilder.PrepareFilterExpression(feBothBOQ, SQLJoinType.AND, feBOQBoth); IList <PRMBOQDetail_DetailedCustomEntity> prmBOQDetailListByBoth = FCCPRMBOQDetail_DetailedCustom.GetFacadeCreate().GetIL(filterExpressionBoth); if (prmBOQDetailListBySuffix == null || prmBOQDetailListBySuffix.Count <= 0) { prmBOQDetailListBySuffix = new List <PRMBOQDetail_DetailedCustomEntity>(); } if (prmBOQDetailListByBoth == null || prmBOQDetailListByBoth.Count <= 0) { prmBOQDetailListByBoth = new List <PRMBOQDetail_DetailedCustomEntity>(); } IList <PRMBOQDetail_DetailedCustomEntity> tempBOQItemList = prmBOQDetailListByBoth.Except(prmBOQDetailListBySuffix, new BOQItemComparer()).ToList(); IList <PRMBOQDetail_DetailedCustomEntity> BOQItemList = new List <PRMBOQDetail_DetailedCustomEntity>(); BOQItemList = prmBOQDetailListBySuffix; if (tempBOQItemList != null && tempBOQItemList.Count > 0) { foreach (PRMBOQDetail_DetailedCustomEntity ent in tempBOQItemList) { //If Zero Qty is not need to show or We can manage it From DB //if (ent.TotalQty > 0) //{ BOQItemList.Add(ent); //} } } if (BOQItemList != null && BOQItemList.Count > 0) { foreach (PRMBOQDetail_DetailedCustomEntity entItem in BOQItemList) { if (prefixText.Equals(entItem.ItemName)) { return(new string[0]); } items.Add(AutoCompleteExtender.CreateAutoCompleteItem(entItem.ItemName.ToString(), entItem.ItemID.ToString())); } } else { items.Add(AutoCompleteExtender.CreateAutoCompleteItem("No Items Available", "0")); } #endregion break; case false: #region Get Item From Pre-BOQ String fePreBOQSufix1 = SqlExpressionBuilder.PrepareFilterExpression("PRMPreBOQDetail." + PRMPreBOQDetail_DetailedCustomEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); String fePreBOQSufix2 = SqlExpressionBuilder.PrepareFilterExpression("MDItem." + PRMPreBOQDetail_DetailedCustomEntity.FLD_NAME_ItemName, prefixText, SQLMatchType.LikeWithSuffixMath); String filterExpressionSuffix = SqlExpressionBuilder.PrepareFilterExpression(fePreBOQSufix1, SQLJoinType.AND, fePreBOQSufix2); IList <PRMPreBOQDetail_DetailedCustomEntity> preBOQDetailListBySuffix = FCCPRMPreBOQDetail_DetailedCustom.GetFacadeCreate().GetIL(filterExpressionSuffix); String feBothPreBOQ = SqlExpressionBuilder.PrepareFilterExpression("PRMPreBOQDetail." + PRMPreBOQDetail_DetailedCustomEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); String feBoth1 = SqlExpressionBuilder.PrepareFilterExpression("MDItem." + MDItemEntity.FLD_NAME_ItemName, prefixText, SQLMatchType.LikeWithBothMath); String feBoth = SqlExpressionBuilder.PrepareFilterExpression(feBothPreBOQ, SQLJoinType.AND, feBoth1); IList <PRMPreBOQDetail_DetailedCustomEntity> preBOQDetailListByBoth = FCCPRMPreBOQDetail_DetailedCustom.GetFacadeCreate().GetIL(feBoth); if (preBOQDetailListBySuffix == null || preBOQDetailListBySuffix.Count <= 0) { preBOQDetailListBySuffix = new List <PRMPreBOQDetail_DetailedCustomEntity>(); } if (preBOQDetailListByBoth == null || preBOQDetailListByBoth.Count <= 0) { preBOQDetailListByBoth = new List <PRMPreBOQDetail_DetailedCustomEntity>(); } IList <PRMPreBOQDetail_DetailedCustomEntity> tempPreBOQItemList = preBOQDetailListByBoth.Except(preBOQDetailListBySuffix, new PreBOQItemComparer()).ToList(); IList <PRMPreBOQDetail_DetailedCustomEntity> PreBOQItemList = new List <PRMPreBOQDetail_DetailedCustomEntity>(); PreBOQItemList = preBOQDetailListBySuffix; if (tempPreBOQItemList != null && tempPreBOQItemList.Count > 0) { foreach (PRMPreBOQDetail_DetailedCustomEntity ent in tempPreBOQItemList) { //If Zero Qty is not need to show or We can manage it From DB //if (ent.TotalQty > 0) //{ PreBOQItemList.Add(ent); // } } } if (PreBOQItemList != null && PreBOQItemList.Count > 0) { foreach (PRMPreBOQDetail_DetailedCustomEntity entItem in PreBOQItemList) { if (prefixText.Equals(entItem.ItemName)) { return(new string[0]); } items.Add(AutoCompleteExtender.CreateAutoCompleteItem(entItem.ItemName.ToString(), entItem.ItemID.ToString())); } } else { items.Add(AutoCompleteExtender.CreateAutoCompleteItem("No Items Available", "0")); } #endregion break; default: break; } } else { items.Add(AutoCompleteExtender.CreateAutoCompleteItem("Pre-BOQ Is Not Ready Yet.", "0")); } } #endregion return(items.ToArray()); }
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; } } } } }
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; } } } }
protected void btnPnlSaveAdditionalQty_Click(object sender, EventArgs e) { PRMPreBOQDetailEntity pRMBOQDetailEntity = FCCPRMPreBOQDetail.GetFacadeCreate().GetByID(_CurrentPreBOQDetailIDPopup); if (pRMBOQDetailEntity != null && pRMBOQDetailEntity.PreBOQDetailID > 0) { Decimal additionalQty = 0; Decimal.TryParse(txtQty.Text.Trim().ToString(), out additionalQty); PRMAvailableBOQQtyForRequisitionEntity pRMAvailableBOQQtyForRequisitionEntity = new PRMAvailableBOQQtyForRequisitionEntity(); pRMAvailableBOQQtyForRequisitionEntity.IsBOQ = false; pRMAvailableBOQQtyForRequisitionEntity.PreBOQOrBOQDetailID = _CurrentPreBOQDetailIDPopup; pRMAvailableBOQQtyForRequisitionEntity.ItemID = pRMBOQDetailEntity.ItemID; pRMAvailableBOQQtyForRequisitionEntity.Qty = additionalQty; pRMAvailableBOQQtyForRequisitionEntity.CreateDate = DateTime.Now; pRMAvailableBOQQtyForRequisitionEntity.CreatedByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember); PRMPreBOQEntity pRMPreBOQEntity = FCCPRMPreBOQ.GetFacadeCreate().GetByID(pRMBOQDetailEntity.PreBOQID); pRMAvailableBOQQtyForRequisitionEntity.ProjectID = pRMPreBOQEntity.ProjectID; Int64 result = -1; result = FCCPRMAvailableBOQQtyForRequisition.GetFacadeCreate().Add(pRMAvailableBOQQtyForRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No); if (result > 0) { String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQDetailID, _CurrentPreBOQDetailIDPopup.ToString(), SQLMatchType.Equal); pRMBOQDetailEntity.TotalQty = pRMBOQDetailEntity.TotalQty + additionalQty; FCCPRMPreBOQDetail.GetFacadeCreate().Update(pRMBOQDetailEntity, fe, DatabaseOperationType.Update, TransactionRequired.No); IList <ListViewDataItem> list = lvPRMPreBOQDetail.Items; if (list != null && list.Count > 0) { Int32 tempDataItemIndex = 0; foreach (ListViewDataItem lvdi in list) { DataKey currentDataKey = lvPRMPreBOQDetail.DataKeys[tempDataItemIndex++]; Int64 PreBOQDetailID = (Int64)currentDataKey["PreBOQDetailID"]; if (_CurrentPreBOQDetailIDPopup == PreBOQDetailID) { TextBox txtTotalQtyLV = (TextBox)lvdi.FindControl("txtTotalQtyLV"); txtTotalQtyLV.Text = pRMBOQDetailEntity.TotalQty.ToString(); } } } BindPRMPreBOQDetailList(); #region PreBOQ Floor Detail String fe_projectFloor = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQFloorDetailEntity.FLD_NAME_PreBOQDetailID, _CurrentPreBOQDetailIDPopup.ToString(), SQLMatchType.Equal); IList <PRMPreBOQFloorDetailEntity> lstPRMPreBOQFloorDetail = FCCPRMPreBOQFloorDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_projectFloor, DatabaseOperationType.LoadWithFilterExpression); if (lstPRMPreBOQFloorDetail != null && lstPRMPreBOQFloorDetail.Count > 0) { Int64 totalfloorCount = lstPRMPreBOQFloorDetail.Count; Decimal avgQty = pRMBOQDetailEntity.TotalQty / totalfloorCount; foreach (PRMPreBOQFloorDetailEntity ent in lstPRMPreBOQFloorDetail) { String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQFloorDetailEntity.FLD_NAME_PreBOQFloorDetailID, ent.PreBOQFloorDetailID.ToString(), SQLMatchType.Equal); ent.Qty = avgQty; FCCPRMPreBOQFloorDetail.GetFacadeCreate().Update(ent, fe1, DatabaseOperationType.Update, TransactionRequired.No); } } #endregion this.ModalPopupExtender1.Hide(); } } }
protected override void OnSelectedNodeChanged(EventArgs e) { TreeNode selectedNode = this.SelectedNode; Int64 itemCategoryID = Int64.Parse(selectedNode.Value); switch (selectedNode.Depth) { case 0: break; case 1: String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, ProjectID.ToString(), SQLMatchType.Equal); IList <PRMPreBOQEntity> lstPreBOQ = FCCPRMPreBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lstPreBOQ != null && lstPreBOQ.Count > 0) { switch (lstPreBOQ[0].IsLocked) { case true: #region Get Item From BOQ/Project Cost if (selectedNode.ChildNodes.Count <= 0) { IList <PRMBOQRequisitionItem_CustomEntity> itemList = FCCPRMBOQRequisitionItem_Custom.GetFacadeCreate().GetIL(ProjectID, itemCategoryID); //IList<MDItemEntity> itemList = FCCMDItem.GetFacadeCreate().GetByCategoryIDILFC(itemCategoryID); if (itemList != null && itemList.Count > 0) { foreach (PRMBOQRequisitionItem_CustomEntity ent in itemList) { TreeNode childItemCategory = new TreeNode(); childItemCategory.Text = ent.MDItemItemName; childItemCategory.Value = ent.ItemID.ToString(); childItemCategory.SelectAction = TreeNodeSelectAction.Select; if (ShowCheckBoxesInAllNodes == true) { childItemCategory.ShowCheckBox = true; if (ShowCheckedAtLastNode == true) { childItemCategory.Checked = true; } } selectedNode.ChildNodes.Add(childItemCategory); } } } #endregion break; case false: #region Get Item From Pre BOQ/ BOQ if (selectedNode.ChildNodes.Count <= 0) { IList <PRMPreBOQRequisitionItem_CustomEntity> itemList = FCCPRMPreBOQRequisitionItem_Custom.GetFacadeCreate().GetIL(ProjectID, itemCategoryID); //IList<MDItemEntity> itemList = FCCMDItem.GetFacadeCreate().GetByCategoryIDILFC(itemCategoryID); if (itemList != null && itemList.Count > 0) { foreach (PRMPreBOQRequisitionItem_CustomEntity ent in itemList) { TreeNode childItemCategory = new TreeNode(); childItemCategory.Text = ent.MDItemItemName; childItemCategory.Value = ent.ItemID.ToString(); childItemCategory.SelectAction = TreeNodeSelectAction.Select; if (ShowCheckBoxesInAllNodes == true) { childItemCategory.ShowCheckBox = true; if (ShowCheckedAtLastNode == true) { childItemCategory.Checked = true; } } selectedNode.ChildNodes.Add(childItemCategory); } } } #endregion break; } } break; case 2: break; default: break; } base.OnSelectedNodeChanged(e); }
private void SavePreBOQDetailInfo() { try { #region Getting the checked items from tree IList <PRMPreBOQDetailEntity> checkedItemsFromTree = new List <PRMPreBOQDetailEntity>(); foreach (TreeNode tn in treeItem.CheckedNodes) { PRMPreBOQDetailEntity ent = new PRMPreBOQDetailEntity(); ent.ItemID = Int64.Parse(tn.Value.ToString()); checkedItemsFromTree.Add(ent); } #endregion Int64 preBOQID = 0; if (isNewEntry == true) { preBOQID = FCCPRMPreBOQ.GetFacadeCreate().Add(BuildPRMPreBOQEntity(), DatabaseOperationType.Add, TransactionRequired.No); } else { preBOQID = currentPreBOQ.PreBOQID; String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); // FCCPRMPreBOQDetail.GetFacadeCreate().Delete(new PRMPreBOQDetailEntity(), fe, DatabaseOperationType.Delete, TransactionRequired.No); } #region Adding OLD //IList<PRMPreBOQDetailEntity> addListOfNotPopulatedItems = currentlyCheckedItems.Except(populatedItems, new CustomerComparer()).ToList(); //StringBuilder xmlStr = new StringBuilder(); //String subXmlStr = String.Empty; //xmlStr.Append("<m>"); //foreach (PRMPreBOQDetailEntity ent in addListOfNotPopulatedItems) //{ // subXmlStr = subXmlStr + "<i><a>" + preBOQID + "</a><b>" + ent.ItemID + "</b></i>"; //} //foreach (PRMPreBOQDetailEntity ent in checkedItemsFromTree) //{ // subXmlStr = subXmlStr + "<i><a>" + preBOQID + "</a><b>" + ent.ItemID + "</b></i>"; //} //xmlStr.Append(subXmlStr.ToString()); //xmlStr.Append("</m>"); //FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.PreBOQDetailTableInfo); #endregion OLD #region Adding New IList <PRMPreBOQDetailEntity> addListOfNotPopulatedItems = currentlyCheckedItems.Except(populatedItems, new CustomerComparer()).ToList(); IList <PRMPreBOQDetailEntity> completeAddList = new List <PRMPreBOQDetailEntity>(); completeAddList = addListOfNotPopulatedItems; foreach (PRMPreBOQDetailEntity ent in checkedItemsFromTree) { completeAddList.Add(ent); } IList <PRMPreBOQDetailEntity> finalAddList = completeAddList.Except(mappedItemsFromDB, new CustomerComparer()).ToList(); IList <PRMPreBOQDetailEntity> finalDeleteList = mappedItemsFromDB.Except(completeAddList, new CustomerComparer()).ToList(); if (finalAddList != null && finalAddList.Count > 0) { StringBuilder xmlStr = new StringBuilder(); String subXmlStr = String.Empty; xmlStr.Append("<m>"); foreach (PRMPreBOQDetailEntity ent in finalAddList) { #region SET Item Rate and Qty OLD #region Get and Assign Item Price ////Collect Item Actual Price with Default Brand, Vendor, Region, Country ID. //Decimal ActualPrice=0; //Int64 BrandID=MasterDataConstants.ItemDefaults.DEFAULT_BRAD; //Int64 SupplierID=MasterDataConstants.ItemDefaults.DEFAULT_SUPPLIER; //Int64 RegionID=MasterDataConstants.ItemDefaults.DEFAULT_REGION; //Int64 CountryID= MasterDataConstants.ItemDefaults.DEFAULT_COUNTRY; //String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); //IList<MDItemDefaultEntity> itemDefaultList = FCCMDItemDefault.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); //if (itemDefaultList != null && itemDefaultList.Count > 0) //{ // Int64.TryParse(itemDefaultList[0].BrandID.ToString(),out BrandID); // Int64.TryParse(itemDefaultList[0].SupplierID.ToString(), out SupplierID); // Int64.TryParse(itemDefaultList[0].RegionID.ToString(), out RegionID); // Int64.TryParse(itemDefaultList[0].CountryID.ToString(), out CountryID); //} //var supplierItemMap = (from s in supplierItemMapList // where s.ItemID == ent.ItemID // && s.BrandID == BrandID // && s.SupplierID == SupplierID // && s.OriginRegionID == RegionID // && s.OriginCountryID == CountryID // select s).ToList(); //if (supplierItemMap != null && supplierItemMap.Count > 0) //{ // Decimal.TryParse(supplierItemMap[0].Price.ToString(), out ActualPrice); //} #endregion #region Thumb Rules ////Collect Total Qty From Thumb Rules //Decimal totalQty = 0; //String feThumbRule = SqlExpressionBuilder.PrepareFilterExpression(MDItemThumbRuleEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); //IList<MDItemThumbRuleEntity> itemThumbRuleList = FCCMDItemThumbRule.GetFacadeCreate().GetIL(null, null, String.Empty, feThumbRule, DatabaseOperationType.LoadWithFilterExpression); //if (itemThumbRuleList != null && itemThumbRuleList.Count > 0) //{ // totalQty += itemThumbRuleList[0].FloorQuantity * itemThumbRuleList[0].FloorRuleVariable * this.OverviewProject.LandAreaSft.Value * this.OverviewProject.NoOfStoried.Value; // totalQty += itemThumbRuleList[0].BasementQuantity * itemThumbRuleList[0].BasementRuleVariable * this.OverviewProject.LandAreaSft.Value * this.OverviewProject.NoOfBasement.Value; // totalQty += itemThumbRuleList[0].OverallQuantity * itemThumbRuleList[0].OverallRuleVariable * this.OverviewProject.LandAreaSft.Value; //} #endregion #endregion #region SET Item Rate and Qty //GET Item Actual Price From Pre-BOQ or Set Zero Decimal actualPrice = 0; Decimal totalQty = 0; Boolean importPriceFlag = false, importQtyFlag = false; foreach (ListItem chbxItem in chbxImportInfoList.Items) { if (chbxItem.Selected == true && chbxItem.Text == CommonConstants.IMPORT_RATE_INFO) { importPriceFlag = true; } if (chbxItem.Selected == true && chbxItem.Text == CommonConstants.IMPORT_QTY_INFO) { importQtyFlag = true; } } Int64 BrandID = MasterDataConstants.ItemDefaults.DEFAULT_BRAD; Int64 SupplierID = MasterDataConstants.ItemDefaults.DEFAULT_SUPPLIER; Int64 RegionID = MasterDataConstants.ItemDefaults.DEFAULT_REGION; Int64 CountryID = MasterDataConstants.ItemDefaults.DEFAULT_COUNTRY; IList <PRMPreBOQDetailEntity> _pRMPreBOQDeatilEntity = (from s in mappedItemsFromDB where s.ItemID == ent.ItemID select s).ToList(); if (importPriceFlag) { if (_pRMPreBOQDeatilEntity != null && _pRMPreBOQDeatilEntity.Count > 0 && _pRMPreBOQDeatilEntity[0].Rate > 0) { Int64.TryParse(_pRMPreBOQDeatilEntity[0].BrandID.ToString(), out BrandID); Int64.TryParse(_pRMPreBOQDeatilEntity[0].SupplierID.ToString(), out SupplierID); Int64.TryParse(_pRMPreBOQDeatilEntity[0].RegionID.ToString(), out RegionID); Int64.TryParse(_pRMPreBOQDeatilEntity[0].CountryID.ToString(), out CountryID); Decimal.TryParse(_pRMPreBOQDeatilEntity[0].Rate.ToString(), out actualPrice); } else { #region SET Rate From Price Database String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); IList <MDItemDefaultEntity> itemDefaultList = FCCMDItemDefault.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (itemDefaultList != null && itemDefaultList.Count > 0) { Int64.TryParse(itemDefaultList[0].BrandID.ToString(), out BrandID); Int64.TryParse(itemDefaultList[0].SupplierID.ToString(), out SupplierID); Int64.TryParse(itemDefaultList[0].RegionID.ToString(), out RegionID); Int64.TryParse(itemDefaultList[0].CountryID.ToString(), out CountryID); } var supplierItemMap = (from s in supplierItemMapList where s.ItemID == ent.ItemID && s.BrandID == BrandID && s.SupplierID == SupplierID && s.OriginRegionID == RegionID && s.OriginCountryID == CountryID select s).ToList(); if (supplierItemMap != null && supplierItemMap.Count > 0) { Decimal.TryParse(supplierItemMap[0].Price.ToString(), out actualPrice); } #endregion } } if (importQtyFlag) { if (_pRMPreBOQDeatilEntity != null && _pRMPreBOQDeatilEntity.Count > 0 && _pRMPreBOQDeatilEntity[0].TotalQty > 0) { Decimal.TryParse(_pRMPreBOQDeatilEntity[0].TotalQty.ToString(), out totalQty); } else { #region GET Qty From ThumbRule String feThumbRule = SqlExpressionBuilder.PrepareFilterExpression(MDItemThumbRuleEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); IList <MDItemThumbRuleEntity> itemThumbRuleList = FCCMDItemThumbRule.GetFacadeCreate().GetIL(null, null, String.Empty, feThumbRule, DatabaseOperationType.LoadWithFilterExpression); if (itemThumbRuleList != null && itemThumbRuleList.Count > 0) { totalQty += itemThumbRuleList[0].FloorQuantity * itemThumbRuleList[0].FloorRuleVariable * this.OverviewProject.LandAreaSft.Value * this.OverviewProject.NoOfStoried.Value; totalQty += itemThumbRuleList[0].BasementQuantity * itemThumbRuleList[0].BasementRuleVariable * this.OverviewProject.LandAreaSft.Value * this.OverviewProject.NoOfBasement.Value; totalQty += itemThumbRuleList[0].OverallQuantity * itemThumbRuleList[0].OverallRuleVariable * this.OverviewProject.LandAreaSft.Value; } #endregion } } #endregion subXmlStr = subXmlStr + "<i><a>" + preBOQID + "</a><b>" + ent.ItemID + "</b><c>" + actualPrice + "</c><d>" + totalQty + "</d><e>" + String.Empty + "</e><f>" + MiscUtil.ParseToDateTime(DateTime.Now.ToStringDefault()) + "</f><g>" + BrandID + "</g><j>" + SupplierID + "</j><k>" + RegionID + "</k><l>" + CountryID + "</l></i>"; } xmlStr.Append(subXmlStr.ToString()); xmlStr.Append("</m>"); FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.PreBOQDetailTableInfo); } #endregion New #region DeleteFromDB New if (finalDeleteList != null && finalDeleteList.Count > 0) { foreach (PRMPreBOQDetailEntity ent in finalDeleteList) { String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQDetailID, ent.PreBOQDetailID.ToString(), SQLMatchType.Equal); FCCPRMPreBOQDetail.GetFacadeCreate().Delete(new PRMPreBOQDetailEntity(), fe, DatabaseOperationType.Delete, TransactionRequired.No); } } #endregion DeleteFromDB New #region Backup //else //{ // IList<PRMPreBOQDetailEntity> temp_currentlyCheckedItems = currentlyCheckedItems.Except(populatedItems, new CustomerComparer()).ToList(); // IList<PRMPreBOQDetailEntity> temp_mappedItemsFromDB = mappedItemsFromDB.Except(populatedItems, new CustomerComparer()).ToList(); // IList<PRMPreBOQDetailEntity> al = temp_currentlyCheckedItems.Except(temp_mappedItemsFromDB, new CustomerComparer()).ToList(); // IList<PRMPreBOQDetailEntity> dl = temp_mappedItemsFromDB.Except(temp_currentlyCheckedItems, new CustomerComparer()).ToList(); // IList<PRMPreBOQDetailEntity> new_al = checkedItemsFromTree.Except(populatedCheckedItems, new CustomerComparer()).ToList(); // IList<PRMPreBOQDetailEntity> new_dl = populatedCheckedItems.Except(checkedItemsFromTree, new CustomerComparer()).ToList(); // #region Deleting // foreach (PRMPreBOQDetailEntity ent in new_dl) // { // String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); // String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); // String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); // FCCPRMPreBOQDetail.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No); // } // foreach (PRMPreBOQDetailEntity ent in dl) // { // String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal); // String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); // String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); // FCCPRMPreBOQDetail.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No); // } // #endregion // #region Adding // StringBuilder xmlStr = new StringBuilder(); // String subXmlStr = String.Empty; // xmlStr.Append("<m>"); // foreach (PRMPreBOQDetailEntity ent in new_al) // { // subXmlStr = subXmlStr + "<i><a>" + preBOQID + "</a><b>" + ent.ItemID + "</b></i>"; // } // foreach (PRMPreBOQDetailEntity ent in al) // { // subXmlStr = subXmlStr + "<i><a>" + preBOQID + "</a><b>" + ent.ItemID + "</b></i>"; // } // xmlStr.Append(subXmlStr.ToString()); // xmlStr.Append("</m>"); // FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.PreBOQDetailTableInfo); // #endregion //} #endregion treeItem.ReBuildTree(); PrepareFormView(); MiscUtil.ShowMessage(lblMessage, "BOQ Setup Updated Successfully.", false); } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true); } }
private void PrepareFormView() { populatedItems = new List <PRMPreBOQDetailEntity>(); populatedCheckedItems = new List <PRMPreBOQDetailEntity>(); BuildDropDownList(); #region New or Update mode decission making String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, this.OverviewProjectID.ToString(), SQLMatchType.Equal); IList <PRMPreBOQEntity> lst = FCCPRMPreBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lst != null && lst.Count > 0) { isNewEntry = false; currentPreBOQ = lst[0]; } else { isNewEntry = true; currentPreBOQ = null; } #endregion currentlyCheckedItems = new List <PRMPreBOQDetailEntity>(); mappedItemsFromDB = new List <PRMPreBOQDetailEntity>(); #region Determine Current Mapped & Checked Items if (isNewEntry == true) { IList <MDItemEntity> itemList = FCCMDItem.GetFacadeCreate().GetILFC(); if (itemList != null && itemList.Count > 0) { foreach (MDItemEntity item in itemList) { PRMPreBOQDetailEntity ent = new PRMPreBOQDetailEntity(); ent.ItemID = item.ItemID; currentlyCheckedItems.Add(ent); } } } else { String fe_PreBOQDetail = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQID, currentPreBOQ.PreBOQID.ToString(), SQLMatchType.Equal); mappedItemsFromDB = FCCPRMPreBOQDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_PreBOQDetail, DatabaseOperationType.LoadWithFilterExpression); if (mappedItemsFromDB == null) { mappedItemsFromDB = new List <PRMPreBOQDetailEntity>(); } currentlyCheckedItems = mappedItemsFromDB; } #endregion if (isNewEntry == true) { FormLock(false); } else { FormLock(currentPreBOQ.IsLocked); } }