using System; using System.Data; using System.Text; using System.Data.SqlClient; namespace Mtxfw.DAL { /// /// 数据访问类:business_info /// public partial class business_info : Mtxfw.Utility.Myabstract { public business_info() : base("business_info") { } /// /// 增加一条数据 /// public int Add(Mtxfw.Model.business_info model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into business_info("); strSql.Append("CompanyId,CompanyName,frname,fridcard,email,Industry,BusinessRange,Province,City,County,IFFill,Agentrading,Companyaddress,xcoo,ycoo,InternetSite,ContactPhone,ContactPeople,Busroutes,Introduction,Introduction2,Introduction3,picture,ApplyTime,ApplyState,ClsID,ClsnName,ClsID2,ClsnName2,Discount,Businesslicense,TaxRegistration,UserId,utype,gtype)"); strSql.Append(" values ("); strSql.Append("@CompanyId,@CompanyName,@frname,@fridcard,@email,@Industry,@BusinessRange,@Province,@City,@County,@IFFill,@Agentrading,@Companyaddress,@xcoo,@ycoo,@InternetSite,@ContactPhone,@ContactPeople,@Busroutes,@Introduction,@Introduction2,@Introduction3,@picture,@ApplyTime,@ApplyState,@ClsID,@ClsnName,@ClsID2,@ClsnName2,@Discount,@Businesslicense,@TaxRegistration,@UserId,@utype,@gtype)"); strSql.Append(";select SCOPE_IDENTITY()"); SqlParameter[] parameters = { new SqlParameter("@CompanyId", SqlDbType.VarChar,50), new SqlParameter("@CompanyName", SqlDbType.VarChar,150), new SqlParameter("@frname", SqlDbType.VarChar,20), new SqlParameter("@fridcard", SqlDbType.VarChar,20), new SqlParameter("@email", SqlDbType.VarChar,100), new SqlParameter("@Industry", SqlDbType.VarChar,50), new SqlParameter("@BusinessRange", SqlDbType.VarChar,50), new SqlParameter("@Province", SqlDbType.VarChar,50), new SqlParameter("@City", SqlDbType.VarChar,50), new SqlParameter("@County", SqlDbType.VarChar,50), new SqlParameter("@IFFill", SqlDbType.Int), new SqlParameter("@Agentrading", SqlDbType.VarChar,100), new SqlParameter("@Companyaddress", SqlDbType.VarChar,250), new SqlParameter("@xcoo", SqlDbType.VarChar,50), new SqlParameter("@ycoo", SqlDbType.VarChar,50), new SqlParameter("@InternetSite", SqlDbType.VarChar,50), new SqlParameter("@ContactPhone", SqlDbType.VarChar,50), new SqlParameter("@ContactPeople", SqlDbType.VarChar,50), new SqlParameter("@Busroutes", SqlDbType.VarChar,250), new SqlParameter("@Introduction", SqlDbType.Text), new SqlParameter("@Introduction2", SqlDbType.Text), new SqlParameter("@Introduction3", SqlDbType.Text), new SqlParameter("@picture", SqlDbType.VarChar,200), new SqlParameter("@ApplyTime", SqlDbType.DateTime), new SqlParameter("@ApplyState", SqlDbType.VarChar,50), new SqlParameter("@ClsID", SqlDbType.Int,4), new SqlParameter("@ClsnName", SqlDbType.VarChar,20), new SqlParameter("@ClsID2", SqlDbType.Int,4), new SqlParameter("@ClsnName2", SqlDbType.VarChar,20), new SqlParameter("@Discount", SqlDbType.VarChar,200), new SqlParameter("@Businesslicense", SqlDbType.VarChar,200), new SqlParameter("@TaxRegistration", SqlDbType.VarChar,200), new SqlParameter("@UserId", SqlDbType.Int), new SqlParameter("@utype", SqlDbType.VarChar,20), new SqlParameter("@gtype", SqlDbType.Int)}; parameters[0].Value = model.CompanyId; parameters[1].Value = model.CompanyName; parameters[2].Value = model.frname; parameters[3].Value = model.fridcard; parameters[4].Value = model.email; parameters[5].Value = model.Industry; parameters[6].Value = model.BusinessRange; parameters[7].Value = model.Province; parameters[8].Value = model.City; parameters[9].Value = model.County; parameters[10].Value = model.IFFill; parameters[11].Value = model.Agentrading; parameters[12].Value = model.Companyaddress; parameters[13].Value = model.xcoo; parameters[14].Value = model.ycoo; parameters[15].Value = model.InternetSite; parameters[16].Value = model.ContactPhone; parameters[17].Value = model.ContactPeople; parameters[18].Value = model.Busroutes; parameters[19].Value = model.Introduction; parameters[20].Value = model.Introduction2; parameters[21].Value = model.Introduction3; parameters[22].Value = model.picture; parameters[23].Value = model.ApplyTime; parameters[24].Value = model.ApplyState; parameters[25].Value = model.ClsID; parameters[26].Value = model.ClsnName; parameters[27].Value = model.ClsID2; parameters[28].Value = model.ClsnName2; parameters[29].Value = model.Discount; parameters[30].Value = model.Businesslicense; parameters[31].Value = model.TaxRegistration; parameters[32].Value = model.UserId; parameters[33].Value = model.utype; parameters[34].Value = model.gtype; string obj = Mtxfw.Utility.SqlDbHelper_U.GetObject(strSql.ToString(), parameters).ToString(); if (obj == "") { return 0; } else { return Convert.ToInt32(obj); } } /// /// 更新一条数据 /// public int Update(Mtxfw.Model.business_info model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update business_info set "); strSql.Append("CompanyName=@CompanyName,"); strSql.Append("frname=@frname,"); strSql.Append("fridcard=@fridcard,"); strSql.Append("email=@email,"); strSql.Append("Industry=@Industry,"); strSql.Append("BusinessRange=@BusinessRange,"); strSql.Append("Province=@Province,"); strSql.Append("City=@City,"); strSql.Append("County=@County,"); strSql.Append("IFFill=@IFFill,"); strSql.Append("Agentrading=@Agentrading,"); strSql.Append("Companyaddress=@Companyaddress,"); strSql.Append("xcoo=@xcoo,"); strSql.Append("ycoo=@ycoo,"); strSql.Append("InternetSite=@InternetSite,"); strSql.Append("ContactPhone=@ContactPhone,"); strSql.Append("ContactPeople=@ContactPeople,"); strSql.Append("Busroutes=@Busroutes,"); strSql.Append("Introduction=@Introduction,"); strSql.Append("Introduction2=@Introduction2,"); strSql.Append("Introduction3=@Introduction3,"); strSql.Append("picture=@picture,"); strSql.Append("ApplyTime=@ApplyTime,"); strSql.Append("ApplyState=@ApplyState,"); strSql.Append("ClsID=@ClsID,"); strSql.Append("ClsnName=@ClsnName,"); strSql.Append("ClsID2=@ClsID2,"); strSql.Append("ClsnName2=@ClsnName2,"); strSql.Append("Discount=@Discount,"); strSql.Append("Businesslicense=@Businesslicense,"); strSql.Append("TaxRegistration=@TaxRegistration,"); strSql.Append("token_no=@token_no,"); strSql.Append("huifu_uid=@huifu_uid,"); strSql.Append("token_no0=@token_no0,"); strSql.Append("ktoken_no=@ktoken_no,"); strSql.Append("khuifu_uid=@khuifu_uid,"); strSql.Append("ktoken_no0=@ktoken_no0,"); strSql.Append("ifedit=@ifedit,"); strSql.Append("ifeditbank=@ifeditbank,"); strSql.Append("ifd0=@ifd0,"); strSql.Append("paytype=@paytype"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@CompanyName", SqlDbType.VarChar,150), new SqlParameter("@frname", SqlDbType.VarChar,20), new SqlParameter("@fridcard", SqlDbType.VarChar,20), new SqlParameter("@email", SqlDbType.VarChar,100), new SqlParameter("@Industry", SqlDbType.VarChar,50), new SqlParameter("@BusinessRange", SqlDbType.VarChar,50), new SqlParameter("@Province", SqlDbType.VarChar,50), new SqlParameter("@City", SqlDbType.VarChar,50), new SqlParameter("@County", SqlDbType.VarChar,50), new SqlParameter("@IFFill", SqlDbType.Int), new SqlParameter("@Agentrading", SqlDbType.VarChar,100), new SqlParameter("@Companyaddress", SqlDbType.VarChar,250), new SqlParameter("@xcoo", SqlDbType.VarChar,50), new SqlParameter("@ycoo", SqlDbType.VarChar,50), new SqlParameter("@InternetSite", SqlDbType.VarChar,250), new SqlParameter("@ContactPhone", SqlDbType.VarChar,50), new SqlParameter("@ContactPeople", SqlDbType.VarChar,50), new SqlParameter("@Busroutes", SqlDbType.VarChar,250), new SqlParameter("@Introduction", SqlDbType.Text), new SqlParameter("@Introduction2", SqlDbType.Text), new SqlParameter("@Introduction3", SqlDbType.Text), new SqlParameter("@picture", SqlDbType.VarChar), new SqlParameter("@ApplyTime", SqlDbType.DateTime), new SqlParameter("@ApplyState", SqlDbType.VarChar,50), new SqlParameter("@ClsID", SqlDbType.Int,4), new SqlParameter("@ClsnName", SqlDbType.VarChar,20), new SqlParameter("@ClsID2", SqlDbType.Int,4), new SqlParameter("@ClsnName2", SqlDbType.VarChar,20), new SqlParameter("@Discount", SqlDbType.VarChar,200), new SqlParameter("@Businesslicense", SqlDbType.VarChar,200), new SqlParameter("@TaxRegistration", SqlDbType.VarChar,200), new SqlParameter("@token_no", SqlDbType.VarChar,30), new SqlParameter("@huifu_uid", SqlDbType.VarChar,50), new SqlParameter("@token_no0", SqlDbType.VarChar,30), new SqlParameter("@ktoken_no", SqlDbType.VarChar,30), new SqlParameter("@khuifu_uid", SqlDbType.VarChar,50), new SqlParameter("@ktoken_no0", SqlDbType.VarChar,30), new SqlParameter("@ifedit", SqlDbType.Int,4), new SqlParameter("@ifeditbank", SqlDbType.Int,4), new SqlParameter("@ifd0", SqlDbType.Int), new SqlParameter("@paytype", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.Int,4)}; parameters[0].Value = model.CompanyName; parameters[1].Value = model.frname; parameters[2].Value = model.fridcard; parameters[3].Value = model.email; parameters[4].Value = model.Industry; parameters[5].Value = model.BusinessRange; parameters[6].Value = model.Province; parameters[7].Value = model.City; parameters[8].Value = model.County; parameters[9].Value = model.IFFill; parameters[10].Value = model.Agentrading; parameters[11].Value = model.Companyaddress; parameters[12].Value = model.xcoo; parameters[13].Value = model.ycoo; parameters[14].Value = model.InternetSite; parameters[15].Value = model.ContactPhone; parameters[16].Value = model.ContactPeople; parameters[17].Value = model.Busroutes; parameters[18].Value = model.Introduction; parameters[19].Value = model.Introduction2; parameters[20].Value = model.Introduction3; parameters[21].Value = model.picture; parameters[22].Value = model.ApplyTime; parameters[23].Value = model.ApplyState; parameters[24].Value = model.ClsID; parameters[25].Value = model.ClsnName; parameters[26].Value = model.ClsID2; parameters[27].Value = model.ClsnName2; parameters[28].Value = model.Discount; parameters[29].Value = model.Businesslicense; parameters[30].Value = model.TaxRegistration; parameters[31].Value = model.token_no; parameters[32].Value = model.huifu_uid; parameters[33].Value = model.token_no0; parameters[34].Value = model.ktoken_no; parameters[35].Value = model.khuifu_uid; parameters[36].Value = model.ktoken_no0; parameters[37].Value = model.ifedit; parameters[38].Value = model.ifeditbank; parameters[39].Value = model.ifd0; parameters[40].Value = model.paytype; parameters[41].Value = model.Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters); } /// /// 更新数据 /// public int UpdateSel(string SelB, int SelValueB, int Id) { String sql = "update business_info set " + SelB + "=@SelValueB where Id=@Id"; SqlParameter[] para = { new SqlParameter("@SelValueB", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = SelValueB; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatetoken_no(string token_no, int Id) { String sql = "update business_info set token_no=@token_no where Id=@Id"; SqlParameter[] para = { new SqlParameter("@token_no", SqlDbType.VarChar,30), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = token_no; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatehuifu_uid(string huifu_uid, int Id) { String sql = "update business_info set huifu_uid=@huifu_uid where Id=@Id"; SqlParameter[] para = { new SqlParameter("@huifu_uid", SqlDbType.VarChar,50), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = huifu_uid; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatetoken_no0(string token_no0, int Id) { String sql = "update business_info set token_no0=@token_no0 where Id=@Id"; SqlParameter[] para = { new SqlParameter("@token_no0", SqlDbType.VarChar,30), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = token_no0; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatektoken_no(string token_no, int Id) { String sql = "update business_info set ktoken_no=@token_no where Id=@Id"; SqlParameter[] para = { new SqlParameter("@token_no", SqlDbType.VarChar,30), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = token_no; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatekhuifu_uid(string huifu_uid, int Id) { String sql = "update business_info set khuifu_uid=@huifu_uid where Id=@Id"; SqlParameter[] para = { new SqlParameter("@huifu_uid", SqlDbType.VarChar,50), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = huifu_uid; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatektoken_no0(string token_no0, int Id) { String sql = "update business_info set ktoken_no0=@token_no0 where Id=@Id"; SqlParameter[] para = { new SqlParameter("@token_no0", SqlDbType.VarChar,30), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = token_no0; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 更新数据 /// public int Updatesmmoney(Double smmoney, int Id) { String sql = "update business_info set smmoney=smmoney+@smmoney where Id=@Id"; SqlParameter[] para = { new SqlParameter("@smmoney", SqlDbType.Money), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = smmoney; para[1].Value = Id; return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para); } /// /// 删除一条数据 /// public bool Delete(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from business_info "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int,4) }; parameters[0].Value = Id; int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } } /// /// 删除一条数据 /// public bool Delete(string CompanyId) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from business_info "); strSql.Append(" where CompanyId=@CompanyId "); SqlParameter[] parameters = { new SqlParameter("@CompanyId", SqlDbType.VarChar,50)}; parameters[0].Value = CompanyId; int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } } /// /// 删除一条数据 /// public bool DeleteList(string Idlist) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from business_info "); strSql.Append(" where Id in (" + Idlist + ") "); int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString()); if (rows > 0) { return true; } else { return false; } } /// /// 得到一个对象实体 /// public Mtxfw.Model.business_info GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from business_info "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int,4) }; parameters[0].Value = Id; Mtxfw.Model.business_info model = new Mtxfw.Model.business_info(); DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } model.CompanyId = ds.Tables[0].Rows[0]["CompanyId"].ToString(); model.CompanyName = ds.Tables[0].Rows[0]["CompanyName"].ToString(); model.Industry = ds.Tables[0].Rows[0]["Industry"].ToString(); model.frname = ds.Tables[0].Rows[0]["frname"].ToString(); model.fridcard = ds.Tables[0].Rows[0]["fridcard"].ToString(); model.email = ds.Tables[0].Rows[0]["email"].ToString(); model.BusinessRange = ds.Tables[0].Rows[0]["BusinessRange"].ToString(); model.Province = ds.Tables[0].Rows[0]["Province"].ToString(); model.City = ds.Tables[0].Rows[0]["City"].ToString(); model.County = ds.Tables[0].Rows[0]["County"].ToString(); model.IFFill = int.Parse(ds.Tables[0].Rows[0]["IFFill"].ToString()); model.Agentrading = ds.Tables[0].Rows[0]["Agentrading"].ToString(); model.Companyaddress = ds.Tables[0].Rows[0]["Companyaddress"].ToString(); model.xcoo = ds.Tables[0].Rows[0]["xcoo"].ToString(); model.ycoo = ds.Tables[0].Rows[0]["ycoo"].ToString(); model.InternetSite = ds.Tables[0].Rows[0]["InternetSite"].ToString(); model.ContactPhone = ds.Tables[0].Rows[0]["ContactPhone"].ToString(); model.ContactPeople = ds.Tables[0].Rows[0]["ContactPeople"].ToString(); model.Busroutes = ds.Tables[0].Rows[0]["Busroutes"].ToString(); model.Introduction = ds.Tables[0].Rows[0]["Introduction"].ToString(); model.Introduction2 = ds.Tables[0].Rows[0]["Introduction2"].ToString(); model.Introduction3 = ds.Tables[0].Rows[0]["Introduction3"].ToString(); model.picture = ds.Tables[0].Rows[0]["picture"].ToString(); if (ds.Tables[0].Rows[0]["ApplyTime"].ToString() != "") { model.ApplyTime = DateTime.Parse(ds.Tables[0].Rows[0]["ApplyTime"].ToString()); } model.ApplyState = ds.Tables[0].Rows[0]["ApplyState"].ToString(); if (ds.Tables[0].Rows[0]["ClsID"].ToString() != "") { model.ClsID = int.Parse(ds.Tables[0].Rows[0]["ClsID"].ToString()); } model.ClsnName = ds.Tables[0].Rows[0]["ClsnName"].ToString(); if (ds.Tables[0].Rows[0]["ClsID2"].ToString() != "") { model.ClsID2 = int.Parse(ds.Tables[0].Rows[0]["ClsID2"].ToString()); } model.ClsnName2 = ds.Tables[0].Rows[0]["ClsnName2"].ToString(); model.Discount = ds.Tables[0].Rows[0]["Discount"].ToString(); model.Businesslicense = ds.Tables[0].Rows[0]["Businesslicense"].ToString(); model.TaxRegistration = ds.Tables[0].Rows[0]["TaxRegistration"].ToString(); model.token_no = ds.Tables[0].Rows[0]["token_no"].ToString(); model.huifu_uid = ds.Tables[0].Rows[0]["huifu_uid"].ToString(); model.token_no0 = ds.Tables[0].Rows[0]["token_no0"].ToString(); model.ktoken_no = ds.Tables[0].Rows[0]["ktoken_no"].ToString(); model.khuifu_uid = ds.Tables[0].Rows[0]["khuifu_uid"].ToString(); model.ktoken_no0 = ds.Tables[0].Rows[0]["ktoken_no0"].ToString(); model.smmoney = Convert.ToDouble(ds.Tables[0].Rows[0]["smmoney"].ToString()); if (ds.Tables[0].Rows[0]["UserId"].ToString() != "") { model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString()); } model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString()); model.showpic = int.Parse(ds.Tables[0].Rows[0]["showpic"].ToString()); model.ifedit = int.Parse(ds.Tables[0].Rows[0]["ifedit"].ToString()); model.ifeditbank = int.Parse(ds.Tables[0].Rows[0]["ifeditbank"].ToString()); model.ifd0 = int.Parse(ds.Tables[0].Rows[0]["ifd0"].ToString()); model.paytype = int.Parse(ds.Tables[0].Rows[0]["paytype"].ToString()); model.utype = ds.Tables[0].Rows[0]["utype"].ToString(); return model; } else { return null; } } /// /// 得到一个对象实体 /// public Mtxfw.Model.business_info GetModelByUserId(int utype,int UserId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from business_info "); strSql.Append(" where utype=@utype and UserId=@UserId"); SqlParameter[] parameters = { new SqlParameter("@utype", SqlDbType.Int), new SqlParameter("@UserId", SqlDbType.Int) }; parameters[0].Value = utype; parameters[1].Value = UserId; Mtxfw.Model.business_info model = new Mtxfw.Model.business_info(); DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } model.CompanyId = ds.Tables[0].Rows[0]["CompanyId"].ToString(); model.CompanyName = ds.Tables[0].Rows[0]["CompanyName"].ToString(); model.frname = ds.Tables[0].Rows[0]["frname"].ToString(); model.fridcard = ds.Tables[0].Rows[0]["fridcard"].ToString(); model.email = ds.Tables[0].Rows[0]["email"].ToString(); model.Industry = ds.Tables[0].Rows[0]["Industry"].ToString(); model.BusinessRange = ds.Tables[0].Rows[0]["BusinessRange"].ToString(); model.Province = ds.Tables[0].Rows[0]["Province"].ToString(); model.City = ds.Tables[0].Rows[0]["City"].ToString(); model.County = ds.Tables[0].Rows[0]["County"].ToString(); model.IFFill = int.Parse(ds.Tables[0].Rows[0]["IFFill"].ToString()); model.Agentrading = ds.Tables[0].Rows[0]["Agentrading"].ToString(); model.Companyaddress = ds.Tables[0].Rows[0]["Companyaddress"].ToString(); model.xcoo = ds.Tables[0].Rows[0]["xcoo"].ToString(); model.ycoo = ds.Tables[0].Rows[0]["ycoo"].ToString(); model.InternetSite = ds.Tables[0].Rows[0]["InternetSite"].ToString(); model.ContactPhone = ds.Tables[0].Rows[0]["ContactPhone"].ToString(); model.ContactPeople = ds.Tables[0].Rows[0]["ContactPeople"].ToString(); model.Busroutes = ds.Tables[0].Rows[0]["Busroutes"].ToString(); model.Introduction = ds.Tables[0].Rows[0]["Introduction"].ToString(); model.Introduction2 = ds.Tables[0].Rows[0]["Introduction2"].ToString(); model.Introduction3 = ds.Tables[0].Rows[0]["Introduction3"].ToString(); model.picture = ds.Tables[0].Rows[0]["picture"].ToString(); if (ds.Tables[0].Rows[0]["ApplyTime"].ToString() != "") { model.ApplyTime = DateTime.Parse(ds.Tables[0].Rows[0]["ApplyTime"].ToString()); } model.ApplyState = ds.Tables[0].Rows[0]["ApplyState"].ToString(); model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString()); if (ds.Tables[0].Rows[0]["ClsID"].ToString() != "") { model.ClsID = int.Parse(ds.Tables[0].Rows[0]["ClsID"].ToString()); } model.ClsnName = ds.Tables[0].Rows[0]["ClsnName"].ToString(); if (ds.Tables[0].Rows[0]["ClsID2"].ToString() != "") { model.ClsID2 = int.Parse(ds.Tables[0].Rows[0]["ClsID2"].ToString()); } model.ClsnName2 = ds.Tables[0].Rows[0]["ClsnName2"].ToString(); model.Discount = ds.Tables[0].Rows[0]["Discount"].ToString(); model.Businesslicense = ds.Tables[0].Rows[0]["Businesslicense"].ToString(); model.TaxRegistration = ds.Tables[0].Rows[0]["TaxRegistration"].ToString(); model.token_no = ds.Tables[0].Rows[0]["token_no"].ToString(); model.huifu_uid = ds.Tables[0].Rows[0]["huifu_uid"].ToString(); model.token_no0 = ds.Tables[0].Rows[0]["token_no0"].ToString(); model.ktoken_no = ds.Tables[0].Rows[0]["ktoken_no"].ToString(); model.khuifu_uid = ds.Tables[0].Rows[0]["khuifu_uid"].ToString(); model.ktoken_no0 = ds.Tables[0].Rows[0]["ktoken_no0"].ToString(); model.smmoney = Convert.ToDouble(ds.Tables[0].Rows[0]["smmoney"].ToString()); if (ds.Tables[0].Rows[0]["UserId"].ToString() != "") { model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString()); } model.showpic = int.Parse(ds.Tables[0].Rows[0]["showpic"].ToString()); model.ifedit = int.Parse(ds.Tables[0].Rows[0]["ifedit"].ToString()); model.ifeditbank = int.Parse(ds.Tables[0].Rows[0]["ifeditbank"].ToString()); model.ifd0 = int.Parse(ds.Tables[0].Rows[0]["ifd0"].ToString()); model.paytype = int.Parse(ds.Tables[0].Rows[0]["paytype"].ToString()); model.utype = ds.Tables[0].Rows[0]["utype"].ToString(); return model; } else { return null; } } /// /// 得到一个对象实体 /// public Mtxfw.Model.business_info GetModel(string companyid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from business_info "); strSql.Append(" where companyid=@companyid"); SqlParameter[] parameters = { new SqlParameter("@companyid", SqlDbType.VarChar,50) }; parameters[0].Value = companyid; Mtxfw.Model.business_info model = new Mtxfw.Model.business_info(); DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } model.CompanyId = ds.Tables[0].Rows[0]["CompanyId"].ToString(); model.CompanyName = ds.Tables[0].Rows[0]["CompanyName"].ToString(); model.frname = ds.Tables[0].Rows[0]["frname"].ToString(); model.fridcard = ds.Tables[0].Rows[0]["fridcard"].ToString(); model.email = ds.Tables[0].Rows[0]["email"].ToString(); model.Industry = ds.Tables[0].Rows[0]["Industry"].ToString(); model.BusinessRange = ds.Tables[0].Rows[0]["BusinessRange"].ToString(); model.Province = ds.Tables[0].Rows[0]["Province"].ToString(); model.City = ds.Tables[0].Rows[0]["City"].ToString(); model.County = ds.Tables[0].Rows[0]["County"].ToString(); model.IFFill = int.Parse(ds.Tables[0].Rows[0]["IFFill"].ToString()); model.Agentrading = ds.Tables[0].Rows[0]["Agentrading"].ToString(); model.Companyaddress = ds.Tables[0].Rows[0]["Companyaddress"].ToString(); model.xcoo = ds.Tables[0].Rows[0]["xcoo"].ToString(); model.ycoo = ds.Tables[0].Rows[0]["ycoo"].ToString(); model.InternetSite = ds.Tables[0].Rows[0]["InternetSite"].ToString(); model.ContactPhone = ds.Tables[0].Rows[0]["ContactPhone"].ToString(); model.ContactPeople = ds.Tables[0].Rows[0]["ContactPeople"].ToString(); model.Busroutes = ds.Tables[0].Rows[0]["Busroutes"].ToString(); model.Introduction = ds.Tables[0].Rows[0]["Introduction"].ToString(); model.Introduction2 = ds.Tables[0].Rows[0]["Introduction2"].ToString(); model.Introduction3 = ds.Tables[0].Rows[0]["Introduction3"].ToString(); model.picture = ds.Tables[0].Rows[0]["picture"].ToString(); if (ds.Tables[0].Rows[0]["ApplyTime"].ToString() != "") { model.ApplyTime = DateTime.Parse(ds.Tables[0].Rows[0]["ApplyTime"].ToString()); } model.ApplyState = ds.Tables[0].Rows[0]["ApplyState"].ToString(); if (ds.Tables[0].Rows[0]["ClsID"].ToString() != "") { model.ClsID = int.Parse(ds.Tables[0].Rows[0]["ClsID"].ToString()); } model.ClsnName = ds.Tables[0].Rows[0]["ClsnName"].ToString(); if (ds.Tables[0].Rows[0]["ClsID2"].ToString() != "") { model.ClsID2 = int.Parse(ds.Tables[0].Rows[0]["ClsID2"].ToString()); } model.ClsnName2 = ds.Tables[0].Rows[0]["ClsnName2"].ToString(); model.Discount = ds.Tables[0].Rows[0]["Discount"].ToString(); model.Businesslicense = ds.Tables[0].Rows[0]["Businesslicense"].ToString(); model.TaxRegistration = ds.Tables[0].Rows[0]["TaxRegistration"].ToString(); model.token_no = ds.Tables[0].Rows[0]["token_no"].ToString(); model.huifu_uid = ds.Tables[0].Rows[0]["huifu_uid"].ToString(); model.token_no0 = ds.Tables[0].Rows[0]["token_no0"].ToString(); model.ktoken_no = ds.Tables[0].Rows[0]["ktoken_no"].ToString(); model.khuifu_uid = ds.Tables[0].Rows[0]["khuifu_uid"].ToString(); model.ktoken_no0 = ds.Tables[0].Rows[0]["ktoken_no0"].ToString(); model.smmoney = Convert.ToDouble(ds.Tables[0].Rows[0]["smmoney"].ToString()); if (ds.Tables[0].Rows[0]["UserId"].ToString() != "") { model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString()); } model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString()); model.showpic = int.Parse(ds.Tables[0].Rows[0]["showpic"].ToString()); model.ifedit = int.Parse(ds.Tables[0].Rows[0]["ifedit"].ToString()); model.ifeditbank = int.Parse(ds.Tables[0].Rows[0]["ifeditbank"].ToString()); model.ifd0 = int.Parse(ds.Tables[0].Rows[0]["ifd0"].ToString()); model.paytype = int.Parse(ds.Tables[0].Rows[0]["paytype"].ToString()); model.utype = ds.Tables[0].Rows[0]["utype"].ToString(); return model; } else { return null; } } /// /// 获得数据列表 /// public DataSet GetList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM business_info "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString()); } /// /// 获得前几行数据 /// public DataSet GetList(int Top, string strWhere, string filedOrder) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); if (Top > 0) { strSql.Append(" top " + Top.ToString()); } strSql.Append(" * "); strSql.Append(" FROM business_info "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" order by " + filedOrder); return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString()); } } }