示例#1
0
        private void tblSales_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int rw = e.RowIndex;
            int cl = e.ColumnIndex;

            if (Convert.ToString(tblSales.Rows[rw].Cells[0].Value) == string.Empty)
            {
                return;
            }
            int saleID = Convert.ToInt32(tblSales.Rows[rw].Cells[0].Value.ToString());


            if (cl == 5)
            {
                foreach (Form form in Application.OpenForms)
                {
                    if (form.GetType().Name == "View_Sales_Return_Products")
                    {
                        MetroMessageBox.Show(this, "Form is already opened", "System Message!", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        return;
                    }
                }

                sid = saleID;
                View_Sales_Return_Products vsd = new View_Sales_Return_Products(sid);

                vsd.Show();
            }

            else if (cl == 7)
            {
                int       sidd      = Convert.ToInt32(tblSales.Rows[rw].Cells[0].Value.ToString());
                string    custNames = tblSales.Rows[rw].Cells[1].Value.ToString();
                BillPrint bl        = new BillPrint(sidd, custNames, "Not Applicatble");
                bl.Show();
            }
        }
示例#2
0
        private void tblSales_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                int rw = e.RowIndex;
                int cl = e.ColumnIndex;
                if (Convert.ToString(tblSales.Rows[rw].Cells[0].Value) == string.Empty)
                {
                    return;
                }
                int saleID = Convert.ToInt32(tblSales.Rows[rw].Cells[0].Value.ToString());


                if (cl == 6)
                {
                    foreach (Form form in Application.OpenForms)
                    {
                        if (form.GetType().Name == "View_Sales_Product")
                        {
                            MetroMessageBox.Show(this, "Form is already opened", "System Message!", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                            return;
                        }
                    }

                    sid = saleID;
                    View_Sales_Product vsd = new View_Sales_Product(sid);

                    vsd.Show();
                }

                else if (cl == 7)
                {
                    int       sidd      = Convert.ToInt32(tblSales.Rows[rw].Cells[0].Value.ToString());
                    string    custNames = tblSales.Rows[rw].Cells[1].Value.ToString();
                    BillPrint bl        = new BillPrint(sidd, custNames, "Not Applicatble");
                    bl.Show();
                }
                else if (cl == 1)
                {
                    foreach (Form form in Application.OpenForms)
                    {
                        if (form.GetType().Name == "V_Customer")
                        {
                            MetroMessageBox.Show(this, "Form is already opened", "System Message!", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                            return;
                        }
                    }

                    int cid = Convert.ToInt32(tblSales.Rows[rw].Cells[0].Value.ToString());
                    //Customer cust=new Customer ();
                    //int cid =cust.getIdByName(custName, con);
                    using (V_Customer ms = new V_Customer(cid))
                    {
                        ms.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "! System Error. " + ex.Message, "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }