251 lines
8.8 KiB
C#
251 lines
8.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Big.Lito.Data.DataModel;
|
|
using Big.Lito.Data.Sql;
|
|
|
|
namespace Big.Lito.Data.DataAccess
|
|
{
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
class FToBIniGenSQL : ConnectionSQL, IFToBIniGenSQL
|
|
{
|
|
/// <summary>
|
|
/// Method to get all club members
|
|
/// </summary>
|
|
/// <returns>Data table</returns>
|
|
public DataRow GetFToBIniGenById(int Id)
|
|
{
|
|
DataTable dataTable = new DataTable();
|
|
DataRow dataRow;
|
|
string connectionString = this.ConnectionString;
|
|
|
|
using (SqlConnection sqlCon = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand comm = new SqlCommand())
|
|
{
|
|
string cmdString = Scripts.sqlGetProgressById;
|
|
|
|
comm.Connection = sqlCon;
|
|
comm.CommandText = cmdString;
|
|
comm.Parameters.AddWithValue("@Id", Id);
|
|
try
|
|
{
|
|
SqlDataAdapter sd = new SqlDataAdapter();
|
|
sd.SelectCommand = comm;
|
|
sd.Fill(dataTable);
|
|
|
|
//sqlCon.Open();
|
|
//comm.ExecuteNonQuery();
|
|
}
|
|
catch (SqlException e)
|
|
{
|
|
// do something with the exception
|
|
// don't hide it
|
|
}
|
|
|
|
// Get the datarow from the table
|
|
dataRow = dataTable.Rows.Count > 0 ? dataTable.Rows[0] : null;
|
|
}
|
|
}
|
|
return dataRow;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method to get all club members
|
|
/// </summary>
|
|
/// <returns>Data table</returns>
|
|
public DataRow GetFToBIniGenByName(string Name)
|
|
{
|
|
DataTable dataTable = new DataTable();
|
|
DataRow dataRow;
|
|
string connectionString = this.ConnectionString;
|
|
|
|
using (SqlConnection sqlCon = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand comm = new SqlCommand())
|
|
{
|
|
string cmdString = Scripts.sqlGetProgressByName;
|
|
|
|
comm.Connection = sqlCon;
|
|
comm.CommandText = cmdString;
|
|
comm.Parameters.AddWithValue("@ProgressName", Name);
|
|
try
|
|
{
|
|
SqlDataAdapter sd = new SqlDataAdapter();
|
|
sd.SelectCommand = comm;
|
|
sd.Fill(dataTable);
|
|
|
|
//sqlCon.Open();
|
|
//comm.ExecuteNonQuery();
|
|
}
|
|
catch (SqlException e)
|
|
{
|
|
// do something with the exception
|
|
// don't hide it
|
|
}
|
|
|
|
// Get the datarow from the table
|
|
dataRow = dataTable.Rows.Count > 0 ? dataTable.Rows[0] : null;
|
|
|
|
}
|
|
}
|
|
|
|
return dataRow;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Method to update club member details
|
|
/// </summary>
|
|
/// <param name="project">club member</param>
|
|
/// <returns></returns>
|
|
public bool UpdateFToBIniGen(FToBIniGenModel fToBIniGen)
|
|
{
|
|
string connectionString = this.ConnectionString;
|
|
|
|
using (SqlConnection sqlCon = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand comm = new SqlCommand())
|
|
{
|
|
string cmdString = Scripts.sqlUpdateFToBIniGen;
|
|
|
|
comm.Connection = sqlCon;
|
|
comm.CommandText = cmdString;
|
|
comm.Parameters.AddWithValue("@Id", fToBIniGen.Id);
|
|
comm.Parameters.AddWithValue("@Name", fToBIniGen.Name);
|
|
comm.Parameters.AddWithValue("@ObjName", fToBIniGen.ObjName);
|
|
comm.Parameters.AddWithValue("@CoX", fToBIniGen.CoX);
|
|
comm.Parameters.AddWithValue("@CoY", fToBIniGen.CoY);
|
|
comm.Parameters.AddWithValue("@FrmH", fToBIniGen.FrmH);
|
|
comm.Parameters.AddWithValue("@FrmW", fToBIniGen.FrmW);
|
|
comm.Parameters.AddWithValue("@HRes", fToBIniGen.HRes);
|
|
comm.Parameters.AddWithValue("@WRes", fToBIniGen.WRes);
|
|
comm.Parameters.AddWithValue("@NCols", fToBIniGen.NCols);
|
|
comm.Parameters.AddWithValue("@NRows", fToBIniGen.NRows);
|
|
comm.Parameters.AddWithValue("@FilePath", fToBIniGen.FilePath);
|
|
try
|
|
{
|
|
sqlCon.Open();
|
|
comm.ExecuteNonQuery();
|
|
}
|
|
catch (SqlException e)
|
|
{
|
|
// do something with the exception
|
|
// don't hide it
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method to update club member details
|
|
/// </summary>
|
|
/// <param name="project">club member</param>
|
|
/// <returns></returns>
|
|
public bool UpdateCancelFToBIniGen(FToBIniGenModel fToBIniGen)
|
|
{
|
|
string connectionString = this.ConnectionString;
|
|
|
|
using (SqlConnection sqlCon = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand comm = new SqlCommand())
|
|
{
|
|
string cmdString = Scripts.sqlUpdateCancelFToBIniGen;
|
|
|
|
comm.Connection = sqlCon;
|
|
comm.CommandText = cmdString;
|
|
comm.Parameters.AddWithValue("@Name", fToBIniGen.Name);
|
|
comm.Parameters.AddWithValue("@cancelIniGen", fToBIniGen.CancelIniGen);
|
|
try
|
|
{
|
|
sqlCon.Open();
|
|
comm.ExecuteNonQuery();
|
|
}
|
|
catch (SqlException e)
|
|
{
|
|
// do something with the exception
|
|
// don't hide it
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method to update club member details
|
|
/// </summary>
|
|
/// <param name="project">club member</param>
|
|
/// <returns></returns>
|
|
public bool UpdateRepeatsFToBIniGen(FToBIniGenModel fToBIniGen)
|
|
{
|
|
string connectionString = this.ConnectionString;
|
|
|
|
using (SqlConnection sqlCon = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand comm = new SqlCommand())
|
|
{
|
|
string cmdString = Scripts.sqlUpdateRepeatsFToBIniGen;
|
|
|
|
comm.Connection = sqlCon;
|
|
comm.CommandText = cmdString;
|
|
comm.Parameters.AddWithValue("@Name", fToBIniGen.Name);
|
|
comm.Parameters.AddWithValue("@repeats", fToBIniGen.Repeats);
|
|
try
|
|
{
|
|
sqlCon.Open();
|
|
comm.ExecuteNonQuery();
|
|
}
|
|
catch (SqlException e)
|
|
{
|
|
// do something with the exception
|
|
// don't hide it
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method to update club member details
|
|
/// </summary>
|
|
/// <param name="project">club member</param>
|
|
/// <returns></returns>
|
|
public bool UpdateRowStartEndFToBIniGen(FToBIniGenModel fToBIniGen)
|
|
{
|
|
string connectionString = this.ConnectionString;
|
|
|
|
using (SqlConnection sqlCon = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand comm = new SqlCommand())
|
|
{
|
|
string cmdString = Scripts.sqlUpdateRowStartEndFToBIniGen;
|
|
|
|
comm.Connection = sqlCon;
|
|
comm.CommandText = cmdString;
|
|
comm.Parameters.AddWithValue("@Name", fToBIniGen.Name);
|
|
comm.Parameters.AddWithValue("@row_start", fToBIniGen.RowStart);
|
|
comm.Parameters.AddWithValue("@row_end", fToBIniGen.RowEnd);
|
|
try
|
|
{
|
|
sqlCon.Open();
|
|
comm.ExecuteNonQuery();
|
|
}
|
|
catch (SqlException e)
|
|
{
|
|
// do something with the exception
|
|
// don't hide it
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
}
|