public int UpdateMaterialInDtlList(List <MaterialInDtlModel> ObjModelDtls, int MaterialInCode) { int num = 0; using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { num = new MaterialInBLL().UpdateMaterialInDtlList(transaction, ObjModelDtls, MaterialInCode); transaction.Commit(); return(num); } catch (SqlException exception) { transaction.Rollback(); connection.Close(); throw exception; } finally { connection.Close(); } } return(num); }
public int Update(MaterialInModel ObjModel) { int num = 0; using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString())) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { num = new MaterialInBLL().Update(ObjModel, transaction); transaction.Commit(); return(num); } catch (SqlException exception) { transaction.Rollback(); connection.Close(); throw exception; } finally { connection.Close(); } } return(num); }
public List <MaterialInModel> GetMaterialInList(MaterialInQueryModel QueryModel) { List <MaterialInModel> models = new List <MaterialInModel>(); SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()); try { if (QueryModel == null) { QueryModel = new MaterialInQueryModel(); } models = new MaterialInBLL().GetModels(QueryModel, connection); connection.Close(); } catch (SqlException exception) { throw exception; } finally { if (connection != null) { connection.Dispose(); } } return(models); }
public List <MaterialInModel> GetMaterialInList(string SortColumns, int StartRecord, int MaxRecords, string AccessRange, string MaterialInCodeEqual, string MaterialInIDEqual, string ProjectCodeEqual, string GroupCodeEqual, string InDateRange1, string InDateRange2, string InPersonEqual, string StatusEqual, string InputPersonEqual, string InputDateRange1, string InputDateRange2, string CheckPersonEqual, string CheckDateRange1, string CheckDateRange2, string ContractCodeEqual, string RemarkEqual) { List <MaterialInModel> models = new List <MaterialInModel>(); MaterialInQueryModel objQueryModel = new MaterialInQueryModel(); objQueryModel.StartRecord = StartRecord; objQueryModel.MaxRecords = MaxRecords; objQueryModel.SortColumns = SortColumns; objQueryModel.AccessRange = AccessRange; objQueryModel.MaterialInCodeEqual = MaterialInCodeEqual; objQueryModel.MaterialInIDEqual = MaterialInIDEqual; objQueryModel.ProjectCodeEqual = ProjectCodeEqual; objQueryModel.GroupCodeEqual = GroupCodeEqual; objQueryModel.InDateRange1 = InDateRange1; objQueryModel.InDateRange2 = InDateRange2; objQueryModel.InPersonEqual = InPersonEqual; objQueryModel.StatusEqual = StatusEqual; objQueryModel.InputPersonEqual = InputPersonEqual; objQueryModel.InputDateRange1 = InputDateRange1; objQueryModel.InputDateRange2 = InputDateRange2; objQueryModel.CheckPersonEqual = CheckPersonEqual; objQueryModel.CheckDateRange1 = CheckDateRange1; objQueryModel.CheckDateRange2 = CheckDateRange2; objQueryModel.ContractCodeEqual = ContractCodeEqual; objQueryModel.RemarkEqual = RemarkEqual; SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()); try { models = new MaterialInBLL().GetModels(objQueryModel, connection); connection.Close(); } catch (SqlException exception) { throw exception; } finally { if (connection != null) { connection.Dispose(); } } return(models); }
public MaterialInModel GetMaterialIn(int Code) { MaterialInModel model = new MaterialInModel(); SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()); try { model = new MaterialInBLL().GetModel(Code, connection); connection.Close(); } catch (SqlException exception) { throw exception; } finally { if (connection != null) { connection.Dispose(); } } return(model); }
public List <MaterialInModel> GetMaterialInListOne(int Code) { List <MaterialInModel> list = new List <MaterialInModel>(); SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()); try { MaterialInBLL nbll = new MaterialInBLL(); list.Add(nbll.GetModel(Code, connection)); connection.Close(); } catch (SqlException exception) { throw exception; } finally { if (connection != null) { connection.Dispose(); } } return(list); }