Esempio n. 1
0
        public void ld()
        {
            // chk();
            DateTime dtnow = DateTime.Today;

            ;
            int         cid = Convert.ToInt32(txt_cid.Text);
            Class_sales cs  = new Class_sales();

            cs.add(dtnow, cid);
            try
            {
                conDB.con.Open();

                string        qury = "SELECT OrderID from tbl_Orders where cid='" + cid + "'  ";
                SqlCommand    cmd  = new SqlCommand(qury, conDB.con);
                SqlDataReader dr   = cmd.ExecuteReader();
                while (dr.Read())
                {
                    txt_oid.Text = dr.GetValue(0).ToString();
                }
                cmd.Dispose();
                dr.Dispose();
                cmd.Dispose();
                conDB.con.Close();
                Class_sales ss = new Class_sales();
                int         a  = Convert.ToInt32(txt_oid.Text.ToString());
            }
            catch (SqlException)
            {
                MessageBox.Show(this, "Databasse Error", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void btn_srch_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmb_fnme.Text.Length > 0)
                {
                    errorProvider1.Clear();
                    if (txt_dsno.Text.Length > 0)
                    {
                        if (txt_qty.Text.Length > 0)
                        {
                            errorProvider2.Clear();
                            int flag = 0;

                            DateTime dtnow = DateTime.Today;
                            int      qty   = 0;
                            int      ino   = Convert.ToInt16(txt_ino.Text);
                            int      oid   = Convert.ToInt32(txt_oid.Text);
                            qty = Convert.ToInt32(txt_qty.Text);

                            Class_sales cs = new Class_sales();

                            flag = cs.add(ino, oid, qty, txt_dsno.Text);


                            if (flag > 0)
                            {
                                // MessageBox.Show(this, "Row added", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                PopupNotifier popup = new Tulpep.NotificationWindow.PopupNotifier();
                                popup.Image       = Properties.Resources.Information_Bubble_48;
                                popup.ContentText = "Success";
                                // popup.BodyColor.ToString();
                                popup.Popup();
                            }
                            else
                            {
                                MessageBox.Show(this, "Data not added ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            clear();
                        }
                        else
                        {
                            errorProvider3.SetError(txt_qty, "Quantity Required");
                        }
                    }
                    else
                    {
                        errorProvider2.SetError(txt_dsno, "Please enter design no");
                    }
                }
                else
                {
                    errorProvider1.SetError(cmb_fnme, "Please select customer");
                }



                loadmetro2();

                //  load();
            }
            catch (SqlException)
            {
                MessageBox.Show(this, "Database Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            catch (Exception)
            {
                MessageBox.Show(this, "Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }