Пример #1
0
 private void search()
 {
     if (textBoxDressId.Text.Length > 0)
     {
         string wd_id    = textBoxDressId.Text.Trim();
         Data   dressIds = ShardDb.getWeddingDressIds(wd_id);
         if (!dressIds.Success)
         {
             this.Close();
             return;
         }
         listBoxIds.DisplayMember = "wd_id";
         listBoxIds.ValueMember   = "wd_id";
         listBoxIds.DataSource    = dressIds.DataTable;
     }
 }
Пример #2
0
        private bool validate()
        {
            if (textBoxId.Text.Trim().Length == 0)
            {
                MessageBox.Show("商品编号不能为空!");
                textBoxId.Focus();
                return(false);
            }
            if (!isUpdate)
            {
                Data dressIds = ShardDb.getWeddingDressIds(textBoxId.Text.Trim());
                if (dressIds.DataTable.Rows.Count > 0)
                {
                    MessageBox.Show("商品编号已存在,请输入新编号!");
                    textBoxId.Focus();
                    return(false);
                }
            }
            decimal price = 0;

            foreach (TextBox textBox in prices)
            {
                if (!decimal.TryParse(textBox.Text.Trim(), out price))
                {
                    MessageBox.Show("商品价格格式错误!");
                    textBox.Focus();
                    return(false);
                }
            }
            decimal settlementPrice = 0;

            if (!decimal.TryParse(textBoxSettlementPrice.Text.Trim(), out settlementPrice))
            {
                MessageBox.Show("商品结算价格格式错误!");
                textBoxPrice.Focus();
                return(false);
            }
            if (pictureBox1.Image == null)
            {
                MessageBox.Show("请至少加入一张图片!");
                pictureBox1.Focus();
                return(false);
            }
            dress.wd_id              = textBoxId.Text.Trim();
            dress.wd_big_category    = wd_big_category.Text.Trim();
            dress.wd_litter_category = wd_litter_category.Text.Trim();
            dress.wd_date            = wd_date.Text.Trim();
            dress.wd_factory         = wd_factory.Text.Trim();
            dress.is_renew           = cb_is_renew.Text.Trim();
            dress.emergency_period   = tb_emergency_period.Text.Trim();
            dress.memo            = memo.Text.Trim();
            dress.normal_period   = tb_normal_period.Text.Trim();
            dress.wd_color        = wd_color.Text.Trim();
            dress.settlementPrice = settlementPrice;
            dress.attribute       = 0;
            foreach (int key in attributes.Keys)
            {
                if (attributes[key].Checked)
                {
                    dress.attribute += key;
                }
            }

            WeddingDressSizeAndCount[] dressInstances = new WeddingDressSizeAndCount[7];
            WeddingDressSizeAndCount   dressInstance  = new WeddingDressSizeAndCount();

            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "XS";
            dressInstance.wd_count        = Convert.ToInt16(tb_xs_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_xs_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_xs_sssj.Text.Trim();
            dressInstances[0]             = dressInstance;

            dressInstance                 = new WeddingDressSizeAndCount();
            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "S";
            dressInstance.wd_count        = Convert.ToInt16(tb_s_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_s_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_s_sssj.Text.Trim();
            dressInstances[1]             = dressInstance;

            dressInstance                 = new WeddingDressSizeAndCount();
            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "M";
            dressInstance.wd_count        = Convert.ToInt16(tb_m_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_m_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_m_sssj.Text.Trim();
            dressInstances[2]             = dressInstance;

            dressInstance                 = new WeddingDressSizeAndCount();
            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "L";
            dressInstance.wd_count        = Convert.ToInt16(tb_l_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_l_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_l_sssj.Text.Trim();
            dressInstances[3]             = dressInstance;

            dressInstance                 = new WeddingDressSizeAndCount();
            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "XL";
            dressInstance.wd_count        = Convert.ToInt16(tb_xl_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_xl_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_xl_sssj.Text.Trim();
            dressInstances[4]             = dressInstance;

            dressInstance                 = new WeddingDressSizeAndCount();
            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "XXL";
            dressInstance.wd_count        = Convert.ToInt16(tb_xxl_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_xxl_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_xxl_sssj.Text.Trim();
            dressInstances[5]             = dressInstance;

            dressInstance                 = new WeddingDressSizeAndCount();
            dressInstance.wd_id           = dress.wd_id;
            dressInstance.wd_size         = "LSDZ";
            dressInstance.wd_count        = Convert.ToInt16(tb_lsdz_sl.Text.Trim());
            dressInstance.wd_price        = decimal.Parse(tb_lsdz_jg.Text.Trim());
            dressInstance.wd_listing_date = dt_lsdz_sssj.Text.Trim();
            dressInstances[6]             = dressInstance;

            dress.wdscs = dressInstances;

            return(true);
        }