/// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">model</param>
        public int AddRecord(CSaleDetail_HangHaoData model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("set nocount on; ");
            strSql.Append("insert into CSaleDetail_HangHao(");
            strSql.Append(@"AbsEntry,LineNum,saleBillNo,materialNo,shipDate,wareNo,SubCatNum,num,partialBox,uintQty,
                            boxqty,boxNum,instantState,sapOutStockNum,DocEntry,isSapOutStock,financeBillNo,financeBillSort)");
            strSql.Append(" values (");
            strSql.Append(@"@AbsEntry,@LineNum,@saleBillNo,@materialNo,@shipDate,@wareNo,@SubCatNum,@num,@partialBox,@uintQty,
                            @boxqty,@boxNum,@instantState,@sapOutStockNum,@DocEntry,@isSapOutStock,@financeBillNo,@financeBillSort)");
            strSql.Append("; select @@identity; set nocount off; ");
            SqlParameter[] parameters = {
                    new SqlParameter("@AbsEntry", SqlDbType.Int),
                    new SqlParameter("@LineNum", SqlDbType.Int),
                    new SqlParameter("@saleBillNo", SqlDbType.VarChar,20),
                    new SqlParameter("@materialNo", SqlDbType.VarChar,20),
                    new SqlParameter("@shipDate", SqlDbType.DateTime),
                    new SqlParameter("@wareNo", SqlDbType.VarChar,20),
                    new SqlParameter("@SubCatNum", SqlDbType.VarChar,20),
                    new SqlParameter("@num", SqlDbType.Float),
                    new SqlParameter("@partialBox", SqlDbType.Char,1),
                    new SqlParameter("@uintQty", SqlDbType.Float),
                    new SqlParameter("@boxqty", SqlDbType.Float),
                    new SqlParameter("@boxNum", SqlDbType.Float),
                    new SqlParameter("@instantState", SqlDbType.VarChar,10),
                    new SqlParameter("@sapOutStockNum", SqlDbType.Float),
                    new SqlParameter("@DocEntry", SqlDbType.Int),
                    new SqlParameter("@isSapOutStock", SqlDbType.Bit),
                    new SqlParameter("@financeBillNo", SqlDbType.VarChar,20),
                    new SqlParameter("@financeBillSort", SqlDbType.NVarChar,20)
                };
            parameters[0].Value = model.AbsEntry;
            parameters[1].Value = model.LineNum;
            parameters[2].Value = model.saleBillNo;
            parameters[3].Value = model.materialNo;
            parameters[4].Value = model.shipDate == string.Empty ? null : model.shipDate;
            parameters[5].Value = model.wareNo;
            parameters[6].Value = model.SubCatNum;
            parameters[7].Value = model.num;
            parameters[8].Value = model.partialBox;
            parameters[9].Value = model.uintQty;
            parameters[10].Value = model.boxqty;
            parameters[11].Value = model.boxNum;
            parameters[12].Value = model.instantState;
            parameters[13].Value = model.sapOutStockNum;
            parameters[14].Value = model.DocEntry;
            parameters[15].Value = model.isSapOutStock;
            parameters[16].Value = model.financeBillNo;
            parameters[17].Value = model.financeBillSort;

            int id = 0;
            try
            {
                object ret = SqlHelper.ExecuteScalar(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

                if (ret != null && ret != DBNull.Value)
                {
                    id = Convert.ToInt32(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return id;
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">model</param>
        public bool ModifyRecord(CSaleDetail_HangHaoData model)
        {
            bool ret = false;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update CSaleDetail_HangHao set ");
            strSql.Append("AbsEntry=@AbsEntry,");
            strSql.Append("LineNum=@LineNum,");
            strSql.Append("saleBillNo=@saleBillNo,");
            strSql.Append("materialNo=@materialNo,");
            strSql.Append("shipDate=@shipDate,");
            strSql.Append("wareNo=@wareNo,");
            strSql.Append("SubCatNum=@SubCatNum,");
            strSql.Append("num=@num,");
            strSql.Append("partialBox=@partialBox,");
            strSql.Append("uintQty=@uintQty,");
            strSql.Append("boxqty=@boxqty,");
            strSql.Append("boxNum=@boxNum,");
            strSql.Append("instantState=@instantState,");
            strSql.Append("sapOutStockNum=@sapOutStockNum,");
            strSql.Append("DocEntry=@DocEntry,");
            strSql.Append("isSapOutStock=@isSapOutStock,");
            strSql.Append("financeBillNo=@financeBillNo,");
            strSql.Append("financeBillSort=@financeBillSort");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int),
                    new SqlParameter("@AbsEntry", SqlDbType.Int),
                    new SqlParameter("@LineNum", SqlDbType.Int),
                    new SqlParameter("@saleBillNo", SqlDbType.VarChar,20),
                    new SqlParameter("@materialNo", SqlDbType.VarChar,20),
                    new SqlParameter("@shipDate", SqlDbType.DateTime),
                    new SqlParameter("@wareNo", SqlDbType.VarChar,20),
                    new SqlParameter("@SubCatNum", SqlDbType.VarChar,20),
                    new SqlParameter("@num", SqlDbType.Float),
                    new SqlParameter("@partialBox", SqlDbType.Char,1),
                    new SqlParameter("@uintQty", SqlDbType.Float),
                    new SqlParameter("@boxqty", SqlDbType.Float),
                    new SqlParameter("@boxNum", SqlDbType.Float),
                    new SqlParameter("@instantState", SqlDbType.VarChar,10),
                    new SqlParameter("@sapOutStockNum", SqlDbType.Float),
                    new SqlParameter("@DocEntry", SqlDbType.Int),
                    new SqlParameter("@isSapOutStock", SqlDbType.Bit),
                    new SqlParameter("@financeBillNo", SqlDbType.VarChar,20),
                    new SqlParameter("@financeBillSort", SqlDbType.NVarChar,20)
                };
            parameters[0].Value = model.id;
            parameters[1].Value = model.AbsEntry;
            parameters[2].Value = model.LineNum;
            parameters[3].Value = model.saleBillNo;
            parameters[4].Value = model.materialNo;
            parameters[5].Value = model.shipDate == string.Empty ? null : model.shipDate;
            parameters[6].Value = model.wareNo;
            parameters[7].Value = model.SubCatNum;
            parameters[8].Value = model.num;
            parameters[9].Value = model.partialBox;
            parameters[10].Value = model.uintQty;
            parameters[11].Value = model.boxqty;
            parameters[12].Value = model.boxNum;
            parameters[13].Value = model.instantState;
            parameters[14].Value = model.sapOutStockNum;
            parameters[15].Value = model.DocEntry;
            parameters[16].Value = model.isSapOutStock;
            parameters[17].Value = model.financeBillNo;
            parameters[18].Value = model.financeBillSort;

            try
            {
                SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);
                ret = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ret;
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model</param>
 public bool ModifyRecord(CSaleDetail_HangHaoData model)
 {
     return this.saleDetail_HangHaoDB.ModifyRecord(model);
 }
        /// <summary>
        /// 得到一个model
        /// </summary>
        /// <param name="id">主键值</param>
        /// <returns>model</returns>
        public CSaleDetail_HangHaoData GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select id,AbsEntry,LineNum,saleBillNo,materialNo,shipDate,wareNo,SubCatNum,num,partialBox,uintQty,
                            boxqty,boxNum,instantState,sapOutStockNum,DocEntry,isSapOutStock,financeBillNo,financeBillSort from CSaleDetail_HangHao");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int)
                };
            parameters[0].Value = id;

            CSaleDetail_HangHaoData model = new CSaleDetail_HangHaoData();
            DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["id"] != DBNull.Value)
                {
                    model.id = Convert.ToInt32(row["id"]);
                }
                if (row["AbsEntry"] != DBNull.Value)
                {
                    model.AbsEntry = Convert.ToInt32(row["AbsEntry"]);
                }
                if (row["LineNum"] != DBNull.Value)
                {
                    model.LineNum = Convert.ToInt32(row["LineNum"]);
                }
                if (row["saleBillNo"] != DBNull.Value)
                {
                    model.saleBillNo = Convert.ToString(row["saleBillNo"]);
                }
                if (row["materialNo"] != DBNull.Value)
                {
                    model.materialNo = Convert.ToString(row["materialNo"]);
                }
                if (row["shipDate"] != DBNull.Value)
                {
                    model.shipDate = Convert.ToString(row["shipDate"]);
                }
                if (row["wareNo"] != DBNull.Value)
                {
                    model.wareNo = Convert.ToString(row["wareNo"]);
                }
                if (row["SubCatNum"] != DBNull.Value)
                {
                    model.SubCatNum = Convert.ToString(row["SubCatNum"]);
                }
                if (row["num"] != DBNull.Value)
                {
                    model.num = Convert.ToDouble(row["num"]);
                }
                if (row["partialBox"] != DBNull.Value)
                {
                    model.partialBox = Convert.ToString(row["partialBox"]);
                }
                if (row["uintQty"] != DBNull.Value)
                {
                    model.uintQty = Convert.ToDouble(row["uintQty"]);
                }
                if (row["boxqty"] != DBNull.Value)
                {
                    model.boxqty = Convert.ToDouble(row["boxqty"]);
                }
                if (row["boxNum"] != DBNull.Value)
                {
                    model.boxNum = Convert.ToDouble(row["boxNum"]);
                }
                if (row["instantState"] != DBNull.Value)
                {
                    model.instantState = Convert.ToString(row["instantState"]);
                }
                if (row["sapOutStockNum"] != DBNull.Value)
                {
                    model.sapOutStockNum = Convert.ToDouble(row["sapOutStockNum"]);
                }
                if (row["DocEntry"] != DBNull.Value)
                {
                    model.DocEntry = Convert.ToInt32(row["DocEntry"]);
                }
                if (row["isSapOutStock"] != DBNull.Value)
                {
                    model.isSapOutStock = Convert.ToBoolean(row["isSapOutStock"]);
                }
                if (row["financeBillNo"] != DBNull.Value)
                {
                    model.financeBillNo = Convert.ToString(row["financeBillNo"]);
                }
                if (row["financeBillSort"] != DBNull.Value)
                {
                    model.financeBillSort = Convert.ToString(row["financeBillSort"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model</param>
 public int AddRecord(CSaleDetail_HangHaoData model)
 {
     return this.saleDetail_HangHaoDB.AddRecord(model);
 }