599 lines
29 KiB
C#
599 lines
29 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Data.SqlClient;
|
|
|
|
|
|
namespace Mtxfw.DAL
|
|
{
|
|
/// <summary>
|
|
/// 数据访问类:P_Product
|
|
/// </summary>
|
|
public partial class P_Product : Mtxfw.Utility.Myabstract
|
|
{
|
|
public P_Product()
|
|
: base("P_Product")
|
|
{ }
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public int Add(Mtxfw.Model.P_Product model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into P_Product(");
|
|
strSql.Append("P_images,P_NAME,P_ENAME,P_NAME2,P_bianhao,P_UserID,P_CATEGORY,P_CATEGORYs,P_VIP_P,P_VIP_P1,P_VIP_P2,P_VIP_P3,P_M_P,P_M_Web,P_Market_P,P_CB_P,P_YH_P,P_DESCRIPTION,P_DESCRIPTION1,P_DESCRIPTION2,P_Inventory,P_Orders,P_COMMENDF,P_HITED,P_Province,P_City,P_County,P_ADDATE,P_State,P_JiangLi,P_JiangLi2,P_JiangLi3,P_EDESCRIPTION,P_yanse,utype,utype0,P_peitype,P_peitype0,gtype)");
|
|
strSql.Append(" values (");
|
|
strSql.Append("@P_images,@P_NAME,@P_ENAME,@P_NAME2,@P_bianhao,@P_UserID,@P_CATEGORY,@P_CATEGORYs,@P_VIP_P,@P_VIP_P1,@P_VIP_P2,@P_VIP_P3,@P_M_P,@P_M_Web,@P_Market_P,@P_CB_P,@P_YH_P,@P_DESCRIPTION,@P_DESCRIPTION1,@P_DESCRIPTION2,@P_Inventory,@P_Orders,@P_COMMENDF,@P_HITED,@Province,@City,@County,@P_ADDATE,@P_State,@P_JiangLi,@P_JiangLi2,@P_JiangLi3,@P_EDESCRIPTION,@P_yanse,@utype,@utype0,@P_peitype,@P_peitype0,@gtype)");
|
|
strSql.Append(";select SCOPE_IDENTITY()");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@P_images", SqlDbType.NVarChar,8000),
|
|
new SqlParameter("@P_NAME", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_ENAME", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_NAME2", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_bianhao", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_UserID", SqlDbType.Int),
|
|
new SqlParameter("@P_CATEGORY", SqlDbType.Int),
|
|
new SqlParameter("@P_CATEGORYs", SqlDbType.VarChar,800),
|
|
new SqlParameter("@P_VIP_P", SqlDbType.Money),
|
|
new SqlParameter("@P_VIP_P1", SqlDbType.Money),
|
|
new SqlParameter("@P_VIP_P2", SqlDbType.Money),
|
|
new SqlParameter("@P_VIP_P3", SqlDbType.Money),
|
|
new SqlParameter("@P_M_P", SqlDbType.Int),
|
|
new SqlParameter("@P_M_Web", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_Market_P", SqlDbType.Money),
|
|
new SqlParameter("@P_CB_P", SqlDbType.Money),
|
|
new SqlParameter("@P_YH_P", SqlDbType.Money),
|
|
new SqlParameter("@P_DESCRIPTION", SqlDbType.NText),
|
|
new SqlParameter("@P_DESCRIPTION1", SqlDbType.NText),
|
|
new SqlParameter("@P_DESCRIPTION2", SqlDbType.NText),
|
|
new SqlParameter("@P_Inventory", SqlDbType.Int),
|
|
new SqlParameter("@P_Orders", SqlDbType.Int),
|
|
new SqlParameter("@P_COMMENDF", SqlDbType.Bit),
|
|
new SqlParameter("@P_HITED", SqlDbType.Int),
|
|
new SqlParameter("@Province", SqlDbType.VarChar,50),
|
|
new SqlParameter("@City", SqlDbType.VarChar,50),
|
|
new SqlParameter("@County", SqlDbType.VarChar,50),
|
|
new SqlParameter("@P_ADDATE", SqlDbType.DateTime),
|
|
new SqlParameter("@P_State", SqlDbType.VarChar,50),
|
|
new SqlParameter("@P_JiangLi", SqlDbType.Int),
|
|
new SqlParameter("@P_JiangLi2", SqlDbType.Int),
|
|
new SqlParameter("@P_JiangLi3", SqlDbType.Int),
|
|
new SqlParameter("@P_EDESCRIPTION", SqlDbType.NVarChar,2000),
|
|
new SqlParameter("@P_yanse", SqlDbType.VarChar,2000),
|
|
new SqlParameter("@utype", SqlDbType.VarChar,50),
|
|
new SqlParameter("@utype0", SqlDbType.Int),
|
|
new SqlParameter("@P_peitype", SqlDbType.Int),
|
|
new SqlParameter("@P_peitype0", SqlDbType.Int),
|
|
new SqlParameter("@gtype", SqlDbType.Int)};
|
|
parameters[0].Value = model.P_images;
|
|
parameters[1].Value = model.P_NAME;
|
|
parameters[2].Value = model.P_ENAME;
|
|
parameters[3].Value = model.P_NAME2;
|
|
parameters[4].Value = model.P_bianhao;
|
|
parameters[5].Value = model.P_UserID;
|
|
parameters[6].Value = model.P_CATEGORY;
|
|
parameters[7].Value = model.P_CATEGORYs;
|
|
parameters[8].Value = model.P_VIP_P;
|
|
parameters[9].Value = model.P_VIP_P1;
|
|
parameters[10].Value = model.P_VIP_P2;
|
|
parameters[11].Value = model.P_VIP_P3;
|
|
parameters[12].Value = model.P_M_P;
|
|
parameters[13].Value = model.P_M_Web;
|
|
parameters[14].Value = model.P_Market_P;
|
|
parameters[15].Value = model.P_CB_P;
|
|
parameters[16].Value = model.P_YH_P;
|
|
parameters[17].Value = model.P_DESCRIPTION;
|
|
parameters[18].Value = model.P_DESCRIPTION1;
|
|
parameters[19].Value = model.P_DESCRIPTION2;
|
|
parameters[20].Value = model.P_Inventory;
|
|
parameters[21].Value = model.P_Orders;
|
|
parameters[22].Value = model.P_COMMENDF;
|
|
parameters[23].Value = model.P_HITED;
|
|
parameters[24].Value = model.Province;
|
|
parameters[25].Value = model.City;
|
|
parameters[26].Value = model.County;
|
|
parameters[27].Value = model.P_ADDATE;
|
|
parameters[28].Value = model.P_State;
|
|
parameters[29].Value = model.P_JiangLi;
|
|
parameters[30].Value = model.P_JiangLi2;
|
|
parameters[31].Value = model.P_JiangLi3;
|
|
parameters[32].Value = model.P_EDESCRIPTION;
|
|
parameters[33].Value = model.P_yanse;
|
|
parameters[34].Value = model.utype;
|
|
parameters[35].Value = model.utype0;
|
|
parameters[36].Value = model.P_peitype;
|
|
parameters[37].Value = model.P_peitype0;
|
|
parameters[38].Value = model.gtype;
|
|
string obj = Mtxfw.Utility.SqlDbHelper_U.GetObject(strSql.ToString(), parameters).ToString();
|
|
if (obj == "")
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return Convert.ToInt32(obj);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int Update(Mtxfw.Model.P_Product model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update P_Product set ");
|
|
strSql.Append("P_images=@P_images,");
|
|
strSql.Append("P_NAME=@P_NAME,");
|
|
strSql.Append("P_ENAME=@P_ENAME,");
|
|
strSql.Append("P_NAME2=@P_NAME2,");
|
|
strSql.Append("P_bianhao=@P_bianhao,");
|
|
strSql.Append("P_CATEGORY=@P_CATEGORY,");
|
|
strSql.Append("P_CATEGORYs=@P_CATEGORYs,");
|
|
strSql.Append("P_VIP_P=@P_VIP_P,");
|
|
strSql.Append("P_VIP_P1=@P_VIP_P1,");
|
|
strSql.Append("P_VIP_P2=@P_VIP_P2,");
|
|
strSql.Append("P_VIP_P3=@P_VIP_P3,");
|
|
strSql.Append("P_M_P=@P_M_P,");
|
|
strSql.Append("P_M_Web=@P_M_Web,");
|
|
strSql.Append("P_Market_p=@P_Market_P,");
|
|
strSql.Append("P_CB_P=@P_CB_P,");
|
|
strSql.Append("P_YH_P=@P_YH_P,");
|
|
strSql.Append("P_DESCRIPTION=@P_DESCRIPTION,");
|
|
strSql.Append("P_DESCRIPTION1=@P_DESCRIPTION1,");
|
|
strSql.Append("P_DESCRIPTION2=@P_DESCRIPTION2,");
|
|
strSql.Append("P_Inventory=@P_Inventory,");
|
|
strSql.Append("P_COMMENDF=@P_COMMENDF,");
|
|
strSql.Append("P_Province=@Province,");
|
|
strSql.Append("P_City=@City,");
|
|
strSql.Append("P_County=@County,");
|
|
strSql.Append("P_State=@P_State,");
|
|
strSql.Append("P_JiangLi=@P_JiangLi,");
|
|
strSql.Append("P_JiangLi2=@P_JiangLi2,");
|
|
strSql.Append("P_JiangLi3=@P_JiangLi3,");
|
|
strSql.Append("P_EDESCRIPTION=@P_EDESCRIPTION,");
|
|
strSql.Append("P_yanse=@P_yanse,");
|
|
strSql.Append("utype=@utype,");
|
|
strSql.Append("P_peitype=@P_peitype,");
|
|
strSql.Append("P_peitype0=@P_peitype0,");
|
|
strSql.Append("P_UserID=@P_UserID");
|
|
strSql.Append(" where P_ID=@P_ID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@P_images", SqlDbType.NVarChar,8000),
|
|
new SqlParameter("@P_NAME", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_ENAME", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_NAME2", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_bianhao", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_CATEGORY", SqlDbType.Int),
|
|
new SqlParameter("@P_CATEGORYs", SqlDbType.VarChar,800),
|
|
new SqlParameter("@P_VIP_P", SqlDbType.Money),
|
|
new SqlParameter("@P_VIP_P1", SqlDbType.Money),
|
|
new SqlParameter("@P_VIP_P2", SqlDbType.Money),
|
|
new SqlParameter("@P_VIP_P3", SqlDbType.Money),
|
|
new SqlParameter("@P_M_P", SqlDbType.Int),
|
|
new SqlParameter("@P_M_Web", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_Market_P", SqlDbType.Money),
|
|
new SqlParameter("@P_CB_P", SqlDbType.Money),
|
|
new SqlParameter("@P_YH_P", SqlDbType.Money),
|
|
new SqlParameter("@P_DESCRIPTION", SqlDbType.NText),
|
|
new SqlParameter("@P_DESCRIPTION1", SqlDbType.NText),
|
|
new SqlParameter("@P_DESCRIPTION2", SqlDbType.NText),
|
|
new SqlParameter("@P_Inventory", SqlDbType.Int),
|
|
new SqlParameter("@P_COMMENDF", SqlDbType.Bit),
|
|
new SqlParameter("@Province", SqlDbType.VarChar,50),
|
|
new SqlParameter("@City", SqlDbType.VarChar,50),
|
|
new SqlParameter("@County", SqlDbType.VarChar,50),
|
|
new SqlParameter("@P_State", SqlDbType.VarChar,50),
|
|
new SqlParameter("@P_JiangLi", SqlDbType.Int),
|
|
new SqlParameter("@P_JiangLi2", SqlDbType.Int),
|
|
new SqlParameter("@P_JiangLi3", SqlDbType.Int),
|
|
new SqlParameter("@P_EDESCRIPTION", SqlDbType.NVarChar,2000),
|
|
new SqlParameter("@P_yanse", SqlDbType.VarChar,2000),
|
|
new SqlParameter("@utype", SqlDbType.VarChar,50),
|
|
new SqlParameter("@P_peitype", SqlDbType.Int),
|
|
new SqlParameter("@P_peitype0", SqlDbType.Int),
|
|
new SqlParameter("@P_UserID", SqlDbType.Int),
|
|
new SqlParameter("@P_ID", SqlDbType.Int)};
|
|
parameters[0].Value = model.P_images;
|
|
parameters[1].Value = model.P_NAME;
|
|
parameters[2].Value = model.P_ENAME;
|
|
parameters[3].Value = model.P_NAME2;
|
|
parameters[4].Value = model.P_bianhao;
|
|
parameters[5].Value = model.P_CATEGORY;
|
|
parameters[6].Value = model.P_CATEGORYs;
|
|
parameters[7].Value = model.P_VIP_P;
|
|
parameters[8].Value = model.P_VIP_P1;
|
|
parameters[9].Value = model.P_VIP_P2;
|
|
parameters[10].Value = model.P_VIP_P3;
|
|
parameters[11].Value = model.P_M_P;
|
|
parameters[12].Value = model.P_M_Web;
|
|
parameters[13].Value = model.P_Market_P;
|
|
parameters[14].Value = model.P_CB_P;
|
|
parameters[15].Value = model.P_YH_P;
|
|
parameters[16].Value = model.P_DESCRIPTION;
|
|
parameters[17].Value = model.P_DESCRIPTION1;
|
|
parameters[18].Value = model.P_DESCRIPTION2;
|
|
parameters[19].Value = model.P_Inventory;
|
|
parameters[20].Value = model.P_COMMENDF;
|
|
parameters[21].Value = model.Province;
|
|
parameters[22].Value = model.City;
|
|
parameters[23].Value = model.County;
|
|
parameters[24].Value = model.P_State;
|
|
parameters[25].Value = model.P_JiangLi;
|
|
parameters[26].Value = model.P_JiangLi2;
|
|
parameters[27].Value = model.P_JiangLi3;
|
|
parameters[28].Value = model.P_EDESCRIPTION;
|
|
parameters[29].Value = model.P_yanse;
|
|
parameters[30].Value = model.utype;
|
|
parameters[31].Value = model.P_peitype;
|
|
parameters[32].Value = model.P_peitype0;
|
|
parameters[33].Value = model.P_UserID;
|
|
parameters[34].Value = model.P_ID;
|
|
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int UpdateE(Mtxfw.Model.P_Product model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update P_Product set ");
|
|
strSql.Append("P_ENAME=@P_ENAME,");
|
|
strSql.Append("P_EDESCRIPTION=@P_EDESCRIPTION");
|
|
strSql.Append(" where P_ID=@P_ID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@P_ENAME", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_EDESCRIPTION", SqlDbType.NText),
|
|
new SqlParameter("@P_ID", SqlDbType.Int)};
|
|
parameters[0].Value = model.P_ENAME;
|
|
parameters[1].Value = model.P_EDESCRIPTION;
|
|
parameters[2].Value = model.P_ID;
|
|
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int Update(int strID,string Sel,string SelValue)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
if (Sel == "P_Orders" || Sel == "P_Orders0" || Sel == "P_Orders1" || Sel == "P_Orders2" || Sel == "P_PJOrders" || Sel == "P_SCOrders")
|
|
{
|
|
strSql.Append("update P_Product set " + Sel + "=" + Sel + "+@SelValue where P_ID=@P_ID");
|
|
}
|
|
else
|
|
{
|
|
strSql.Append("update P_Product set " + Sel + "=@SelValue where P_ID=@P_ID");
|
|
}
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@SelValue", SqlDbType.VarChar,50),
|
|
new SqlParameter("@P_ID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = SelValue;
|
|
parameters[1].Value = strID;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 假删除
|
|
/// </summary>
|
|
public int UpdateIFDelete(int IFDelete, string IFDeleteTime, Int32 Id)
|
|
{
|
|
String sql = "update [P_Product] set IFDelete=@IFDelete,IFDeleteTime=@IFDeleteTime where P_Id=@Id";
|
|
SqlParameter[] para = { new SqlParameter("@IFDelete", SqlDbType.Int),
|
|
new SqlParameter("@IFDeleteTime", SqlDbType.VarChar,50),
|
|
new SqlParameter("@Id", SqlDbType.Int) };
|
|
para[0].Value = IFDelete;
|
|
para[1].Value = IFDeleteTime;
|
|
para[2].Value = Id;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
|
|
}
|
|
/// <summary>
|
|
/// 假删除
|
|
/// </summary>
|
|
public int UpdateIFDelete0(int IFDelete, string IFDeleteTime, Int32 BusId)
|
|
{
|
|
String sql = "update [P_Product] set IFDelete=@IFDelete,IFDeleteTime=@IFDeleteTime where IFDelete=0 and P_UserId=@BusId";
|
|
SqlParameter[] para = { new SqlParameter("@IFDelete", SqlDbType.Int),
|
|
new SqlParameter("@IFDeleteTime", SqlDbType.VarChar,50),
|
|
new SqlParameter("@BusId", SqlDbType.Int) };
|
|
para[0].Value = IFDelete;
|
|
para[1].Value = IFDeleteTime;
|
|
para[2].Value = BusId;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int UpdateP_UserID(int P_UserID, int utype0, int YUserID)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update P_Product set P_UserID=@P_UserID where utype0=@utype0 and P_UserID=@YUserID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@P_UserID", SqlDbType.Int,4),
|
|
new SqlParameter("@utype0", SqlDbType.Int,4),
|
|
new SqlParameter("@YUserID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = P_UserID;
|
|
parameters[1].Value = utype0;
|
|
parameters[2].Value = YUserID;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int UpdateInventory(int strID, int SelValue)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update P_Product set P_Inventory=P_Inventory+@SelValue where P_ID=@P_ID And P_Inventory<>0");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@SelValue", SqlDbType.Int,4),
|
|
new SqlParameter("@P_ID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = SelValue;
|
|
parameters[1].Value = strID;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int UpdateJiangLi(int strID, int SelValue)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update P_Product set P_JiangLi=P_JiangLi+@SelValue where P_ID=@P_ID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@SelValue", SqlDbType.Int,4),
|
|
new SqlParameter("@P_ID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = SelValue;
|
|
parameters[1].Value = strID;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public int Updatebianhao(int strID, string SelValue)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update P_Product set P_bianhao=@SelValue where P_ID=@P_ID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@SelValue", SqlDbType.VarChar,250),
|
|
new SqlParameter("@P_ID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = SelValue;
|
|
parameters[1].Value = strID;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
}
|
|
/// <summary>
|
|
/// 获取最大编号
|
|
/// </summary>
|
|
public Int64 GetMaxbianhao(int gtype)
|
|
{
|
|
string sql = "select top 1 isnull(max(Convert(bigint,substring(P_bianhao,2,len(P_bianhao)))),0) from [P_Product] where gtype=@gtype And P_bianhao<>''";
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@gtype", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = gtype;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteScalar2(sql);
|
|
}
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(int P_ID)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from P_Product ");
|
|
strSql.Append(" where P_ID=@P_ID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@P_ID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = P_ID;
|
|
|
|
int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public Mtxfw.Model.P_Product GetModel(int P_ID)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select top 1 a.*,(select b.C_NAME From P_Category b where b.C_ID=a.P_CATEGORY) as PNAME from P_Product a");
|
|
strSql.Append(" where P_ID=@P_ID");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@P_ID", SqlDbType.Int,4)
|
|
};
|
|
parameters[0].Value = P_ID;
|
|
|
|
Mtxfw.Model.P_Product model = new Mtxfw.Model.P_Product();
|
|
DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
if (ds.Tables[0].Rows[0]["P_ID"].ToString() != "")
|
|
{
|
|
model.P_ID = int.Parse(ds.Tables[0].Rows[0]["P_ID"].ToString());
|
|
}
|
|
model.P_images = ds.Tables[0].Rows[0]["P_images"].ToString();
|
|
model.P_NAME = ds.Tables[0].Rows[0]["P_NAME"].ToString();
|
|
model.P_NAME2 = ds.Tables[0].Rows[0]["P_NAME2"].ToString();
|
|
model.P_ENAME = ds.Tables[0].Rows[0]["P_ENAME"].ToString();
|
|
model.P_bianhao = ds.Tables[0].Rows[0]["P_bianhao"].ToString();
|
|
model.P_UserID = int.Parse(ds.Tables[0].Rows[0]["P_UserID"].ToString());
|
|
model.PNAME = ds.Tables[0].Rows[0]["PNAME"].ToString();
|
|
if (ds.Tables[0].Rows[0]["P_CATEGORY"].ToString() != "")
|
|
{
|
|
model.P_CATEGORY = int.Parse(ds.Tables[0].Rows[0]["P_CATEGORY"].ToString());
|
|
}
|
|
model.P_CATEGORYs = ds.Tables[0].Rows[0]["P_CATEGORYs"].ToString();
|
|
|
|
if (ds.Tables[0].Rows[0]["P_VIP_P"].ToString() != "")
|
|
{
|
|
model.P_VIP_P = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_VIP_P1"].ToString() != "")
|
|
{
|
|
model.P_VIP_P1 = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P1"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_VIP_P2"].ToString() != "")
|
|
{
|
|
model.P_VIP_P2 = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P2"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_VIP_P3"].ToString() != "")
|
|
{
|
|
model.P_VIP_P3 = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P3"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_M_P"].ToString() != "")
|
|
{
|
|
model.P_M_P = int.Parse(ds.Tables[0].Rows[0]["P_M_P"].ToString());
|
|
}
|
|
model.P_M_Web = ds.Tables[0].Rows[0]["P_M_Web"].ToString();
|
|
if (ds.Tables[0].Rows[0]["P_Market_P"].ToString() != "")
|
|
{
|
|
model.P_Market_P = Convert.ToDouble(ds.Tables[0].Rows[0]["P_Market_P"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_CB_P"].ToString() != "")
|
|
{
|
|
model.P_CB_P = Convert.ToDouble(ds.Tables[0].Rows[0]["P_CB_P"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_YH_P"].ToString() != "")
|
|
{
|
|
model.P_YH_P = Convert.ToDouble(ds.Tables[0].Rows[0]["P_YH_P"].ToString());
|
|
}
|
|
model.P_DESCRIPTION = ds.Tables[0].Rows[0]["P_DESCRIPTION"].ToString();
|
|
model.P_DESCRIPTION1 = ds.Tables[0].Rows[0]["P_DESCRIPTION1"].ToString();
|
|
model.P_DESCRIPTION2 = ds.Tables[0].Rows[0]["P_DESCRIPTION2"].ToString();
|
|
model.P_EDESCRIPTION = ds.Tables[0].Rows[0]["P_EDESCRIPTION"].ToString();
|
|
if (ds.Tables[0].Rows[0]["P_Inventory"].ToString() != "")
|
|
{
|
|
model.P_Inventory = Convert.ToInt32(ds.Tables[0].Rows[0]["P_Inventory"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_Orders"].ToString() != "")
|
|
{
|
|
model.P_Orders = Convert.ToInt32(ds.Tables[0].Rows[0]["P_Orders"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_Orders0"].ToString() != "")
|
|
{
|
|
model.P_Orders0 = Convert.ToInt32(ds.Tables[0].Rows[0]["P_Orders0"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_Orders1"].ToString() != "")
|
|
{
|
|
model.P_Orders1 = Convert.ToInt32(ds.Tables[0].Rows[0]["P_Orders1"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_Orders2"].ToString() != "")
|
|
{
|
|
model.P_Orders2 = Convert.ToInt32(ds.Tables[0].Rows[0]["P_Orders2"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_PJOrders"].ToString() != "")
|
|
{
|
|
model.P_PJOrders = Convert.ToInt32(ds.Tables[0].Rows[0]["P_PJOrders"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_SCOrders"].ToString() != "")
|
|
{
|
|
model.P_SCOrders = Convert.ToInt32(ds.Tables[0].Rows[0]["P_SCOrders"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_COMMENDF"].ToString() != "")
|
|
{
|
|
model.P_COMMENDF = Convert.ToBoolean(ds.Tables[0].Rows[0]["P_COMMENDF"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_HITED"].ToString() != "")
|
|
{
|
|
model.P_HITED = Convert.ToInt32(ds.Tables[0].Rows[0]["P_HITED"].ToString());
|
|
}
|
|
model.Province = ds.Tables[0].Rows[0]["P_Province"].ToString();
|
|
model.City = ds.Tables[0].Rows[0]["P_City"].ToString();
|
|
model.County = ds.Tables[0].Rows[0]["P_County"].ToString();
|
|
if (ds.Tables[0].Rows[0]["P_ADDATE"].ToString() != "")
|
|
{
|
|
model.P_ADDATE = Convert.ToDateTime(ds.Tables[0].Rows[0]["P_ADDATE"].ToString());
|
|
}
|
|
model.utype = ds.Tables[0].Rows[0]["utype"].ToString();
|
|
model.utype0 = Convert.ToInt32(ds.Tables[0].Rows[0]["utype0"].ToString());
|
|
model.P_peitype = Convert.ToInt32(ds.Tables[0].Rows[0]["P_peitype"].ToString());
|
|
model.P_peitype0 = Convert.ToInt32(ds.Tables[0].Rows[0]["P_peitype0"].ToString());
|
|
model.P_State = ds.Tables[0].Rows[0]["P_State"].ToString();
|
|
if (ds.Tables[0].Rows[0]["P_ppproduct"].ToString() != "")
|
|
{
|
|
model.P_ppproduct = Convert.ToBoolean(ds.Tables[0].Rows[0]["P_ppproduct"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_qgproduct"].ToString() != "")
|
|
{
|
|
model.P_qgproduct = Convert.ToBoolean(ds.Tables[0].Rows[0]["P_qgproduct"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_JiangLi"].ToString() != "")
|
|
{
|
|
model.P_JiangLi = Convert.ToInt32(ds.Tables[0].Rows[0]["P_JiangLi"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_JiangLi2"].ToString() != "")
|
|
{
|
|
model.P_JiangLi2 = Convert.ToInt32(ds.Tables[0].Rows[0]["P_JiangLi2"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["P_JiangLi3"].ToString() != "")
|
|
{
|
|
model.P_JiangLi3 = Convert.ToInt32(ds.Tables[0].Rows[0]["P_JiangLi3"].ToString());
|
|
}
|
|
model.P_yanse = ds.Tables[0].Rows[0]["P_yanse"].ToString();
|
|
return model;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select *");
|
|
strSql.Append(" FROM P_Product ");
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql.Append(" where " + strWhere);
|
|
}
|
|
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得前几行数据
|
|
/// </summary>
|
|
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 P_Product ");
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql.Append(" where " + strWhere);
|
|
}
|
|
strSql.Append(" order by " + filedOrder);
|
|
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
|
}
|
|
public new int GetCount(string where)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("select count(P_ID) from " + TABLE_NAME + " a");
|
|
if (!String.IsNullOrEmpty(where))
|
|
sb.Append(" where " + where);
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteScalar(sb.ToString());
|
|
}
|
|
|
|
}
|
|
}
|
|
|