private void loadDress(String wd_id) { Data dressProperties = ShardDb.getDressById(wd_id); if (!dressProperties.Success) { this.Close(); return; } dataGridViewDress.DataSource = dressProperties.DataTable; dataGridViewDress.Columns["wd_size"].HeaderText = "尺寸"; dataGridViewDress.Columns["wd_price"].HeaderText = "吊牌价格"; dataGridViewDress.Columns["wd_listing_date"].HeaderText = "上市日期"; dataGridViewDress.Columns["wd_count"].HeaderText = "数量"; dataGridViewDress.Columns["storeId"].Visible = false; dataGridViewDress.Columns["id"].Visible = false; }
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(); }