public IList <BDProcessAssignedResourceEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <BDProcessAssignedResourceEntity> bDProcessAssignedResourceEntityList = new List <BDProcessAssignedResourceEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = BDProcessAssignedResourceEntity.FLD_NAME_ProcessAssignedResourceID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; bDProcessAssignedResourceEntityList = FCCBDProcessAssignedResource.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (bDProcessAssignedResourceEntityList != null && bDProcessAssignedResourceEntityList.Count > 0) { totalRowCount = bDProcessAssignedResourceEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(bDProcessAssignedResourceEntityList ?? new List <BDProcessAssignedResourceEntity>()); }
protected void lvBDProcessAssignedResource_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 ProcessAssignedResourceID; Int64.TryParse(e.CommandArgument.ToString(), out ProcessAssignedResourceID); if (ProcessAssignedResourceID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _ProcessAssignedResourceID = ProcessAssignedResourceID; PrepareEditView(); } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProcessAssignedResourceEntity.FLD_NAME_ProcessAssignedResourceID, ProcessAssignedResourceID.ToString(), SQLMatchType.Equal); BDProcessAssignedResourceEntity bDProcessAssignedResourceEntity = new BDProcessAssignedResourceEntity(); result = FCCBDProcessAssignedResource.GetFacadeCreate().Delete(bDProcessAssignedResourceEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _ProcessAssignedResourceID = 0; _BDProcessAssignedResourceEntity = new BDProcessAssignedResourceEntity(); PrepareInitialView(); BindBDProcessAssignedResourceList(); MiscUtil.ShowMessage(lblMessage, "Process Assigned Resource has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Process Assigned Resource.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <BDProcessAssignedResourceEntity> GetData() { IList <BDProcessAssignedResourceEntity> bDProcessAssignedResourceEntityList = new List <BDProcessAssignedResourceEntity>(); try { bDProcessAssignedResourceEntityList = FCCBDProcessAssignedResource.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (bDProcessAssignedResourceEntityList != null && bDProcessAssignedResourceEntityList.Count > 0) { totalRowCount = bDProcessAssignedResourceEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(bDProcessAssignedResourceEntityList ?? new List <BDProcessAssignedResourceEntity>()); }
private void SaveBDProcessAssignedResourceEntity() { if (IsValid) { try { BDProcessAssignedResourceEntity bDProcessAssignedResourceEntity = BuildBDProcessAssignedResourceEntity(); Int64 result = -1; if (bDProcessAssignedResourceEntity.IsNew) { result = FCCBDProcessAssignedResource.GetFacadeCreate().Add(bDProcessAssignedResourceEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDProcessAssignedResourceEntity.FLD_NAME_ProcessAssignedResourceID, bDProcessAssignedResourceEntity.ProcessAssignedResourceID.ToString(), SQLMatchType.Equal); result = FCCBDProcessAssignedResource.GetFacadeCreate().Update(bDProcessAssignedResourceEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { BDProcessAssignedResourceMapEntity bDProcessAssignedResourceMapEntity = CurrentBDProcessAssignedResourceMapEntity; String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProcessAssignedResourceMapEntity.FLD_NAME_ProcessAssignedResourceID, result.ToString(), SQLMatchType.Equal); IList <BDProcessAssignedResourceMapEntity> mappedItemsFromDB = FCCBDProcessAssignedResourceMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); IList <CRMContactList_CustomEntity> tempAddList = new List <CRMContactList_CustomEntity>(); if (mappedItemsFromDB != null && mappedItemsFromDB.Count > 0) { foreach (BDProcessAssignedResourceMapEntity ent in mappedItemsFromDB) { CRMContactList_CustomEntity cRMContactList_CustomEntity = new CRMContactList_CustomEntity(); cRMContactList_CustomEntity.ResourceID = ent.ReferenceID; cRMContactList_CustomEntity.ResourceCategoryID = ent.ResourceCategoryID.ToString(); cRMContactList_CustomEntity.ResourceName = ent.ResourceName; cRMContactList_CustomEntity.ResourceDesignation = ent.ResourceDesignation; cRMContactList_CustomEntity.ResourceEmail = ent.ResourceEmail; cRMContactList_CustomEntity.AddressLine1 = ent.AddressLine1; cRMContactList_CustomEntity.AddressLine2 = ent.AddressLine2; cRMContactList_CustomEntity.ResourceMobileNo = ent.ResourceMobileNo; Int64 resourceTypeID = 0; Int64.TryParse(ent.ResourceTypeID.ToString(), out resourceTypeID); cRMContactList_CustomEntity.ResourceTypeID = resourceTypeID; cRMContactList_CustomEntity.ResourceCompany = ent.ResourceCompany; tempAddList.Add(cRMContactList_CustomEntity); } } IList <CRMContactList_CustomEntity> finalAddList = IssueCRMContactList_CustomEntityList.Except(tempAddList, new CustomerComparer()).ToList(); IList <CRMContactList_CustomEntity> finalDeleteList = tempAddList.Except(IssueCRMContactList_CustomEntityList, new CustomerComparer()).ToList(); foreach (CRMContactList_CustomEntity ent in finalAddList) { bDProcessAssignedResourceMapEntity.ProcessAssignedResourceID = result; bDProcessAssignedResourceMapEntity.ResourceCategoryID = Int64.Parse(ent.ResourceCategoryID.ToString()); bDProcessAssignedResourceMapEntity.ReferenceID = ent.ResourceID; bDProcessAssignedResourceMapEntity.ResourceName = ent.ResourceName; bDProcessAssignedResourceMapEntity.ResourceDesignation = ent.ResourceDesignation; bDProcessAssignedResourceMapEntity.ResourceEmail = ent.ResourceEmail; bDProcessAssignedResourceMapEntity.ResourceMobileNo = ent.ResourceMobileNo; bDProcessAssignedResourceMapEntity.AddressLine1 = ent.AddressLine1; bDProcessAssignedResourceMapEntity.AddressLine2 = ent.AddressLine2; Int64 resourceTypeID = 0; Int64.TryParse(ent.ResourceTypeID.ToString(), out resourceTypeID); bDProcessAssignedResourceMapEntity.ResourceTypeID = resourceTypeID; bDProcessAssignedResourceMapEntity.ResourceCompany = ent.ResourceCompany; bDProcessAssignedResourceMapEntity.Remarks = txtRemarks.Text.Trim(); FCCBDProcessAssignedResourceMap.GetFacadeCreate().Add(bDProcessAssignedResourceMapEntity, DatabaseOperationType.Add, TransactionRequired.No); } foreach (CRMContactList_CustomEntity ent in finalDeleteList) { String fe1 = SqlExpressionBuilder.PrepareFilterExpression(BDProcessAssignedResourceMapEntity.FLD_NAME_ReferenceID, ent.ResourceID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(BDProcessAssignedResourceMapEntity.FLD_NAME_ResourceCategoryID, ent.ResourceCategoryID, SQLMatchType.Equal); String fe_delete = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); FCCBDProcessAssignedResourceMap.GetFacadeCreate().Delete(bDProcessAssignedResourceMapEntity, fe_delete, DatabaseOperationType.Delete, TransactionRequired.No); } if (!bDProcessAssignedResourceEntity.IsNew) { //_ProcessAssignedResourceID = 0; //_BDProcessAssignedResourceEntity = new BDProcessAssignedResourceEntity(); } _ProcessAssignedResourceID = result; PrepareEditView(); BindBDProcessAssignedResourceMapList(); if (bDProcessAssignedResourceEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Process Assigned Resource Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Process Assigned Resource Information has been updated successfully.", false); } } else { if (bDProcessAssignedResourceEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Process Assigned Resource Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Process Assigned Resource Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }