public DataTable GetSpecialColumnsWithBO(string[] columnList, BaseBO baseBO) { try { if (columnList.IsNull()) { throw new Exception("Column List can not be null."); } if (columnList.Length == 0) { throw new Exception("Column List Length can not be Zero."); } queryBuilder = CreateQueryBuilder(QueryTypes.SelectWhereChangeColumns, baseBO); string tmpQ = queryBuilder.QueryString; int _index = tmpQ.FirstIndexOf('*'); string cols = string.Empty; foreach (var column in columnList) { cols = string.Format("{0}, {1}", cols, column); } cols = cols.TrimStart(',').TrimStart(); string query = string.Format("{0} {1} {2}", tmpQ.Substring(0, _index), cols, tmpQ.Substring(_index + 1, tmpQ.Length - _index - 1)); return(GetResultSetOfQuery(query, queryBuilder.Properties).Tables[0]); } catch (Exception) { throw; } finally { queryBuilder = null; } }
public new void SetFilterKey(BaseBO bo) { if (typeof(IDataControlMenu).IsInstanceOfType(bo)) { //This Is Sample.For more than 2 filter, must checking if property have had value Last_by = !string.IsNullOrEmpty(Last_by) ? Last_by : ((BaseBO)bo).Userid; } }
/// <summary> /// Create a QueryBuilder with given object and /// querytype and connetiontypes. /// </summary> /// <param name="ConnType">Connetion Types of Query Builder.</param> /// <param name="queryType">Query Types of Query Builder.</param> /// <param name="queryObject">An object inherits IBaseBO interface.</param> public QueryBuilder(ConnectionTypes ConnType, QueryTypes queryType, BaseBO queryObject) { _baseBO = queryObject; _queryType = queryType; _ConnType = ConnType; _queryString = GetQueryString(); _property = GetProperties(); }
private void preencheComboBase() { cmbBase.Items.Clear(); BaseBO baseBO = new BaseBO(); List <DatabaseTO> databases = baseBO.GetDatabases(_Conexao); foreach (var database in databases) { cmbBase.Items.Add(database.Nome); } cmbBase.SelectedIndex = 0; }
private void txtSenha_Leave(object sender, EventArgs e) { _Conexao = getConnectionString(); BaseBO baseBO = new BaseBO(); if (baseBO.IsConectado(_Conexao)) { preencheComboBase(); } else { chbBaseManual.Checked = true; } }
/// <summary> /// Gets exceution result of Delete Operation. /// </summary> /// <param name="baseBO">BaseBO object.</param> /// <returns>returns Int32</returns> public virtual Int32 Delete(BaseBO baseBO) { try { queryBuilder = null; queryBuilder = CreateQueryBuilder(QueryTypes.Delete, baseBO); return(ExecuteQuery(queryBuilder.QueryString, queryBuilder.Properties)); } catch (Exception) { throw; } }
/// <summary> /// Gets Columns which baseBo object changelist contains. /// Example: Column Change List Of BaseBO : Col1, Col2, Col3. /// Query = Select * From TableOfBaseBO Where Col1=Col1Value And Col2=Col2Value And Col3=Col3Value; /// </summary> /// <param name="baseBO">BaseBO object.</param> /// <returns>Returns a System.Data.DataTable</returns> public DataTable GetWhereChangeColumnList(BaseBO baseBO) { try { queryBuilder = CreateQueryBuilder(QueryTypes.SelectWhereChangeColumns, baseBO); return(GetResultSetOfQuery(queryBuilder.QueryString, queryBuilder.Properties).Tables[0]); } catch (Exception) { throw; } finally { queryBuilder = null; } }
/* ------------------------------------------- */ #region [ Get Table method ] /// <summary> /// Gets All Table Records of BaseBO object. /// </summary> /// <param name="baseBO">BaseBO object.</param> /// <returns>Returns a System.Data.DataTable</returns> public DataTable GetTable(BaseBO baseBO) { try { queryBuilder = CreateQueryBuilder(QueryTypes.Select, baseBO); return(GetResultSetOfQuery(queryBuilder.QueryString).Tables[0]); } catch (Exception) { throw; } finally { queryBuilder = null; } }
private void btnTestarCon_Click(object sender, EventArgs e) { cmbBase.Items.Clear(); _Conexao = getConnectionString(); BaseBO baseBO = new BaseBO(); if (baseBO.IsConectado(_Conexao)) { preencheComboBase(); MessageBox.Show("Banco de dados conectado!", "Teste de Conexão", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Banco de dados não conectado!", "Teste de Conexão", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Gets exceution result of Insert Operation. /// </summary> /// <param name="baseBO">BaseBO object.</param> /// <returns>returns Int32</returns> public virtual Int32 Insert(BaseBO baseBO) { try { queryBuilder = CreateQueryBuilder(QueryTypes.Insert, baseBO); return(ExecuteQuery(queryBuilder.QueryString, queryBuilder.Properties)); } catch (Exception) { throw; } finally { queryBuilder = null; } }
public DataTable GetSpecialColumnsWithBO(string[] columnList, BaseBO bo) { DataTable dt = null; try { if (columnList == null) { throw new Exception("Column List can not be null."); } if (columnList.Length == 0) { throw new Exception("Column List Length can not be Zero."); } IQuery q = QueryBuilder.Build(bo, this._Conn.ConnectionType, QueryTypes.SelectWhereChangeColumns); DataSet ds = null; string query = string.Empty; int _index = q.Text.FirstIndexOf('*'); string cols = string.Empty; foreach (var column in columnList) { cols = string.Format("{0}, {1}", cols, column); } cols = cols.TrimStart(',').TrimStart(); query = string.Format("{0} {1} {2}", q.Text.Substring(0, _index), cols, q.Text.Substring(_index + 1, q.Text.Length - _index - 1)); ds = this.GetResultSet(query, CommandType.Text, q.Parameters); dt = ds.Tables[0]; } catch (Exception e) { throw; } return(dt); }
/// <summary> /// Inserts and Gets Id of BaseBO object. /// </summary> /// <param name="baseBO">BaseBO object.</param> /// <returns>returns Int32</returns> public virtual Int32 InsertAndGetId(BaseBO baseBO) { try { queryBuilder = CreateQueryBuilder(QueryTypes.InsertAndGetId, baseBO); Object obj = ExecuteScalarAsQuery(queryBuilder.QueryString, queryBuilder.Properties); return(obj.ToInt()); } catch (Exception) { throw; } finally { queryBuilder = null; } }
public override int InsertAndGetId(BaseBO baseBO) { try { int insertResult = base.Insert(baseBO); if (insertResult == 1) { QueryBuilder qB = CreateQueryBuilder(QueryTypes.Identity, baseBO); insertResult = ExecuteScalarAsQuery(qB.QueryString).ToInt(); } else { insertResult = 0; } return(insertResult); } catch (Exception) { throw; } }
/// <summary> /// Gets One Record of BaseBO object if any object has BaseBO Id. /// </summary> /// <param name="baseBO">BaseBO object.</param> /// <returns>Returns a System.Data.DataTable</returns> public DataTable GetById(BaseBO baseBO) { try { queryBuilder = CreateQueryBuilder(QueryTypes.SelectWhereId, baseBO); DataTable dT = GetResultSetOfQuery( queryBuilder.QueryString, queryBuilder.Properties).Tables[0]; return(dT); } catch (Exception) { throw; } finally { queryBuilder = null; } }
/// <summary> /// Delete a specific Time Entry /// </summary> /// <param name="dataAccessToken"></param> /// <param name="timeEntryId"></param> /// <returns>BaseBO</returns> public BaseBO DeleteTimeEntry(string dataAccessToken, string apiVersion, string timeEntryId) { BaseBO output = new BaseBO(); try { // Calls DeleteTimeEntry of Integration layer to delete time entry for specific timeEntryId TimeEntryService integrationService = new TimeEntryService(); integrationService.DeleteTimeEntry(Constants.CONSUMER_SECRET_TOKEN, UtilityService.DecryptedText(dataAccessToken), apiVersion, timeEntryId); } catch (DovicoException e) { logger.Log(LogLevel.Error, e); output.ErrorMessage = e.Message; } catch (Exception e) { logger.Log(LogLevel.Error, e); output.ErrorMessage = "Time Entry cannot be deleted."; } return(output); }
/// <summary> /// Create a QueryBuilder with given object and /// SqlServer ConnetionTypes and Select QueryTypes. /// </summary> /// <param name="queryObject">An object inherits BaseBO object.</param> public QueryBuilder(BaseBO queryObject) : this(ConnectionTypes.SqlServer, QueryTypes.Select, queryObject) { }
public override void StateChanged(BaseBO sender, StateChangedEventArgs args) { }
/// <summary> /// Create a QueryBuilder with given object and /// querytype and SqlServer ConnetionTypes. /// </summary> /// <param name="queryType">Query Types of Query Builder.</param> /// <param name="queryObject">An object inherits BaseBO object.</param> public QueryBuilder(QueryTypes queryType, BaseBO queryObject) : this(ConnectionTypes.SqlServer, queryType, queryObject) { }
/* ------------------------------------------------- */ #region [ CreateQueryBuilder method. ] /// <summary> /// Create A QueryBuilder object with ConnectionType Of Connection and given querytype and AbstractBaseBo object. /// </summary> /// <param name="queryType">QueryType Of QueryBuilder</param> /// <param name="tableObject">Table class object.</param> /// <returns>Returns A QueryBuilder object with ConnectionType Of Connection and given querytype and AbstractBaseBo object.</returns> public QueryBuilder CreateQueryBuilder(QueryTypes queryType, BaseBO tableObject) { QueryBuilder quBi = new QueryBuilder(_driverType, queryType, tableObject); return(quBi); }
public BaseController(BaseBO baseBO) { this.baseBO = baseBO; }