Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Hownet.Model.AmountInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update AmountInfo set ");
            strSql.Append("MainID=@MainID,");
            strSql.Append("TableTypeID=@TableTypeID,");
            strSql.Append("ColorID=@ColorID,");
            strSql.Append("ColorOneID=@ColorOneID,");
            strSql.Append("ColorTwoID=@ColorTwoID,");
            strSql.Append("SizeID=@SizeID,");
            strSql.Append("MListID=@MListID,");
            strSql.Append("Amount=@Amount,");
            strSql.Append("NotAmount=@NotAmount,");
            strSql.Append("NotDepAmount=@NotDepAmount,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",           SqlDbType.Int,      4),
                new SqlParameter("@MainID",       SqlDbType.Int,      4),
                new SqlParameter("@TableTypeID",  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("@MListID",      SqlDbType.Int,      4),
                new SqlParameter("@Amount",       SqlDbType.Int,      4),
                new SqlParameter("@NotAmount",    SqlDbType.Int,      4),
                new SqlParameter("@NotDepAmount", SqlDbType.Int,      4),
                new SqlParameter("@Remark",       SqlDbType.NVarChar, 500)
            };
            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.MainID;
            parameters[2].Value  = model.TableTypeID;
            parameters[3].Value  = model.ColorID;
            parameters[4].Value  = model.ColorOneID;
            parameters[5].Value  = model.ColorTwoID;
            parameters[6].Value  = model.SizeID;
            parameters[7].Value  = model.MListID;
            parameters[8].Value  = model.Amount;
            parameters[9].Value  = model.NotAmount;
            parameters[10].Value = model.NotDepAmount;
            parameters[11].Value = model.Remark;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hownet.Model.AmountInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AmountInfo(");
            strSql.Append("MainID,TableTypeID,ColorID,ColorOneID,ColorTwoID,SizeID,MListID,Amount,NotAmount,NotDepAmount,Remark)");
            strSql.Append(" values (");
            strSql.Append("@MainID,@TableTypeID,@ColorID,@ColorOneID,@ColorTwoID,@SizeID,@MListID,@Amount,@NotAmount,@NotDepAmount,@Remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MainID",       SqlDbType.Int,      4),
                new SqlParameter("@TableTypeID",  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("@MListID",      SqlDbType.Int,      4),
                new SqlParameter("@Amount",       SqlDbType.Int,      4),
                new SqlParameter("@NotAmount",    SqlDbType.Int,      4),
                new SqlParameter("@NotDepAmount", SqlDbType.Int,      4),
                new SqlParameter("@Remark",       SqlDbType.NVarChar, 500)
            };
            parameters[0].Value  = model.MainID;
            parameters[1].Value  = model.TableTypeID;
            parameters[2].Value  = model.ColorID;
            parameters[3].Value  = model.ColorOneID;
            parameters[4].Value  = model.ColorTwoID;
            parameters[5].Value  = model.SizeID;
            parameters[6].Value  = model.MListID;
            parameters[7].Value  = model.Amount;
            parameters[8].Value  = model.NotAmount;
            parameters[9].Value  = model.NotDepAmount;
            parameters[10].Value = model.Remark;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #3
0
        public static DataTable ShowPSInfo(int PSOID, int TableTypeID)
        {
            string bllAI = "Hownet.BLL.ProduceSellInfo";

            Hownet.Model.AmountInfo modAI = new Hownet.Model.AmountInfo();

            DataTable dtInfo = new DataTable();

            //  if(AmountTypeID<4)
            dtInfo = BasicClass.GetDataSet.GetDS(bllAI, "GetList", new object[] { "(PSOID=" + PSOID + ")" }).Tables[0];

            DataTable dtColor = BasicClass.GetDataSet.GetDS(bllAI, "GetSumColor", new object[] { PSOID }).Tables[0];
            DataTable dtSize  = BasicClass.GetDataSet.GetDS(bllAI, "GetSize", new object[] { PSOID }).Tables[0];
            DataTable dt      = new DataTable();

            dt.Columns.Add("Color", typeof(string));
            dt.Rows.Add(dt.NewRow());
            dt.Rows[0]["Color"] = "颜色\\尺码";
            int       i            = 1;
            ArrayList ColorList    = new ArrayList();
            ArrayList SizeList     = new ArrayList();
            ArrayList ColorOneList = new ArrayList();
            ArrayList ColorTwoList = new ArrayList();

            ColorList.Clear();
            ColorOneList.Clear();
            ColorTwoList.Clear();
            SizeList.Clear();
            ColorList.Add(0);
            SizeList.Add(0);
            ColorOneList.Add(0);
            ColorTwoList.Add(0);
            for (int n = 0; n < dtSize.Rows.Count; n++)
            {
                dt.Columns.Add("Columns" + i);
                dt.Rows[0][i] = dtSize.Rows[n]["SizeName"].ToString();
                SizeList.Add(int.Parse(dtSize.Rows[n]["SizeID"].ToString()));
                i++;
            }
            for (int c = dt.Columns.Count; c < 13; c++)
            {
                dt.Columns.Add("Columns" + c);
            }
            dt.Columns.Add("SumNum");
            dt.Rows[0]["SumNum"] = "合计";
            dt.Columns.Add("ColorOne", typeof(string));
            dt.Columns.Add("ColorTwo", typeof(string));
            dt.Columns.Add("MainID", typeof(int));
            dt.Rows[0]["ColorOne"] = "位置颜色一";
            dt.Rows[0]["ColorTwo"] = "位置颜色二";
            dt.Rows[0]["MainID"]   = PSOID;
            i = 1;
            for (int n = 0; n < dtColor.Rows.Count; n++)
            {
                dt.Rows.Add(dt.NewRow());
                dt.Rows[i][0] = dtColor.Rows[n]["ColorName"].ToString();
                dt.Rows[i][dt.Columns.Count - 3] = dtColor.Rows[n]["ColorOneName"].ToString();
                dt.Rows[i][dt.Columns.Count - 2] = dtColor.Rows[n]["ColorTwoName"].ToString();
                dt.Rows[i]["MainID"]             = PSOID;
                ColorList.Add(int.Parse(dtColor.Rows[n]["ColorID"].ToString()));
                ColorOneList.Add(int.Parse(dtColor.Rows[n]["ColorOneID"].ToString()));
                ColorTwoList.Add(int.Parse(dtColor.Rows[n]["ColorTwoID"].ToString()));
                i++;
            }
            for (int r = 1; r < SizeList.Count; r++)
            {
                modAI.SizeID = int.Parse(SizeList[r].ToString());
                for (int c = 1; c < ColorList.Count; c++)
                {
                    modAI.ColorID    = int.Parse(ColorList[c].ToString());
                    modAI.ColorOneID = int.Parse(ColorOneList[c].ToString());
                    modAI.ColorTwoID = int.Parse(ColorTwoList[c].ToString());
                    modAI.MainID     = PSOID;
                    string    sql = "(SizeID=" + modAI.SizeID + ") and (ColorID=" + modAI.ColorID + ") and (ColorOneID=" + modAI.ColorOneID + ") and (ColorTwoID=" + modAI.ColorTwoID + ")";
                    DataRow[] drs = dtInfo.Select(sql);
                    if (drs.Length > 0)
                    {
                        dt.Rows[c][r] = drs[0]["Amount"];
                    }
                }
            }
            return(dt);
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hownet.Model.AmountInfo GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,MainID,TableTypeID,ColorID,ColorOneID,ColorTwoID,SizeID,MListID,Amount,NotAmount,NotDepAmount,Remark from AmountInfo ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Hownet.Model.AmountInfo model = new Hownet.Model.AmountInfo();
            DataSet ds = DbHelperSQL.Query(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());
                }
                if (ds.Tables[0].Rows[0]["MainID"].ToString() != "")
                {
                    model.MainID = int.Parse(ds.Tables[0].Rows[0]["MainID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TableTypeID"].ToString() != "")
                {
                    model.TableTypeID = int.Parse(ds.Tables[0].Rows[0]["TableTypeID"].ToString());
                }
                if (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"].ToString() != "")
                {
                    model.ColorOneID = int.Parse(ds.Tables[0].Rows[0]["ColorOneID"].ToString());
                }
                if (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"].ToString() != "")
                {
                    model.SizeID = int.Parse(ds.Tables[0].Rows[0]["SizeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MListID"].ToString() != "")
                {
                    model.MListID = int.Parse(ds.Tables[0].Rows[0]["MListID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Amount"].ToString() != "")
                {
                    model.Amount = int.Parse(ds.Tables[0].Rows[0]["Amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NotAmount"].ToString() != "")
                {
                    model.NotAmount = int.Parse(ds.Tables[0].Rows[0]["NotAmount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NotDepAmount"].ToString() != "")
                {
                    model.NotDepAmount = int.Parse(ds.Tables[0].Rows[0]["NotDepAmount"].ToString());
                }
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                model.A      = 1;
                return(model);
            }
            else
            {
                return(null);
            }
        }