Ejemplo n.º 1
0
        private void txtcount_KeyDown(object sender, KeyEventArgs e)
        {
            TextBox t1 = sender as TextBox;

            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    if (Convert.ToDouble(txtcount.Text) > 0)
                    {
                        d1.ExecuteQuery(String.Format("UPDATE tbl_product SET sCount = {0} WHERE sID = {1}", txtcount.Text, t1.Tag.ToString()));
                        frmToast to1 = new frmToast();
                        to1.setComment = "عمليات با موفقيت انجام شد";
                        to1.Show();
                    }
                    else
                    {
                        MessageBox.Show("لطفا تعداد کالا را بيشتر از صفر بدهيد", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtcount.Text = "0";
                        txtcount.Focus();
                        return;
                    }
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("لطفا تعداد کالا را بيشتر از صفر بدهيد", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtcount.Text = "0";
                    txtcount.Focus();
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        private void mnudelete_Click(object sender, EventArgs e)
        {
            db1.DeleteRecord("sID", id, "tbl_factor");
            db1.DeleteRecord("sFactorID", id, "tbl_factorlist");
            dg1.Rows.RemoveAt(rowIndex);
            frmToast t1 = new frmToast();

            t1.setComment = "فاکتور انتخاب شده حذف شد";
            t1.Show();
        }
        private void imgdelete_Click(object sender, EventArgs e)
        {
            PictureBox pic1;

            pic1 = sender as PictureBox;
            frmItem u1 = pic1.Tag as frmItem;

            if (MessageBox.Show("آيا مايل به حذف اين کالا هستيد؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                d1.DeleteRecord("sID", u1.Tag.ToString());
                myLibrary.currentParent.Controls.Remove(u1);
                frmToast t1 = new frmToast();
                t1.setComment = "کالاي انتخاب شده حذف شد و از انبار کالا خارج شد";
                t1.Show();
            }
        }
        private void imgdelete_Click(object sender, EventArgs e)
        {
            PictureBox pic1;

            pic1 = sender as PictureBox;
            frmFactorItem u1 = pic1.Tag as frmFactorItem;

            if (MessageBox.Show("آيا مايل به حذف اين کالا هستيد؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                UC.factor f1 = myLibrary.Currentfactor;
                f1.changeTotal(myLibrary.factorList.getPriceID(u1.Tag.ToString()));
                myLibrary.currentParent.Controls.Remove(u1);
                myLibrary.factorList.RemoveProduct(u1.Tag.ToString());
                frmToast t1 = new frmToast();
                t1.setComment = "کالاي مورد نظر از ليست فاکتور خارج شد";
                t1.Show();
            }
        }
Ejemplo n.º 5
0
        private void btninsert_Click(object sender, EventArgs e)
        {
            try
            {
                long c1 = Convert.ToInt64(txtcode.Text);
                if (existCode() == false)
                {
                    picode.Image   = Factor.Properties.Resources.correct;
                    picode.Visible = true;
                }
                else
                {
                    return;
                }
            }
            catch (Exception)
            {
                picode.Image   = Factor.Properties.Resources.incorrect;
                picode.Visible = true;
                return;
            }

            if (txtname.Text.Trim().Length < 2)
            {
                picname.Visible = true;
                picname.Image   = Factor.Properties.Resources.incorrect;
                return;
            }
            else
            {
                picname.Image   = Factor.Properties.Resources.correct;
                picname.Visible = true;
            }
            try
            {
                long i = Convert.ToInt64(txtcount.Text);
                piccount.Image   = Factor.Properties.Resources.correct;
                piccount.Visible = true;
            }
            catch (Exception)
            {
                piccount.Image   = Factor.Properties.Resources.incorrect;
                piccount.Visible = true;
                return;
            }

            try
            {
                double i = Convert.ToUInt64(txtprice.Text.Replace(",", ""));
                picprice.Image   = Factor.Properties.Resources.correct;
                picprice.Visible = true;
            }
            catch (Exception)
            {
                picprice.Image   = Factor.Properties.Resources.incorrect;
                picprice.Visible = true;
                return;
            }

            if (d1.RecordCount("sName", txtname.Text) == 0)
            {
                d1.NewProduct(txtname.Text, txtcount.Text.Replace(",", ""), txtprice.Text.Replace(",", ""), txtcode.Text);
                frmToast t1 = new frmToast();
                t1.setComment = "کالاي جديد با موفقيت در انبار ذخيره شد";
                t1.Show();
            }
            else
            {
                if (MessageBox.Show("اين کالا قبلا در انبار وجود داشته است\r\nآيا مايل به اضافه کردن موجودي و اعمال تغيرات هستيد?", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    d1.ModifyProduct(txtcount.Text, txtprice.Text.Replace(",", ""), txtname.Text);
                    MessageBox.Show("موجودي انبار تغيير داده شد", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            txtname.Text     = txtprice.Text = txtcount.Text = txtcode.Text = "";
            piccount.Visible = false;
            picname.Visible  = false;
            picprice.Visible = false;
            picode.Visible   = false;
            txtname.Focus();
            frmToast Toast = new frmToast();

            Toast.setComment = "کالا به انبار اضافه شد";
            Toast.Show();
        }