/// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hownet.Model.ProduceSellInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProduceSellInfo(");
            strSql.Append("MainID,MaterielID,ColorID,ColorOneID,ColorTwoID,SizeID,Amount,BrandID,MListID,SalesInfoID,MeasureID,SelesID,RepertoryListID,RepertoryID,PSOID)");
            strSql.Append(" values (");
            strSql.Append("@MainID,@MaterielID,@ColorID,@ColorOneID,@ColorTwoID,@SizeID,@Amount,@BrandID,@MListID,@SalesInfoID,@MeasureID,@SelesID,@RepertoryListID,@RepertoryID,@PSOID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MainID",          SqlDbType.Int,  4),
                new SqlParameter("@MaterielID",      SqlDbType.Int,  4),
                new SqlParameter("@ColorID",         SqlDbType.Int,  4),
                new SqlParameter("@ColorOneID",      SqlDbType.Int,  4),
                new SqlParameter("@ColorTwoID",      SqlDbType.Int,  4),
                new SqlParameter("@SizeID",          SqlDbType.Int,  4),
                new SqlParameter("@Amount",          SqlDbType.Real, 4),
                new SqlParameter("@BrandID",         SqlDbType.Int,  4),
                new SqlParameter("@MListID",         SqlDbType.Int,  4),
                new SqlParameter("@SalesInfoID",     SqlDbType.Int,  4),
                new SqlParameter("@MeasureID",       SqlDbType.Int,  4),
                new SqlParameter("@SelesID",         SqlDbType.Int,  4),
                new SqlParameter("@RepertoryListID", SqlDbType.Int,  4),
                new SqlParameter("@RepertoryID",     SqlDbType.Int,  4),
                new SqlParameter("@PSOID",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.MainID;
            parameters[1].Value  = model.MaterielID;
            parameters[2].Value  = model.ColorID;
            parameters[3].Value  = model.ColorOneID;
            parameters[4].Value  = model.ColorTwoID;
            parameters[5].Value  = model.SizeID;
            parameters[6].Value  = model.Amount;
            parameters[7].Value  = model.BrandID;
            parameters[8].Value  = model.MListID;
            parameters[9].Value  = model.SalesInfoID;
            parameters[10].Value = model.MeasureID;
            parameters[11].Value = model.SelesID;
            parameters[12].Value = model.RepertoryListID;
            parameters[13].Value = model.RepertoryID;
            parameters[14].Value = model.PSOID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hownet.Model.ProduceSellInfo GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,MainID,MaterielID,ColorID,ColorOneID,ColorTwoID,SizeID,Amount,BrandID,MListID,SalesInfoID,MeasureID,SelesID,RepertoryListID,RepertoryID,PSOID from ProduceSellInfo ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Hownet.Model.ProduceSellInfo model = new Hownet.Model.ProduceSellInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MainID"] != null && ds.Tables[0].Rows[0]["MainID"].ToString() != "")
                {
                    model.MainID = int.Parse(ds.Tables[0].Rows[0]["MainID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MaterielID"] != null && ds.Tables[0].Rows[0]["MaterielID"].ToString() != "")
                {
                    model.MaterielID = int.Parse(ds.Tables[0].Rows[0]["MaterielID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ColorID"] != null && ds.Tables[0].Rows[0]["ColorID"].ToString() != "")
                {
                    model.ColorID = int.Parse(ds.Tables[0].Rows[0]["ColorID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ColorOneID"] != null && ds.Tables[0].Rows[0]["ColorOneID"].ToString() != "")
                {
                    model.ColorOneID = int.Parse(ds.Tables[0].Rows[0]["ColorOneID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ColorTwoID"] != null && ds.Tables[0].Rows[0]["ColorTwoID"].ToString() != "")
                {
                    model.ColorTwoID = int.Parse(ds.Tables[0].Rows[0]["ColorTwoID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SizeID"] != null && ds.Tables[0].Rows[0]["SizeID"].ToString() != "")
                {
                    model.SizeID = int.Parse(ds.Tables[0].Rows[0]["SizeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Amount"] != null && ds.Tables[0].Rows[0]["Amount"].ToString() != "")
                {
                    model.Amount = decimal.Parse(ds.Tables[0].Rows[0]["Amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BrandID"] != null && ds.Tables[0].Rows[0]["BrandID"].ToString() != "")
                {
                    model.BrandID = int.Parse(ds.Tables[0].Rows[0]["BrandID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MListID"] != null && ds.Tables[0].Rows[0]["MListID"].ToString() != "")
                {
                    model.MListID = int.Parse(ds.Tables[0].Rows[0]["MListID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SalesInfoID"] != null && ds.Tables[0].Rows[0]["SalesInfoID"].ToString() != "")
                {
                    model.SalesInfoID = int.Parse(ds.Tables[0].Rows[0]["SalesInfoID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MeasureID"] != null && ds.Tables[0].Rows[0]["MeasureID"].ToString() != "")
                {
                    model.MeasureID = int.Parse(ds.Tables[0].Rows[0]["MeasureID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SelesID"] != null && ds.Tables[0].Rows[0]["SelesID"].ToString() != "")
                {
                    model.SelesID = int.Parse(ds.Tables[0].Rows[0]["SelesID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RepertoryListID"] != null && ds.Tables[0].Rows[0]["RepertoryListID"].ToString() != "")
                {
                    model.RepertoryListID = int.Parse(ds.Tables[0].Rows[0]["RepertoryListID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RepertoryID"] != null && ds.Tables[0].Rows[0]["RepertoryID"].ToString() != "")
                {
                    model.RepertoryID = int.Parse(ds.Tables[0].Rows[0]["RepertoryID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PSOID"] != null && ds.Tables[0].Rows[0]["PSOID"].ToString() != "")
                {
                    model.PSOID = int.Parse(ds.Tables[0].Rows[0]["PSOID"].ToString());
                }
                model.A = 1;
                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hownet.Model.ProduceSellInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProduceSellInfo set ");
            strSql.Append("MainID=@MainID,");
            strSql.Append("MaterielID=@MaterielID,");
            strSql.Append("ColorID=@ColorID,");
            strSql.Append("ColorOneID=@ColorOneID,");
            strSql.Append("ColorTwoID=@ColorTwoID,");
            strSql.Append("SizeID=@SizeID,");
            strSql.Append("Amount=@Amount,");
            strSql.Append("BrandID=@BrandID,");
            strSql.Append("MListID=@MListID,");
            strSql.Append("SalesInfoID=@SalesInfoID,");
            strSql.Append("MeasureID=@MeasureID,");
            strSql.Append("SelesID=@SelesID,");
            strSql.Append("RepertoryListID=@RepertoryListID,");
            strSql.Append("RepertoryID=@RepertoryID,");
            strSql.Append("PSOID=@PSOID");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MainID",          SqlDbType.Int,  4),
                new SqlParameter("@MaterielID",      SqlDbType.Int,  4),
                new SqlParameter("@ColorID",         SqlDbType.Int,  4),
                new SqlParameter("@ColorOneID",      SqlDbType.Int,  4),
                new SqlParameter("@ColorTwoID",      SqlDbType.Int,  4),
                new SqlParameter("@SizeID",          SqlDbType.Int,  4),
                new SqlParameter("@Amount",          SqlDbType.Real, 4),
                new SqlParameter("@BrandID",         SqlDbType.Int,  4),
                new SqlParameter("@MListID",         SqlDbType.Int,  4),
                new SqlParameter("@SalesInfoID",     SqlDbType.Int,  4),
                new SqlParameter("@MeasureID",       SqlDbType.Int,  4),
                new SqlParameter("@SelesID",         SqlDbType.Int,  4),
                new SqlParameter("@RepertoryListID", SqlDbType.Int,  4),
                new SqlParameter("@RepertoryID",     SqlDbType.Int,  4),
                new SqlParameter("@PSOID",           SqlDbType.Int,  4),
                new SqlParameter("@ID",              SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.MainID;
            parameters[1].Value  = model.MaterielID;
            parameters[2].Value  = model.ColorID;
            parameters[3].Value  = model.ColorOneID;
            parameters[4].Value  = model.ColorTwoID;
            parameters[5].Value  = model.SizeID;
            parameters[6].Value  = model.Amount;
            parameters[7].Value  = model.BrandID;
            parameters[8].Value  = model.MListID;
            parameters[9].Value  = model.SalesInfoID;
            parameters[10].Value = model.MeasureID;
            parameters[11].Value = model.SelesID;
            parameters[12].Value = model.RepertoryListID;
            parameters[13].Value = model.RepertoryID;
            parameters[14].Value = model.PSOID;
            parameters[15].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }