示例#1
0
文件: ShardDb.cs 项目: wynet321/aimu
        private static Queue <Statement> generateDressQueue(DressDefinition dress)
        {
            Queue <Statement> sqls = new Queue <Statement>();
            Statement         sql  = new Statement("insert into dressDefinition(wd_id,wd_date,wd_big_category,wd_litter_category,wd_factory,wd_color,memo,emergency_period,normal_period,is_renew,settlementPrice,attribute) values('" + dress.wd_id + "','" + dress.wd_date + "','" + dress.wd_big_category + "','" + dress.wd_litter_category + "','" + dress.wd_factory + "','" + dress.wd_color + "','" + dress.memo + "','" + dress.emergency_period + "','" + dress.normal_period + "','" + dress.is_renew + "'," + dress.settlementPrice.ToString() + "," + dress.attribute + ")");

            sqls.Enqueue(sql);

            for (int i = 0; i < dress.wdscs.Length; i++)
            {
                WeddingDressSizeAndCount wdsc = dress.wdscs[i];
                sql = new Statement("insert into dress(wd_id, wd_size, wd_price,  wd_listing_date, wd_count, storeId) values('" + dress.wd_id + "', '" + wdsc.wd_size + "', '" + wdsc.wd_price + "', '" + wdsc.wd_listing_date + "', " + wdsc.wd_count + ", " + Sharevariables.StoreId + ")");
                sqls.Enqueue(sql);
            }

            for (int i = 1; i <= dress.pictures.Count; i++)
            {
                byte[] image     = dress.pictures[i];
                byte[] thumbnail = dress.thumbnails[i];
                sql     = new Statement();
                sql.Sql = "insert into dressImage(wd_id,pic_id,pic_img,thumbnail) values('" + dress.wd_id + "'," + i + ",@pic_img,@thumbnail)";
                SqlParameter parameter = new SqlParameter("@pic_img", SqlDbType.Image);
                parameter.Value = image;
                List <SqlParameter> parameters = new List <SqlParameter>();
                parameters.Add(parameter);
                parameter       = new SqlParameter("thumbnail", SqlDbType.Image);
                parameter.Value = thumbnail;
                parameters.Add(parameter);
                sql.Paremeters = parameters;
                sqls.Enqueue(sql);
            }
            return(sqls);
        }
示例#2
0
文件: ShardDb.cs 项目: wynet321/aimu
        public static bool UpdateWeddingDress(DressDefinition dress)
        {
            Queue <Statement> sqls = new Queue <Statement>();
            Statement         sql  = new Statement("delete from dressDefinition where wd_id='" + dress.wd_id + "'");

            sqls.Enqueue(sql);
            sql = new Statement("delete from dress where wd_id='" + dress.wd_id + "'");
            sqls.Enqueue(sql);
            sql = new Statement("delete from dressImage where wd_id='" + dress.wd_id + "'");
            sqls.Enqueue(sql);
            Queue <Statement> insertSqls = generateDressQueue(dress);

            while (insertSqls.Count > 0)
            {
                sqls.Enqueue(insertSqls.Dequeue());
            }
            return(shardDb.save(sqls));
        }
示例#3
0
        private void loadDressDefinition(String wd_id)
        {
            Data properties = ShardDb.getDressDefinitionById(wd_id);

            if (!properties.Success)
            {
                this.Close();
                return;
            }
            DressDefinition wdp = new DressDefinition();

            foreach (DataRow dr in properties.DataTable.Rows)
            {
                wdp.wd_id              = wd_id;
                wdp.wd_date            = dr[0] == null ? "" : dr[0].ToString();
                wdp.wd_big_category    = dr[1] == null ? "" : dr[1].ToString();
                wdp.wd_litter_category = dr[2] == null ? "" : dr[2].ToString();
                wdp.wd_factory         = dr[3] == null ? "" : dr[3].ToString();
                wdp.wd_color           = dr[4] == null ? "" : dr[4].ToString();
                wdp.attribute          = Convert.ToInt32(dr[5]);
                wdp.memo             = dr[6] == null ? "" : dr[6].ToString();
                wdp.emergency_period = dr[7] == null ? "" : dr[7].ToString();
                wdp.normal_period    = dr[8] == null ? "" : dr[8].ToString();
                wdp.is_renew         = dr[9] == null ? "" : dr[9].ToString();
                wdp.settlementPrice  = dr[10] == null || dr[10].ToString() == "" ? 0 : decimal.Parse(dr[10].ToString());
            }

            string tmpText = "";

            tmpText += "商品编号: " + wdp.wd_id.Trim() + Environment.NewLine;
            tmpText += "入库日期: " + wdp.wd_date.Trim() + Environment.NewLine;
            tmpText += "商品大类: " + wdp.wd_big_category.Trim() + Environment.NewLine;
            tmpText += "商品小类: " + wdp.wd_litter_category.Trim() + Environment.NewLine;
            tmpText += "厂家: " + wdp.wd_factory.Trim() + Environment.NewLine;
            tmpText += "颜色: " + wdp.wd_color.Trim() + Environment.NewLine;
            tmpText += "紧急工期: " + wdp.emergency_period.Trim() + "天" + Environment.NewLine;
            tmpText += "正常工期: " + wdp.normal_period.Trim() + "天" + Environment.NewLine;
            tmpText += "是否返单: " + wdp.is_renew.Trim() + Environment.NewLine;

            tmpText += "备注: " + wdp.memo.Trim() + Environment.NewLine;

            textBox1.Text = tmpText;
        }
