62,075
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System .Data .SqlClient;
using B2C.Model.B2CShop;
using B2C.IDAL.B2CShop;
using B2C .DBUtility.B2CShop;
namespace B2C .SQLServerDAL.B2CShop
{
public class Venshop_sub:IVenshop_sub
{
private static string Search_Sub_BySubName="select sub_id,sub_name,sub_date,sub_fadate,sub_number,sub_zt,sub_ps,sub_pay,sub_totime,sub_fapiao,sub_quehuo,sub_to,sub_mail,sub_tel,sub_adds,sub_post,user_mt,sub_from,sub_frommail,sub_fromtel,sub_fromadds,sub_frompost,sub_other,sub_k,sub_h,jbm from venshop_sub where sub_number=@sub_number";
private static string Search_Sub_ByUserName = "select sub_id,sub_name,sub_date,sub_fadate,sub_number,sub_zt,sub_ps,sub_pay,sub_totime,sub_fapiao,sub_quehuo,sub_to,sub_mail,sub_tel,sub_adds,sub_post,user_mt,sub_from,sub_frommail,sub_fromtel,sub_fromadds,sub_frompost,sub_other,sub_k,sub_h,jbm from venshop_sub where sub_name=@sub_name";
private static string Delete_Sub_BySubNumber = "delete from venshop_sub where sub_number=@sub_number";
private static string Insert_Sub="insert into venshop_sub(sub_name,sub_date,sub_number,sub_zt,sub_ps,sub_pay,sub_totime,sub_quehuo,sub_other,sub_to,sub_mail,sub_tel,sub_adds,sub_post,user_mt,sub_from,sub_frommail,sub_fromtel,sub_fromadds,sub_frompost,sub_k,sub_h,jbm)values(@sub_name,@sub_date,@sub_number,@sub_zt,@sub_shway,@sub_zhifu,@sub_shtime,@sub_quehuo,@sub_other,@sub_to,@sub_mail,@sub_tel,@sub_address,@sub_post,@sub_mt,@sub_from,@sub_fromMail,@sub_fromTel,@sub_fromAddress,@sub_fromPost,@sub_k,@sub_h,@jbm)";
/// <summary>
/// 添加订单
/// </summary>
/// <param name="hw"></param>
public bool InsertSub(Venshop_subInfo subInfo)
{
bool flag;
SqlParameter[] param = new SqlParameter[]{
new SqlParameter("@sub_name",SqlDbType.VarChar),
new SqlParameter("@sub_date",SqlDbType.DateTime,8),
new SqlParameter("@sub_number",SqlDbType.VarChar,20),
new SqlParameter("@sub_zt",SqlDbType.Int,4),
new SqlParameter("@sub_shway",SqlDbType.Int,4),
new SqlParameter("@sub_zhifu",SqlDbType.Int,4),
new SqlParameter("@sub_shtime",SqlDbType.Int,4),
new SqlParameter("@sub_quehuo",SqlDbType.Int,4),
new SqlParameter("@sub_other",SqlDbType.VarChar,100),
new SqlParameter("@sub_to",SqlDbType.VarChar,10),
new SqlParameter("@sub_mail",SqlDbType.VarChar),
new SqlParameter("@sub_tel",SqlDbType.VarChar,14),
new SqlParameter("@sub_address",SqlDbType.VarChar,50),
new SqlParameter("@sub_post",SqlDbType.VarChar,7),
new SqlParameter("@sub_mt",SqlDbType.VarChar,10),
new SqlParameter("@sub_from",SqlDbType.VarChar,10),
new SqlParameter("@sub_froMmail",SqlDbType.VarChar),
new SqlParameter("@sub_fromTel",SqlDbType.VarChar,14),
new SqlParameter("@sub_fromAddress",SqlDbType.VarChar,50),
new SqlParameter("@sub_fromPost",SqlDbType.VarChar,7),
new SqlParameter("@sub_k",SqlDbType.Int,4),
new SqlParameter("@sub_h",SqlDbType.Int,4),
new SqlParameter("@jbm",SqlDbType .VarChar ,7)
};
param[0].Value=subInfo.SubName;
param[1].Value=subInfo.SubDate;
param[2].Value=subInfo.SubNumber;
param[3].Value=subInfo.SubZT;
param[4].Value=subInfo.SubSongHuo;
param[5].Value=subInfo.SubZhiFu;
param[6].Value=subInfo.SubTotime;
param[7].Value=subInfo .SubQueHuo;
param[8].Value="";
param[9].Value=subInfo.SubTo;
param[10].Value=subInfo.SubMail;
param[11].Value=subInfo.SubTel;
param[12].Value=subInfo.SubAdds;
param[13].Value=subInfo.SubPost;
param[14].Value="";
param[15].Value=subInfo.SubFrom;
param[16].Value=subInfo.SubFromMail;
param[17].Value=subInfo.SubFromTel;
param[18].Value=subInfo.SubFromAdds;
param[19].Value=subInfo.SubFromPost;
param[20].Value=0;
param[21].Value=0;
param[22].Value="";
int acceptRows=SqlHelper .ExecuteNonQuery (SqlHelper .ConnectionDataBase ,CommandType .Text ,Insert_Sub,param);
flag = (acceptRows > 0) ? true : false;
return flag;
}
/// <summary>
/// 根据订单号获取订单信息
/// </summary>
/// <param name="subID"></param>
/// <returns></returns>
public Venshop_subInfo GetVenshop_subBySubNum(string subNumber)
{
Venshop_subInfo objSubInfo;
SqlParameter param=new SqlParameter("@sub_number",SqlDbType.VarChar,20);
param .Value=subNumber;
using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionDataBase, CommandType.Text, Search_Sub_BySubName, param))
{
if (rdr.Read())
{
objSubInfo = new Venshop_subInfo(rdr.GetInt32(0), rdr.GetString(1), rdr.GetDateTime(2), rdr.GetString(4),rdr.GetInt32(5), rdr.GetInt32(6), rdr.GetInt32(7), rdr.GetInt32(8), rdr.GetInt32(9),rdr.GetInt32(10), rdr.GetString(11), rdr.GetString(12), rdr.GetString(13), rdr.GetString(14),rdr.GetString(15), rdr.GetString(18), rdr.GetString(19), rdr.GetString(20), rdr.GetString(21),rdr.GetString(22));
}
else
{
objSubInfo = null;
}
}
return objSubInfo;
}
/// <summary>
/// 根据用户名查询该用户所有订单信息
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public IList<Venshop_subInfo> GetVenshop_subBySubName(string name)
{
IList<Venshop_subInfo> ILSubInfo=new List<Venshop_subInfo>();
SqlParameter param = new SqlParameter("@sub_name", SqlDbType.VarChar);
param.Value = name;
using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionDataBase, CommandType.Text, Search_Sub_ByUserName, param))
{
while (rdr.Read())
{
Venshop_subInfo objSubInfo = new Venshop_subInfo(rdr.GetInt32(0), rdr.GetString(1), rdr.GetDateTime(2), rdr.GetString(4), rdr.GetInt32(5), rdr.GetInt32(6), rdr.GetInt32(7), rdr.GetInt32(8), rdr.GetInt32(9), rdr.GetInt32(10), rdr.GetString(11), rdr.GetString(12), rdr.GetString(13), rdr.GetString(14), rdr.GetString(15), rdr.GetString(18), rdr.GetString(19), rdr.GetString(20), rdr.GetString(21), rdr.GetString(22));
ILSubInfo.Add(objSubInfo);
}
}
return ILSubInfo;
}
/// <summary>
/// 根据订单编号删除该订单
/// </summary>
/// <param name="subNumber"></param>
/// <returns></returns>
public bool IsDeleteSub(string subNumber)
{
bool flag = false;
SqlParameter param = new SqlParameter("@sub_number", SqlDbType.VarChar, 20);
param.Value = subNumber;
int acceptRows = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionDataBase, CommandType.Text, Delete_Sub_BySubNumber, param);
flag = (acceptRows > 0) ? true : false;
return flag;
}
}
}
declare @tempTab table(userid int)
insert into @tempTab
select 2
union all
select 3
union all
select 4