public int Update(OAPersonTrainModel ObjModel) { int num = 0; using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { try { num = new OAPersonTrainBLL().Update(ObjModel, transaction); transaction.Commit(); } catch (SqlException exception) { transaction.Rollback(); connection.Close(); throw exception; } return(num); } finally { connection.Close(); } } return(num); }
public OAPersonTrainModel GetOAPersonTrain(int Code) { OAPersonTrainModel model = new OAPersonTrainModel(); using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { try { connection.Open(); model = new OAPersonTrainBLL().GetModel(Code, connection); connection.Close(); } catch (SqlException exception) { throw exception; } } return(model); }
public List <OAPersonTrainModel> GetOAPersonTrainListOne(int Code) { List <OAPersonTrainModel> list = new List <OAPersonTrainModel>(); using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { try { connection.Open(); OAPersonTrainBLL nbll = new OAPersonTrainBLL(); list.Add(nbll.GetModel(Code, connection)); connection.Close(); } catch (SqlException exception) { throw exception; } } return(list); }
public List <OAPersonTrainModel> GetOAPersonTrainList(OAPersonTrainQueryModel QueryModel) { List <OAPersonTrainModel> models = new List <OAPersonTrainModel>(); using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { try { connection.Open(); if (QueryModel == null) { QueryModel = new OAPersonTrainQueryModel(); } models = new OAPersonTrainBLL().GetModels(QueryModel, connection); connection.Close(); } catch (SqlException exception) { throw exception; } } return(models); }
public List <OAPersonTrainModel> GetOAPersonTrainList(string SortColumns, int StartRecord, int MaxRecords, string personidEqual) { List <OAPersonTrainModel> models = new List <OAPersonTrainModel>(); OAPersonTrainQueryModel objQueryModel = new OAPersonTrainQueryModel(); objQueryModel.StartRecord = StartRecord; objQueryModel.MaxRecords = MaxRecords; objQueryModel.SortColumns = SortColumns; objQueryModel.personidEqual = personidEqual; using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { try { connection.Open(); models = new OAPersonTrainBLL().GetModels(objQueryModel, connection); connection.Close(); } catch (SqlException exception) { throw exception; } } return(models); }