public IList <CRMMDAgreementVariableEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <CRMMDAgreementVariableEntity> cRMMDAgreementVariableEntityList = new List <CRMMDAgreementVariableEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = CRMMDAgreementVariableEntity.FLD_NAME_AgreementVariableID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; cRMMDAgreementVariableEntityList = FCCCRMMDAgreementVariable.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (cRMMDAgreementVariableEntityList != null && cRMMDAgreementVariableEntityList.Count > 0) { totalRowCount = cRMMDAgreementVariableEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cRMMDAgreementVariableEntityList ?? new List <CRMMDAgreementVariableEntity>()); }
private void SaveCRMMDAgreementVariableEntity() { if (IsValid) { try { CRMMDAgreementVariableEntity cRMMDAgreementVariableEntity = BuildCRMMDAgreementVariableEntity(); Int64 result = -1; if (cRMMDAgreementVariableEntity.IsNew) { result = FCCCRMMDAgreementVariable.GetFacadeCreate().Add(cRMMDAgreementVariableEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMMDAgreementVariableEntity.FLD_NAME_AgreementVariableID, cRMMDAgreementVariableEntity.AgreementVariableID.ToString(), SQLMatchType.Equal); result = FCCCRMMDAgreementVariable.GetFacadeCreate().Update(cRMMDAgreementVariableEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _AgreementVariableID = 0; _CRMMDAgreementVariableEntity = new CRMMDAgreementVariableEntity(); PrepareInitialView(); BindCRMMDAgreementVariableList(); if (cRMMDAgreementVariableEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Agreement Variable Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Agreement Variable Information has been updated successfully.", false); } } else { if (cRMMDAgreementVariableEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Agreement Variable Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Agreement Variable Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvCRMMDAgreementVariable_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 AgreementVariableID; Int64.TryParse(e.CommandArgument.ToString(), out AgreementVariableID); if (AgreementVariableID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _AgreementVariableID = AgreementVariableID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMMDAgreementVariableEntity.FLD_NAME_AgreementVariableID, AgreementVariableID.ToString(), SQLMatchType.Equal); CRMMDAgreementVariableEntity cRMMDAgreementVariableEntity = new CRMMDAgreementVariableEntity(); result = FCCCRMMDAgreementVariable.GetFacadeCreate().Delete(cRMMDAgreementVariableEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _AgreementVariableID = 0; _CRMMDAgreementVariableEntity = new CRMMDAgreementVariableEntity(); PrepareInitialView(); BindCRMMDAgreementVariableList(); MiscUtil.ShowMessage(lblMessage, "C RMAgreement Variable has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete C RMAgreement Variable.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <CRMMDAgreementVariableEntity> GetData() { IList <CRMMDAgreementVariableEntity> cRMMDAgreementVariableEntityList = new List <CRMMDAgreementVariableEntity>(); try { cRMMDAgreementVariableEntityList = FCCCRMMDAgreementVariable.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (cRMMDAgreementVariableEntityList != null && cRMMDAgreementVariableEntityList.Count > 0) { totalRowCount = cRMMDAgreementVariableEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cRMMDAgreementVariableEntityList ?? new List <CRMMDAgreementVariableEntity>()); }
private void SaveCRMAgreementEntity() { if (IsValid) { try { CRMAgreementEntity cRMAgreementEntity = BuildCRMAgreementEntity(); Int64 result = -1; if (cRMAgreementEntity.IsNew) { result = FCCCRMAgreement.GetFacadeCreate().Add(cRMAgreementEntity, DatabaseOperationType.Add, TransactionRequired.No); String input = txtText.Content.ToString(); String newOutPut = String.Empty; IList <CRMMDAgreementVariableEntity> cRMAgreementVariableList = FCCCRMMDAgreementVariable.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); if (cRMAgreementVariableList != null && cRMAgreementVariableList.Count > 0) { foreach (CRMMDAgreementVariableEntity ent in cRMAgreementVariableList) { if (input.Contains(ent.Name)) // AGR body matching { CRMAgreementVariableMapEntity cRMAgrementVariableMapEnt = new CRMAgreementVariableMapEntity(); cRMAgrementVariableMapEnt.Name = ent.Name; cRMAgrementVariableMapEnt.Value = ent.Value; cRMAgreementVariableMapEntityList.Add(cRMAgrementVariableMapEnt); newOutPut = MiscUtil.ReplaceFullWords(input, ent.Name, ent.Value.ToString()); input = newOutPut; } } } if (newOutPut.IsNotNullOrEmpty()) { lblTextView.Text = Server.HtmlDecode(newOutPut); } else { lblTextView.Text = Server.HtmlDecode(input); } } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementEntity.FLD_NAME_AgreementID, cRMAgreementEntity.AgreementID.ToString(), SQLMatchType.Equal); result = FCCCRMAgreement.GetFacadeCreate().Update(cRMAgreementEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); String input = txtText.Content.ToString(); String newOutPut = String.Empty; String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementID, result.ToString(), SQLMatchType.Equal); IList <CRMAgreementVariableMapEntity> cRMAgreementVariableList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (cRMAgreementVariableList != null && cRMAgreementVariableList.Count > 0) { cRMAgreementVariableMapEntityList = new List <CRMAgreementVariableMapEntity>(); foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableList) { if (input.Contains(ent.Name)) { CRMAgreementVariableMapEntity cRMAgrementVariableMapEnt = new CRMAgreementVariableMapEntity(); cRMAgrementVariableMapEnt.Name = ent.Name; cRMAgrementVariableMapEnt.Value = ent.Value; //cRMAgreementVariableMapEntityList.Add(cRMAgrementVariableMapEnt); newOutPut = MiscUtil.ReplaceFullWords(input, ent.Name, ent.Value.ToString()); input = newOutPut; } } } if (newOutPut.IsNotNullOrEmpty()) { lblTextView.Text = Server.HtmlDecode(newOutPut); } else { lblTextView.Text = input; } } if (result > 0) { #region Agreement variable Map if (cRMAgreementEntity.IsNew) { if (cRMAgreementVariableMapEntityList != null && cRMAgreementVariableMapEntityList.Count > 0) { // Delete Variable Map Table //String fe_delete=SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementID,result.ToString(),SQLMatchType.Equal); //IList<CRMAgreementVariableMapEntity> deleteList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_delete, DatabaseOperationType.LoadWithFilterExpression); //if (deleteList != null && deleteList.Count > 0) //{ // foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableMapEntityList) // { // FCCCRMAgreementVariableMap.GetFacadeCreate().Delete(ent, fe_delete, DatabaseOperationType.Delete, TransactionRequired.No); // } //} foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableMapEntityList) { CRMAgreementVariableMapEntity cRMAgrementVariableMapEnt = new CRMAgreementVariableMapEntity(); cRMAgrementVariableMapEnt.Name = ent.Name; cRMAgrementVariableMapEnt.Value = ent.Value; cRMAgrementVariableMapEnt.IP = MiscUtil.GetLocalIP(); cRMAgrementVariableMapEnt.Remarks = "Auto Generated"; cRMAgrementVariableMapEnt.CreateDate = System.DateTime.Now; cRMAgrementVariableMapEnt.CreatedByEmployeeID = CurrentemployeeID; cRMAgrementVariableMapEnt.AgreementID = result; FCCCRMAgreementVariableMap.GetFacadeCreate().Add(cRMAgrementVariableMapEnt, DatabaseOperationType.Add, TransactionRequired.No); } } } #endregion if (cRMAgreementEntity.AgreementTypeID == MasterDataConstants.CRMMDAgreementType.SPECS) { hypAgreementSpec.NavigateUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMAgreementSpecs.aspx", String.Empty, UrlConstants.OVERVIEW_AGREEMENT_ID, result.ToString()).ToString(); hypAgreementSpec.Target = "_blank"; hypAgreementSpec.Visible = true; } hypAgreementVariablePopup.NavigateUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMAgreementVariableMap.aspx", String.Empty, UrlConstants.OVERVIEW_AGREEMENT_ID, result.ToString()).ToString(); hypAgreementVariablePopup.Target = "_blank"; hypAgreementVariablePopup.Visible = true; _AgreementID = result; //_CRMAgreementEntity = new CRMAgreementEntity(); PrepareEditView(); BindCRMAgreementList(); if (cRMAgreementEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Agreement Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Agreement Information has been updated successfully.", false); } } else { if (cRMAgreementEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Agreement Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Agreement Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }