Esempio n. 1
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;
        }
Esempio n. 2
0
        private void retrieve(string wd_id)
        {
            Data dressProperties = ShardDb.getDressDefinitionById(wd_id);

            if (!dressProperties.Success)
            {
                this.Close();
                return;
            }
            DataRow row = dressProperties.DataTable.Rows[0];

            dress.wd_id              = wd_id;
            dress.wd_date            = row.ItemArray[0].ToString();
            dress.wd_big_category    = row.ItemArray[1].ToString();
            dress.wd_litter_category = row.ItemArray[2].ToString();
            dress.wd_factory         = row.ItemArray[3].ToString();
            dress.wd_color           = row.ItemArray[4].ToString();
            dress.attribute          = Convert.ToInt32(row.ItemArray[5]);
            dress.memo             = row.ItemArray[6].ToString();
            dress.emergency_period = row.ItemArray[7].ToString();
            dress.normal_period    = row.ItemArray[8].ToString();
            dress.is_renew         = row.ItemArray[9].ToString();
            dress.settlementPrice  = (row.ItemArray[10] == DBNull.Value) ? 0 : decimal.Parse(row.ItemArray[10].ToString());

            Data dressSizeAndNumbers = ShardDb.getDressById(wd_id);

            if (!dressProperties.Success)
            {
                this.Close();
                return;
            }
            WeddingDressSizeAndCount[] wdscs = new WeddingDressSizeAndCount[7];
            DataRowCollection          rows  = dressSizeAndNumbers.DataTable.Rows;

            for (int i = 0; i < rows.Count; i++)
            {
                WeddingDressSizeAndCount wdsc = new WeddingDressSizeAndCount();
                wdsc.wd_id           = wd_id;
                wdsc.id              = rows[i].ItemArray[0].ToString();
                wdsc.wd_size         = rows[i].ItemArray[1].ToString();
                wdsc.wd_price        = decimal.Parse(rows[i].ItemArray[2].ToString());
                wdsc.wd_listing_date = rows[i].ItemArray[3].ToString();
                wdsc.wd_count        = Convert.ToInt16(rows[i].ItemArray[4]);
                wdsc.store_id        = Convert.ToInt16(rows[i].ItemArray[5]);
                wdscs[i]             = wdsc;
            }
            dress.wdscs = wdscs;

            Data imagedata = ShardDb.getImagesByDressId(wd_id);

            if (!dressProperties.Success)
            {
                this.Close();
                return;
            }
            Dictionary <int, byte[]> pictures   = new Dictionary <int, byte[]>();
            Dictionary <int, byte[]> thumbnails = new Dictionary <int, byte[]>();

            foreach (DataRow dataRow in imagedata.DataTable.Rows)
            {
                pictures.Add(Convert.ToInt16(dataRow.ItemArray[1]), (byte[])dataRow.ItemArray[2]);
                thumbnails.Add(Convert.ToInt16(dataRow.ItemArray[1]), (byte[])dataRow.ItemArray[3]);
            }
            dress.pictures   = pictures;
            dress.thumbnails = thumbnails;

            //show to controls
            textBoxId.Text                  = dress.wd_id;
            wd_date.Value                   = DateTime.Parse(dress.wd_date);
            wd_color.SelectedItem           = dress.wd_color;
            wd_factory.SelectedItem         = dress.wd_factory;
            wd_big_category.SelectedItem    = dress.wd_big_category;
            wd_litter_category.SelectedItem = dress.wd_litter_category;
            cb_is_renew.SelectedItem        = dress.is_renew;
            tb_normal_period.Text           = dress.normal_period;
            tb_emergency_period.Text        = dress.emergency_period;
            memo.Text = dress.memo;
            textBoxSettlementPrice.Text = dress.settlementPrice.ToString();
            textBoxPrice.Text           = "";
            foreach (int key in attributes.Keys)
            {
                if ((key & dress.attribute) != 0)
                {
                    attributes[key].Checked = true;
                }
            }
            for (int i = 0; i < 7; i++)
            {
                WeddingDressSizeAndCount dressInstance = dress.wdscs[i];
                prices[i].Text        = dressInstance.wd_price.ToString();
                publishDates[i].Value = DateTime.Parse(dressInstance.wd_listing_date);
                counts[i].Text        = dressInstance.wd_count.ToString();
            }

            showThumbnail();
        }