Пример #1
0
        public regCount(Global g,itemBook it)
        {
            this.g = g;
            this.it = it;
            InitializeComponent();
            it.Compare();
            string[] buffCount =   it.count.Split('.');

            try
            {
                this.textBox1.Text = buffCount[0];
            }
            catch (Exception) { }

            if (it.mes == "1")
            {
                label5.Text = "(Весовой)";
                textBox2.Enabled = true;

                try
                {
                    this.textBox2.Text = buffCount[1];
                }
                catch (Exception) { }
            }
            else
            {
                label5.Text = "(Штучный)";
                textBox2.Enabled = false;
            }

            label4.Text = it.title;
        }
Пример #2
0
        public tsdEdit(Global g, itemBook item,string w)
        {
            this.g = g;
            this.item = item;

            InitializeComponent();

            if (item == null)
            {
                this.Close();
            }
            else
            {
                LoadData();
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Сохранить введенные данные?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (dialogResult == DialogResult.Yes)
            {

                if (this.tBarcode.Text.Trim().Length > 0)
                {
                    ////////////////////////////////
                    DataTable data = g.db.FetchAllSql("SELECT id FROM book WHERE barcode = '" + this.tBarcode.Text + "'");
                    foreach (DataRow dr in data.Rows)
                    {
                        g.db.FetchAllSql("UPDATE book SET count1 = REPLACE (count1, ',', '.') + '" + this.tCount0.Text.Replace(',', '.') + "' WHERE id = " + dr[0].ToString() + "");

                        this.Close();
                        return;
                    }
                }

                double count0 = 0;
                double count1 = 0;

                #region count0
                if (this.tCount0.Text.Trim() != "")
                {
                    try
                    {
                        count0 = double.Parse(this.tCount0.Text.Replace(',', '.'), System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Введеные данные имеют неверный формат (Поле кол-ва)"); return;
                    }
                }
                #endregion

                #region count1
                if (this.tCount1.Text.Trim() != "")
                {
                    try
                    {
                        count1 = double.Parse(this.tCount1.Text.Replace(',', '.'), System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Введеные данные имеют неверный формат (Поле учета)"); return;
                    }
                }
                #endregion

                itemBook item = new itemBook(g);

                item.barcode = this.tBarcode.Text;
                item.title = this.tTitle.Text;
                item.code = this.tCode.Text;
                item.art = this.tArt.Text;
                item.plu = this.tPlu.Text;
                item.mes = this.tType.SelectedIndex.ToString();
                item.prise = this.tPrice.Text;
                item.cId = "";
                item.count0 = count0.ToString();
                item.count1 = count1.ToString();

                item.CompareTsd();

                item.Insert();

                this.Close();
            }
        }