示例#4
0
        private void initial()
        {
            InitializeComponent();
            wd_color.SelectedIndex        = 0;
            wd_big_category.SelectedIndex = 0;
            dress            = new DressDefinition();
            dress.pictures   = new Dictionary <int, byte[]>();
            dress.thumbnails = new Dictionary <int, byte[]>();
            dress.wdscs      = new WeddingDressSizeAndCount[7];
            pictureBoxes.Add(1, pictureBox1);
            pictureBoxes.Add(2, pictureBox2);
            pictureBoxes.Add(3, pictureBox3);
            pictureBoxes.Add(4, pictureBox4);
            pictureBoxes.Add(5, pictureBox5);
            pictureBoxes.Add(6, pictureBox6);
            pictureBoxes.Add(7, pictureBox7);
            pictureBoxes.Add(8, pictureBox8);
            attributes.Add(33554432, cpml_ls);
            attributes.Add(16777216, cpml_ws);
            attributes.Add(8388608, cpml_duan);
            attributes.Add(4194304, cpml_zs);
            attributes.Add(2097152, cpml_other);

            attributes.Add(1048576, cpbx_yw);
            attributes.Add(524288, cpbx_ppq);
            attributes.Add(262144, cpbx_ab);
            attributes.Add(131072, cpbx_dq);
            attributes.Add(65536, cpbx_qdhc);

            attributes.Add(32768, bwcd_qd);
            attributes.Add(16384, bwcd_xtw);
            attributes.Add(8192, bwcd_ztw);
            attributes.Add(4096, bwcd_ctw);
            attributes.Add(2048, bwcd_hhtw);

            attributes.Add(1024, cplx_mx);
            attributes.Add(512, cplx_sv);
            attributes.Add(256, cplx_yzj);
            attributes.Add(128, cplx_dd);
            attributes.Add(64, cplx_dj);
            attributes.Add(32, cplx_gb);
            attributes.Add(16, cplx_yl);
            attributes.Add(8, cplx_ll);

            attributes.Add(4, lxys_bd);
            attributes.Add(2, lxys_ll);
            attributes.Add(1, lxys_lb);

            prices[0] = tb_xs_jg;
            prices[1] = tb_s_jg;
            prices[2] = tb_m_jg;
            prices[3] = tb_l_jg;
            prices[4] = tb_xl_jg;
            prices[5] = tb_xxl_jg;
            prices[6] = tb_lsdz_jg;

            publishDates[0] = dt_xs_sssj;
            publishDates[1] = dt_s_sssj;
            publishDates[2] = dt_m_sssj;
            publishDates[3] = dt_l_sssj;
            publishDates[4] = dt_xl_sssj;
            publishDates[5] = dt_xxl_sssj;
            publishDates[6] = dt_lsdz_sssj;

            counts[0] = tb_xs_sl;
            counts[1] = tb_s_sl;
            counts[2] = tb_m_sl;
            counts[3] = tb_l_sl;
            counts[4] = tb_xl_sl;
            counts[5] = tb_xxl_sl;
            counts[6] = tb_lsdz_sl;
        }
示例#5
0
文件: ShardDb.cs 项目: wynet321/aimu
        public static bool InsertWeddingDress(DressDefinition dress)
        {
            Queue <Statement> sqls = generateDressQueue(dress);

            return(shardDb.save(sqls));
        }