public virtual bool AddSupplierContractTemplate(SupplierContractTemplateInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT TOP 0 * FROM Supplier_Contract_Template"; DtAdd = DBHelper.Query(SqlAdd); DrAdd = DtAdd.NewRow(); DrAdd["Contract_Template_ID"] = entity.Contract_Template_ID; DrAdd["Contract_Template_Name"] = entity.Contract_Template_Name; DrAdd["Contract_Template_SupplierID"] = entity.Contract_Template_SupplierID; DrAdd["Contract_Template_Content"] = entity.Contract_Template_Content; DrAdd["Contract_Template_Addtime"] = entity.Contract_Template_Addtime; DrAdd["Contract_Template_Site"] = entity.Contract_Template_Site; DtAdd.Rows.Add(DrAdd); try { DBHelper.SaveChanges(SqlAdd, DtAdd); return(true); } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } }
public virtual IList <SupplierContractTemplateInfo> GetSupplierContractTemplates(QueryInfo Query) { int PageSize; int CurrentPage; IList <SupplierContractTemplateInfo> entitys = null; SupplierContractTemplateInfo entity = null; string SqlList, SqlField, SqlOrder, SqlParam, SqlTable; SqlDataReader RdrList = null; try { CurrentPage = Query.CurrentPage; PageSize = Query.PageSize; SqlTable = "Supplier_Contract_Template"; SqlField = "*"; SqlParam = DBHelper.GetSqlParam(Query.ParamInfos); SqlOrder = DBHelper.GetSqlOrder(Query.OrderInfos); SqlList = DBHelper.GetSqlPage(SqlTable, SqlField, SqlParam, SqlOrder, CurrentPage, PageSize); RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.HasRows) { entitys = new List <SupplierContractTemplateInfo>(); while (RdrList.Read()) { entity = new SupplierContractTemplateInfo(); entity.Contract_Template_ID = Tools.NullInt(RdrList["Contract_Template_ID"]); entity.Contract_Template_Name = Tools.NullStr(RdrList["Contract_Template_Name"]); entity.Contract_Template_SupplierID = Tools.NullInt(RdrList["Contract_Template_SupplierID"]); entity.Contract_Template_Content = Tools.NullStr(RdrList["Contract_Template_Content"]); entity.Contract_Template_Addtime = Tools.NullDate(RdrList["Contract_Template_Addtime"]); entity.Contract_Template_Site = Tools.NullStr(RdrList["Contract_Template_Site"]); entitys.Add(entity); entity = null; } } return(entitys); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public virtual bool EditSupplierContractTemplate(SupplierContractTemplateInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT * FROM Supplier_Contract_Template WHERE Contract_Template_ID = " + entity.Contract_Template_ID; DtAdd = DBHelper.Query(SqlAdd); try { if (DtAdd.Rows.Count > 0) { DrAdd = DtAdd.Rows[0]; DrAdd["Contract_Template_ID"] = entity.Contract_Template_ID; DrAdd["Contract_Template_Name"] = entity.Contract_Template_Name; DrAdd["Contract_Template_SupplierID"] = entity.Contract_Template_SupplierID; DrAdd["Contract_Template_Content"] = entity.Contract_Template_Content; DrAdd["Contract_Template_Addtime"] = entity.Contract_Template_Addtime; DrAdd["Contract_Template_Site"] = entity.Contract_Template_Site; DBHelper.SaveChanges(SqlAdd, DtAdd); } else { return(false); } } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } return(true); }
public virtual SupplierContractTemplateInfo GetSupplierContractTemplateByID(int ID) { SupplierContractTemplateInfo entity = null; SqlDataReader RdrList = null; try { string SqlList; SqlList = "SELECT * FROM Supplier_Contract_Template WHERE Contract_Template_ID = " + ID; RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.Read()) { entity = new SupplierContractTemplateInfo(); entity.Contract_Template_ID = Tools.NullInt(RdrList["Contract_Template_ID"]); entity.Contract_Template_Name = Tools.NullStr(RdrList["Contract_Template_Name"]); entity.Contract_Template_SupplierID = Tools.NullInt(RdrList["Contract_Template_SupplierID"]); entity.Contract_Template_Content = Tools.NullStr(RdrList["Contract_Template_Content"]); entity.Contract_Template_Addtime = Tools.NullDate(RdrList["Contract_Template_Addtime"]); entity.Contract_Template_Site = Tools.NullStr(RdrList["Contract_Template_Site"]); } return(entity); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public virtual bool EditSupplierContractTemplate(SupplierContractTemplateInfo entity) { return(MyDAL.EditSupplierContractTemplate(entity)); }