private GK_OA_InFileRegisterMainModel _DataBind(int Code) { GK_OA_InFileRegisterMainModel model = new GK_OA_InFileRegisterMainModel(); StringBuilder builder = new StringBuilder(); builder.Append("select * from GK_OA_InFileRegisterMain "); builder.Append(" where Code=@Code"); this._DataProcess.CommandText = builder.ToString(); this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, Code); SqlDataReader sqlDataReader = null; try { try { sqlDataReader = this._DataProcess.GetSqlDataReader(); while (sqlDataReader.Read()) { this.Initialize(sqlDataReader, model); } } catch (SqlException exception) { throw exception; } } finally { if (sqlDataReader != null) { sqlDataReader.Close(); } } return(model); }
private int _Update(GK_OA_InFileRegisterMainModel mObj) { StringBuilder builder = new StringBuilder(); builder.Append("update GK_OA_InFileRegisterMain set "); if (mObj.SystemCode != null) { builder.Append("SystemCode=@SystemCode,"); this._DataProcess.ProcessParametersAdd("@SystemCode", SqlDbType.VarChar, 50, mObj.SystemCode); } if (mObj.FileCode != null) { builder.Append("FileCode=@FileCode,"); this._DataProcess.ProcessParametersAdd("@FileCode", SqlDbType.VarChar, 50, mObj.FileCode); } if (mObj.InFileDate != DateTime.MinValue) { builder.Append("InFileDate=@InFileDate,"); this._DataProcess.ProcessParametersAdd("@InFileDate", SqlDbType.DateTime, 8, mObj.InFileDate); } if (mObj.Field1 != null) { builder.Append("Field1=@Field1,"); this._DataProcess.ProcessParametersAdd("@Field1", SqlDbType.VarChar, 50, mObj.Field1); } builder.Remove(builder.Length - 1, 1); builder.Append(" where Code=@Code"); this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, mObj.Code); this._DataProcess.CommandText = builder.ToString(); return(this._DataProcess.RunSql()); }
public int Update(GK_OA_InFileRegisterMainModel ObjModel) { int num = 0; using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { try { num = new GK_OA_InFileRegisterMainBLL().Update(ObjModel, transaction); transaction.Commit(); } catch (SqlException exception) { transaction.Rollback(); connection.Close(); throw exception; } return(num); } finally { connection.Close(); } } return(num); }
private List <GK_OA_InFileRegisterMainModel> _Select(GK_OA_InFileRegisterMainQueryModel qmObj) { List <GK_OA_InFileRegisterMainModel> list = new List <GK_OA_InFileRegisterMainModel>(); StringBuilder builder = new StringBuilder(); builder.Append("select * from GK_OA_InFileRegisterMain "); builder.Append(qmObj.QueryConditionStr); if (qmObj.SortColumns.Length == 0) { builder.Append(" ORDER BY Code desc"); } else { builder.Append(" ORDER BY " + qmObj.SortColumns); } this._DataProcess.CommandText = builder.ToString(); this._DataProcess.SqlParameters = qmObj.Parameters; SqlDataReader sqlDataReader = null; int num = 0; try { try { sqlDataReader = this._DataProcess.GetSqlDataReader(); while (sqlDataReader.Read()) { if ((num >= qmObj.StartRecord) && ((list.Count < qmObj.MaxRecords) || (qmObj.MaxRecords == -1))) { GK_OA_InFileRegisterMainModel model = new GK_OA_InFileRegisterMainModel(); this.Initialize(sqlDataReader, model); list.Add(model); } num++; } } catch (SqlException exception) { throw exception; } } finally { if (sqlDataReader != null) { sqlDataReader.Close(); } } return(list); }
public GK_OA_InFileRegisterMainModel GetGK_OA_InFileRegisterMain(int Code) { GK_OA_InFileRegisterMainModel model = new GK_OA_InFileRegisterMainModel(); using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { try { connection.Open(); model = new GK_OA_InFileRegisterMainBLL().GetModel(Code, connection); connection.Close(); } catch (SqlException exception) { throw exception; } } return(model); }
private int _Insert(GK_OA_InFileRegisterMainModel mObj) { StringBuilder builder = new StringBuilder(); builder.Append("insert into GK_OA_InFileRegisterMain("); builder.Append("SystemCode,FileCode,InFileDate,Field1)"); builder.Append(" values ("); builder.Append("@SystemCode,@FileCode,@InFileDate,@Field1) "); builder.Append("SELECT @Code = SCOPE_IDENTITY()"); this._DataProcess.CommandText = builder.ToString(); this._DataProcess.ProcessParametersAdd("@SystemCode", SqlDbType.VarChar, 50, mObj.SystemCode); this._DataProcess.ProcessParametersAdd("@FileCode", SqlDbType.VarChar, 50, mObj.FileCode); this._DataProcess.ProcessParametersAdd("@InFileDate", SqlDbType.DateTime, 8, mObj.InFileDate); this._DataProcess.ProcessParametersAdd("@Field1", SqlDbType.VarChar, 50, mObj.Field1); SqlParameter parameter = this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, null); parameter.Direction = ParameterDirection.Output; this._DataProcess.RunSql(); mObj.Code = (int)parameter.Value; return(mObj.Code); }
private void Initialize(SqlDataReader reader, GK_OA_InFileRegisterMainModel obj) { if (reader.GetValue(0) != DBNull.Value) { obj.Code = reader.GetInt32(0); } if (reader.GetValue(1) != DBNull.Value) { obj.SystemCode = reader.GetString(1); } if (reader.GetValue(2) != DBNull.Value) { obj.FileCode = reader.GetString(2); } if (reader.GetValue(3) != DBNull.Value) { obj.InFileDate = reader.GetDateTime(3); } if (reader.GetValue(4) != DBNull.Value) { obj.Field1 = reader.GetString(4); } }
public int Update(GK_OA_InFileRegisterMainModel mObj) { return(this._Update(mObj)); }
public int Insert(GK_OA_InFileRegisterMainModel mObj) { return(this._Insert(mObj)); }
public int Delete(GK_OA_InFileRegisterMainModel mObj) { return(this._Delete(mObj.Code)); }
public int Update(GK_OA_InFileRegisterMainModel ObjModel, SqlTransaction Transaction) { GK_OA_InFileRegisterMainDAL ndal = new GK_OA_InFileRegisterMainDAL(Transaction); return(ndal.Update(ObjModel)); }