private bool dbDelete(ref int totalRecordCount) { string remoteIP = this.HttpContext.Connection.RemoteIpAddress.ToString(); string localIP = this.HttpContext.Connection.LocalIpAddress.ToString(); string signatureId = Request.Form["SignatureId"]; List <dynamic> rows = new List <dynamic>(); GIGridInitModel giGridInitModel = new GIGridInitModel() { ColumnList = new List <GIGridColumn>() }; try { using (SqlConnection sqlConnection = new SqlConnection( GIxUtils.DecodeConnectionString( _configuration, ref _loginRequest, Request.Headers["X-WebGI-Authentication"], Request.Headers["X-WebGI-Version"]))) { sqlConnection.Open(); using (SqlCommand sqlCommand = sqlConnection.CreateCommand()) { sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "dbo.[usp_WebGI_DeleteSignature]"; //sqlCommand.Parameters.AddWithValue("@APIKey", apiKey); sqlCommand.Parameters.AddWithValue("@IP_Local", localIP); sqlCommand.Parameters.AddWithValue("@IP_Remote", remoteIP); sqlCommand.Parameters.AddWithValue("@Salt", _loginRequest.salt); sqlCommand.Parameters.AddWithValue("@Version", _loginRequest.version); sqlCommand.Parameters.AddWithValue("@SignatureId", signatureId); SqlParameter outputValue = sqlCommand.Parameters.Add("@totalCount", SqlDbType.Int); outputValue.Direction = ParameterDirection.Output; sqlCommand.ExecuteNonQuery(); } sqlConnection.Close(); sqlConnection.Dispose(); } } catch (Exception ex) { GIxUtils.Log(ex); throw new Exception(ex.Message); } return(true); }
//private IEnumerable<dynamic> dbGetProviderList(ref int totalRecordCount ) private dynamic dbGetClaimsList(ref int totalRecordCount) { bool initGrid = Request.Query["type"].ToString() == "initGrid" ? true : false; bool exportGrid = Request.Query["type"].ToString() == "exportGrid" ? true : false; string remoteIP = this.HttpContext.Connection.RemoteIpAddress.ToString(); string localIP = this.HttpContext.Connection.LocalIpAddress.ToString(); List <dynamic> rows = new List <dynamic>(); GIGridInitModel giGridInitModel = new GIGridInitModel() { ColumnList = new List <GIGridColumn>() }; try { using (SqlConnection sqlConnection = new SqlConnection( GIxUtils.DecodeConnectionString( _configuration, ref _loginRequest, Request.Headers["X-WebGI-Authentication"], Request.Headers["X-WebGI-Version"]))) { sqlConnection.Open(); using (SqlCommand sqlCommand = sqlConnection.CreateCommand()) { sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "dbo.[usp_WebGI_GetAutoPolicyList]"; sqlCommand.Parameters.AddWithValue("@IP_Local", localIP); sqlCommand.Parameters.AddWithValue("@IP_Remote", remoteIP); sqlCommand.Parameters.AddWithValue("@Salt", _loginRequest.salt); sqlCommand.Parameters.AddWithValue("@Version", _loginRequest.version); if (Request != null && Request.Query != null && Request.Query.Keys != null && Request.Query.Keys.Count > 0) { foreach (string key in Request.Query.Keys) { if (!key.StartsWith("_")) { string param = $"@{key}"; sqlCommand.Parameters.AddWithValue(param, Request.Query[key].ToString()); } } } ; SqlParameter outputValue = sqlCommand.Parameters.Add("@totalCount", SqlDbType.Int); outputValue.Direction = ParameterDirection.Output; SqlDataReader recordSet = sqlCommand.ExecuteReader(); using (recordSet) { object value; while (recordSet.Read()) { dynamic model = null; if (initGrid == true) { model = new GIGridColumn(); } else { model = new ContractListModel(); ///////////////// !!!!!!!! ////////// } var properties = model.GetType().GetProperties(); foreach (var el in properties) { string name = el.Name; value = recordSet[recordSet.GetOrdinal(name)]; if (value != System.DBNull.Value) { switch (el.PropertyType.Name) { case "Int32": el.SetValue(model, (int)value); break; case "String": el.SetValue(model, (string)value); break; case "Boolean": el.SetValue(model, (bool)value); break; case "Decimal": el.SetValue(model, (decimal)value); break; case "DateTime": el.SetValue(model, (DateTime)value); break; } } } if (initGrid == true) { giGridInitModel.ColumnList.Add(model); } else { rows.Add(model); } } if (initGrid == true && recordSet.NextResult() && recordSet.Read()) { if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value) { giGridInitModel.Title = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Toolbar")]) != System.DBNull.Value) { giGridInitModel.Toolbar = (string)value; } } recordSet.Close(); recordSet.Dispose(); if (outputValue.Value != null) { totalRecordCount = (int)outputValue.Value; } } } sqlConnection.Close(); sqlConnection.Dispose(); } } catch (Exception ex) { GIxUtils.Log(ex); throw new Exception(ex.Message); } if (initGrid == false) { return(rows); } return(giGridInitModel); }
private dynamic dbGetList(ref int totalRecordCount) { bool initGrid = Request.Query["type"].ToString() == "initGrid" ? true : false; bool exportGrid = Request.Query["type"].ToString() == "exportGrid" ? true : false; string remoteIP = this.HttpContext.Connection.RemoteIpAddress.ToString(); string localIP = this.HttpContext.Connection.LocalIpAddress.ToString(); string page = Request.Query["page"].ToString(); string start = Request.Query["start"].ToString(); string limit = Request.Query["limit"].ToString(); List <dynamic> rows = new List <dynamic>(); GIGridInitModel giGridInitModel = new GIGridInitModel() { ColumnList = new List <GIGridColumn>() }; try { using (SqlConnection sqlConnection = new SqlConnection( GIxUtils.DecodeConnectionString( _configuration, ref _loginRequest, Request.Headers["X-WebGI-Authentication"], Request.Headers["X-WebGI-Version"]))) { sqlConnection.Open(); using (SqlCommand sqlCommand = sqlConnection.CreateCommand()) { sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "dbo.[usp_WebGI_CallCenterGetDocList]"; //sqlCommand.Parameters.AddWithValue("@APIKey", apiKey); sqlCommand.Parameters.AddWithValue("@IP_Local", localIP); sqlCommand.Parameters.AddWithValue("@IP_Remote", remoteIP); sqlCommand.Parameters.AddWithValue("@InitGrid", initGrid); sqlCommand.Parameters.AddWithValue("@ExportGrid", exportGrid); sqlCommand.Parameters.AddWithValue("@Salt", _loginRequest.salt); sqlCommand.Parameters.AddWithValue("@Version", _loginRequest.version); sqlCommand.Parameters.AddWithValue("@page", page); sqlCommand.Parameters.AddWithValue("@start", start); sqlCommand.Parameters.AddWithValue("@limit", limit); sqlCommand.Parameters.AddWithValue("@sort", Request.Query["sort"].ToString()); //sqlCommand.Parameters.AddWithValue("@saxeobaId", Request.Query["saxeobaId"].ToString()); //sqlCommand.Parameters.AddWithValue("@docId", Request.Query["docId"].ToString()); //sqlCommand.Parameters.AddWithValue("@policyNo", Request.Query["policyNo"].ToString()); //sqlCommand.Parameters.AddWithValue("@pin", Request.Query["pin"].ToString()); //sqlCommand.Parameters.AddWithValue("@policyHolder", Request.Query["policyHolder"].ToString()); //sqlCommand.Parameters.AddWithValue("@policyHolderParent", Request.Query["policyHolderParent"].ToString()); //sqlCommand.Parameters.AddWithValue("@organizationName", Request.Query["organizationName"].ToString()); //sqlCommand.Parameters.AddWithValue("@contractNom", Request.Query["contractNom"].ToString()); //sqlCommand.Parameters.AddWithValue("@docCreateDateStart", Request.Query["docCreateDateStart"].ToString()); //sqlCommand.Parameters.AddWithValue("@docCreateDateStart", Request.Query["docCreateDateStart"].ToString()); //sqlCommand.Parameters.AddWithValue("@operatorId", Request.Query["operatorId"].ToString()); SqlParameter outputValue = sqlCommand.Parameters.Add("@totalCount", SqlDbType.Int); outputValue.Direction = ParameterDirection.Output; SqlDataReader recordSet = sqlCommand.ExecuteReader(); using (recordSet) { object value; while (recordSet.Read()) { dynamic model = null; GIGridColumn model_c = new GIGridColumn(); CallCenterDocListModel model_r = new CallCenterDocListModel(); if (initGrid == true) { model = model_c; } else { model = model_r; } var properties = model.GetType().GetProperties(); foreach (var el in properties) { string name = el.Name; value = recordSet[recordSet.GetOrdinal(name)]; if (value != System.DBNull.Value) { switch (el.PropertyType.Name) { case "Int32": el.SetValue(model, (int)value); break; case "String": el.SetValue(model, (string)value); break; case "Boolean": el.SetValue(model, (bool)value); break; } } } if (initGrid == true) { giGridInitModel.ColumnList.Add(model); } else { rows.Add(model); } } if (initGrid == true && recordSet.NextResult() && recordSet.Read()) { if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value) { giGridInitModel.Title = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Toolbar")]) != System.DBNull.Value) { giGridInitModel.Toolbar = (string)value; } } recordSet.Close(); recordSet.Dispose(); if (outputValue.Value != null) { totalRecordCount = (int)outputValue.Value; } } } sqlConnection.Close(); sqlConnection.Dispose(); } } catch (Exception ex) { GIxUtils.Log(ex); throw new Exception(ex.Message); } if (initGrid == false) { return(rows); } return(giGridInitModel); }
private dynamic dbList(ref int totalRecordCount) { bool initGrid = Request.Query["type"].ToString() == "initGrid" ? true : false; bool exportGrid = Request.Query["type"].ToString() == "exportGrid" ? true : false; bool isUtil = Request.Query["subtype"].ToString() == "isUtil" ? true : false; string remoteIP = this.HttpContext.Connection.RemoteIpAddress.ToString(); string localIP = this.HttpContext.Connection.LocalIpAddress.ToString(); string page = Request.Query["page"].ToString(); string start = Request.Query["start"].ToString(); string limit = Request.Query["limit"].ToString(); List <dynamic> rows = new List <dynamic>(); GIGridInitModel giGridInitModel = new GIGridInitModel() { ColumnList = new List <GIGridColumn>() }; try { using (SqlConnection sqlConnection = new SqlConnection( GIxUtils.DecodeConnectionString( _configuration, ref _loginRequest, Request.Headers["X-WebGI-Authentication"], Request.Headers["X-WebGI-Version"]))) { sqlConnection.Open(); using (SqlCommand sqlCommand = sqlConnection.CreateCommand()) { sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "dbo.[usp_WebGI_lookup_GetPositionList]"; //sqlCommand.Parameters.AddWithValue("@APIKey", apiKey); sqlCommand.Parameters.AddWithValue("@IP_Local", localIP); sqlCommand.Parameters.AddWithValue("@IP_Remote", remoteIP); sqlCommand.Parameters.AddWithValue("@InitGrid", initGrid); sqlCommand.Parameters.AddWithValue("@ExportGrid", exportGrid); sqlCommand.Parameters.AddWithValue("@Salt", _loginRequest.salt); sqlCommand.Parameters.AddWithValue("@Version", _loginRequest.version); sqlCommand.Parameters.AddWithValue("@page", page); sqlCommand.Parameters.AddWithValue("@start", start); sqlCommand.Parameters.AddWithValue("@limit", limit); sqlCommand.Parameters.AddWithValue("@utilityFilter", Request.Query["utilityFilter"].ToString()); // when typing in dropdown sqlCommand.Parameters.AddWithValue("@sort", Request.Query["sort"].ToString()); //sqlCommand.Parameters.AddWithValue("@userDescription", Request.Query["userDescription"].ToString()); //sqlCommand.Parameters.AddWithValue("@userCode", Request.Query["userCode"].ToString()); SqlParameter outputValue = sqlCommand.Parameters.Add("@totalCount", SqlDbType.Int); outputValue.Direction = ParameterDirection.Output; SqlDataReader recordSet = sqlCommand.ExecuteReader(); using (recordSet) { object value; while (recordSet.Read()) { if (initGrid == true) { GIGridColumn column = new GIGridColumn(); if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value) { column.Title = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("DataIndex")]) != System.DBNull.Value) { column.DataIndex = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("ValueType")]) != System.DBNull.Value) { column.ValueType = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Width")]) != System.DBNull.Value) { column.Width = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Flex")]) != System.DBNull.Value) { column.Flex = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Renderer")]) != System.DBNull.Value) { column.Renderer = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("IsFilter")]) != System.DBNull.Value) { column.IsFilter = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsNotColumn")]) != System.DBNull.Value) { column.IsNotColumn = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsHidden")]) != System.DBNull.Value) { column.IsHidden = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsMenuDisabled")]) != System.DBNull.Value) { column.IsMenuDisabled = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsGridSummaryRow")]) != System.DBNull.Value) { column.IsGridSummaryRow = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsLocked")]) != System.DBNull.Value) { column.IsLocked = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("SummaryRenderer")]) != System.DBNull.Value) { column.SummaryRenderer = (string)value; } giGridInitModel.ColumnList.Add(column); } else { GILookupModel model = new GILookupModel(); var properties = model.GetType().GetProperties(); foreach (var el in properties) { string name = el.Name; value = recordSet[recordSet.GetOrdinal(name)]; if (value != System.DBNull.Value) { switch (el.PropertyType.Name) { case "Int32": el.SetValue(model, (int)value); break; case "String": el.SetValue(model, (string)value); break; case "Boolean": el.SetValue(model, (bool)value); break; } } } rows.Add(model); } } if (initGrid == true && recordSet.NextResult() && recordSet.Read()) { if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value) { giGridInitModel.Title = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Toolbar")]) != System.DBNull.Value) { giGridInitModel.Toolbar = (string)value; } } recordSet.Close(); recordSet.Dispose(); if (outputValue.Value != null) { totalRecordCount = (int)outputValue.Value; } } } sqlConnection.Close(); sqlConnection.Dispose(); } } catch (Exception ex) { GIxUtils.Log(ex); throw new Exception(ex.Message); } if (initGrid == false) { return(rows); } return(giGridInitModel); }
//private IEnumerable<dynamic> dbGetAgentList(ref int totalRecordCount ) private dynamic dbGetAgentList(ref int totalRecordCount) { bool initGrid = Request.Query["type"].ToString() == "initGrid" ? true : false; bool exportGrid = Request.Query["type"].ToString() == "exportGrid" ? true : false; string remoteIP = this.HttpContext.Connection.RemoteIpAddress.ToString(); string localIP = this.HttpContext.Connection.LocalIpAddress.ToString(); string page = Request.Query["page"].ToString(); string start = Request.Query["start"].ToString(); string limit = Request.Query["limit"].ToString(); List <dynamic> rows = new List <dynamic>(); GIGridInitModel giGridInitModel = new GIGridInitModel() { ColumnList = new List <GIGridColumn>() }; try { using (SqlConnection sqlConnection = new SqlConnection( GIxUtils.DecodeConnectionString( _configuration, ref _loginRequest, Request.Headers["X-WebGI-Authentication"], Request.Headers["X-WebGI-Version"]))) { sqlConnection.Open(); using (SqlCommand sqlCommand = sqlConnection.CreateCommand()) { sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "dbo.[usp_WebGI_GetAgentBrokerList]"; //sqlCommand.Parameters.AddWithValue("@APIKey", apiKey); sqlCommand.Parameters.AddWithValue("@IP_Local", localIP); sqlCommand.Parameters.AddWithValue("@IP_Remote", remoteIP); sqlCommand.Parameters.AddWithValue("@InitGrid", initGrid); sqlCommand.Parameters.AddWithValue("@ExportGrid", exportGrid); sqlCommand.Parameters.AddWithValue("@Salt", _loginRequest.salt); sqlCommand.Parameters.AddWithValue("@Version", _loginRequest.version); sqlCommand.Parameters.AddWithValue("@page", page); sqlCommand.Parameters.AddWithValue("@start", start); sqlCommand.Parameters.AddWithValue("@limit", limit); sqlCommand.Parameters.AddWithValue("@sort", Request.Query["sort"].ToString()); sqlCommand.Parameters.AddWithValue("@code", Request.Query["ode"].ToString()); sqlCommand.Parameters.AddWithValue("@description", Request.Query["description"].ToString()); sqlCommand.Parameters.AddWithValue("@pin", Request.Query["pin"].ToString()); sqlCommand.Parameters.AddWithValue("@address", Request.Query["address"].ToString()); sqlCommand.Parameters.AddWithValue("@phone", Request.Query["phone"].ToString()); sqlCommand.Parameters.AddWithValue("@isBroker", Request.Query["isBroker"].ToString()); sqlCommand.Parameters.AddWithValue("@isIndMetsarme", Request.Query["isIndMetsarme"].ToString()); SqlParameter outputValue = sqlCommand.Parameters.Add("@totalCount", SqlDbType.Int); outputValue.Direction = ParameterDirection.Output; SqlDataReader recordSet = sqlCommand.ExecuteReader(); using (recordSet) { object value; while (recordSet.Read()) { if (initGrid == true) { #region helper properties GIGridColumn column = new GIGridColumn(); if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value) { column.Title = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("DataIndex")]) != System.DBNull.Value) { column.DataIndex = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("DisplayField")]) != System.DBNull.Value) { column.DisplayField = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("ValueField")]) != System.DBNull.Value) { column.ValueField = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("ValueType")]) != System.DBNull.Value) { column.ValueType = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Width")]) != System.DBNull.Value) { column.Width = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Flex")]) != System.DBNull.Value) { column.Flex = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Renderer")]) != System.DBNull.Value) { column.Renderer = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("IsFilter")]) != System.DBNull.Value) { column.IsFilter = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsNotColumn")]) != System.DBNull.Value) { column.IsNotColumn = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsHidden")]) != System.DBNull.Value) { column.IsHidden = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsMenuDisabled")]) != System.DBNull.Value) { column.IsMenuDisabled = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsGridSummaryRow")]) != System.DBNull.Value) { column.IsGridSummaryRow = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsLocked")]) != System.DBNull.Value) { column.IsLocked = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("SummaryRenderer")]) != System.DBNull.Value) { column.SummaryRenderer = (string)value; } giGridInitModel.ColumnList.Add(column); #endregion } else { AgentBrokerListModel model = new AgentBrokerListModel(); if ((value = recordSet[recordSet.GetOrdinal("RowNum")]) != System.DBNull.Value) { model.RowNum = (int)value; } if ((value = recordSet[recordSet.GetOrdinal("Id")]) != System.DBNull.Value) { model.Id = (int)value; } if ((value = recordSet[recordSet.GetOrdinal("Code")]) != System.DBNull.Value) { model.Code = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Description")]) != System.DBNull.Value) { model.Description = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Pin")]) != System.DBNull.Value) { model.Pin = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Address")]) != System.DBNull.Value) { model.Address = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Phone")]) != System.DBNull.Value) { model.Phone = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("IsBroker")]) != System.DBNull.Value) { model.IsBroker = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("IsIndMetsarme")]) != System.DBNull.Value) { model.IsIndMetsarme = (bool)value; } if ((value = recordSet[recordSet.GetOrdinal("EntityType")]) != System.DBNull.Value) { model.EntityType = (int)value; } if ((value = recordSet[recordSet.GetOrdinal("clrfg")]) != System.DBNull.Value) { model.clrfg = (int)value; } rows.Add(model); } } if (initGrid == true && recordSet.NextResult() && recordSet.Read()) { if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value) { giGridInitModel.Title = (string)value; } if ((value = recordSet[recordSet.GetOrdinal("Toolbar")]) != System.DBNull.Value) { giGridInitModel.Toolbar = (string)value; } } recordSet.Close(); recordSet.Dispose(); if (outputValue.Value != null) { totalRecordCount = (int)outputValue.Value; } } } sqlConnection.Close(); sqlConnection.Dispose(); } } catch (Exception ex) { GIxUtils.Log(ex); throw new Exception(ex.Message); } if (initGrid == false) { return(rows); } return(giGridInitModel); }