public IList <PRMPreBOQTemplateItemMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <PRMPreBOQTemplateItemMapEntity> pRMPreBOQTemplateItemMapEntityList = new List <PRMPreBOQTemplateItemMapEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = PRMPreBOQTemplateItemMapEntity.FLD_NAME_PreBOQTemplateItemMapID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; pRMPreBOQTemplateItemMapEntityList = FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (pRMPreBOQTemplateItemMapEntityList != null && pRMPreBOQTemplateItemMapEntityList.Count > 0) { totalRowCount = pRMPreBOQTemplateItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMPreBOQTemplateItemMapEntityList ?? new List <PRMPreBOQTemplateItemMapEntity>()); }
protected void ddlPreBOQTemplateID_SelectedIndexChanged(object sender, EventArgs e) { Int64 preBOQTemplateID = 0; Int64.TryParse(ddlPreBOQTemplateID.SelectedValue, out preBOQTemplateID); // getting selected Item for template if (preBOQTemplateID > 0) { populatedItems = new List <PRMPreBOQDetailEntity>(); populatedCheckedItems = new List <PRMPreBOQDetailEntity>(); currentlyCheckedItems = new List <PRMPreBOQDetailEntity>(); IList <PRMPreBOQTemplateItemMapEntity> templateItemList = new List <PRMPreBOQTemplateItemMapEntity>(); String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQTemplateItemMapEntity.FLD_NAME_PreBOQTemplateID, preBOQTemplateID.ToString(), SQLMatchType.Equal); templateItemList = FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (templateItemList != null && templateItemList.Count > 0) { foreach (PRMPreBOQTemplateItemMapEntity ent in templateItemList) { PRMPreBOQDetailEntity preBOQDetail = new PRMPreBOQDetailEntity(); preBOQDetail.ItemID = ent.ItemID; currentlyCheckedItems.Add(preBOQDetail); treeItem.ReBuildTree(); } } } }
private void PrepareEditView() { String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQTemplateItemMapEntity.FLD_NAME_PreBOQTemplateID, PreBOQTemplateID.ToString(), SQLMatchType.Equal); currentMappedItems = FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (currentMappedItems == null) { currentMappedItems = new List <PRMPreBOQTemplateItemMapEntity>(); } }
public IList <PRMPreBOQTemplateItemMapEntity> GetData() { IList <PRMPreBOQTemplateItemMapEntity> pRMPreBOQTemplateItemMapEntityList = new List <PRMPreBOQTemplateItemMapEntity>(); try { pRMPreBOQTemplateItemMapEntityList = FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (pRMPreBOQTemplateItemMapEntityList != null && pRMPreBOQTemplateItemMapEntityList.Count > 0) { totalRowCount = pRMPreBOQTemplateItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMPreBOQTemplateItemMapEntityList ?? new List <PRMPreBOQTemplateItemMapEntity>()); }
private void SavePRMPreBOQTemplateItemMapEntity() { try { foreach (TreeNode catNode in treeItem.Nodes) { PrepareCurrentlyPopulatedMappedItems(catNode); } foreach (TreeNode tn in treeItem.CheckedNodes) { PRMPreBOQTemplateItemMapEntity ent = new PRMPreBOQTemplateItemMapEntity(); ent.ItemID = Int64.Parse(tn.Value.ToString()); ent.PreBOQTemplateID = PreBOQTemplateID; newMappedItems.Add(ent); } if (currentMappedItems.Count <= 0) { IList <PRMPreBOQTemplateItemMapEntity> unCheckedList = currentlyPopulatedMappedItems.Except(newMappedItems, new CustomerComparer()).ToList(); IList <PRMPreBOQTemplateItemMapEntity> templateItemList = new List <PRMPreBOQTemplateItemMapEntity>(); foreach (var v in temporaryMappedItems) { PRMPreBOQTemplateItemMapEntity ent = new PRMPreBOQTemplateItemMapEntity(); ent.ItemID = v.ItemID; ent.PreBOQTemplateID = PreBOQTemplateID; templateItemList.Add(ent); } IList <PRMPreBOQTemplateItemMapEntity> addCheckedList = templateItemList.Except(unCheckedList, new CustomerComparerAnother()).ToList(); Int64 i = 0; StringBuilder xmlStr = new StringBuilder(); xmlStr.Append("<m>"); String subXmlStr = null; foreach (PRMPreBOQTemplateItemMapEntity ent in addCheckedList) { i++; subXmlStr = subXmlStr + "<i><a>" + ent.PreBOQTemplateID + "</a><b>" + ent.ItemID + "</b><c>" + i + "</c></i>"; } xmlStr.Append(subXmlStr.ToString()); xmlStr.Append("</m>"); FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.PreBOQItemMapTableInfo); } else if (currentMappedItems.Count > 0) { currentlyPopulatedMappedItems = currentlyPopulatedMappedItems.Intersect(currentMappedItems, new CustomerComparer()).ToList(); IList <PRMPreBOQTemplateItemMapEntity> deleteList = currentlyPopulatedMappedItems.Except(newMappedItems, new CustomerComparer()).ToList(); IList <PRMPreBOQTemplateItemMapEntity> addNewList = newMappedItems.Except(currentlyPopulatedMappedItems, new CustomerComparer()).ToList(); if (deleteList != null && deleteList.Count > 0) { foreach (PRMPreBOQTemplateItemMapEntity ent in deleteList) { String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQTemplateItemMapEntity.FLD_NAME_PreBOQTemplateID, ent.PreBOQTemplateID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQTemplateItemMapEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No); } } if (addNewList != null && addNewList.Count > 0) { foreach (PRMPreBOQTemplateItemMapEntity ent in addNewList) { FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No); } } } MiscUtil.ShowMessage(lblMessage, "Template BOQ Item Map Updated Successfully.", false); } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true); } }