Exemplo n.º 1
0
        private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (e.ColumnIndex == dtGrid.Columns["Select"].Index && e.RowIndex >= 0)
            {
                if (selectedIDs.Contains(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()))
                {
                    selectedIDs.Remove(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                }
                else
                {
                    selectedIDs.Add(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["View"].Index && e.RowIndex >= 0)
            {
                using (NewCase form = new NewCase(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()))
                {
                    DialogResult dr = form.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        //LoadData();
                    }
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["Order Intake"].Index && e.RowIndex >= 0)
            {
                using (OrderIntakeForm form = new OrderIntakeForm(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()))
                {
                    DialogResult dr = form.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        //LoadData();
                    }
                }
            }

            try
            {
                if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0)
                {
                    if (MessageBox.Show("YES or No?", "Are you sure you want to delete this Order? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        string Query = "DELETE from orders WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString() + "'";
                        MySQL.Query(Query);

                        Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(MySQL.Insert(Query)), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(q);
                        MessageBox.Show("Information deleted");
                        LoadData();
                    }
                }
            }
            catch { }
        }
Exemplo n.º 2
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            OrderIntakeForm o = new OrderIntakeForm("");

            o.Show();
        }
Exemplo n.º 3
0
        private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (e.ColumnIndex == dtGrid.Columns["Select"].Index && e.RowIndex >= 0)
            {
                dtGrid.CurrentCell.Value = dtGrid.CurrentCell.FormattedValue.ToString() == "True" ? false : true;
                dtGrid.RefreshEdit();
                if (selectedIDs.Contains(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()))
                {
                    selectedIDs.Remove(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString());
                }
                else
                {
                    selectedIDs.Add(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString());
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["View"].Index && e.RowIndex >= 0)
            {
                using (OrderIntakeForm form = new OrderIntakeForm(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()))
                {
                    DialogResult dr = form.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        LoadData();
                    }
                }
            }
            //CertificateInputForm
            if (e.ColumnIndex == dtGrid.Columns["Instructions"].Index && e.RowIndex >= 0)
            {
                string exists = "";
                try
                {
                    exists = MySQL.value("SELECT no FROM instruction WHERE no  = '" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'");
                }
                catch (Exception y)
                {
                    exists = "";
                }
                if (!string.IsNullOrEmpty(exists))
                {
                    if (MessageBox.Show("YES or No?", "Instruction Delivery form exist would you like to load it  ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        using (InstructionDeliveryForm form = new InstructionDeliveryForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                        {
                            DialogResult dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                LoadData();
                            }
                        }
                    }
                    else
                    {
                        using (InstructionDeliveryForm form = new InstructionDeliveryForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                        {
                            DialogResult dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                LoadData();
                            }
                        }
                    }
                }
                else
                {
                    using (InstructionDeliveryForm form = new InstructionDeliveryForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                    {
                        DialogResult dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            LoadData();
                        }
                    }
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["CMN"].Index && e.RowIndex >= 0)
            {
                string exists = "";
                try
                {
                    exists = MySQL.value("SELECT no FROM certificate WHERE no  = '" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'");
                }
                catch (Exception y)
                {
                    //MessageBox.Show( y.Message + noTxt.Text);
                    exists = "";
                }
                if (!string.IsNullOrEmpty(exists))
                {
                    if (MessageBox.Show("YES or No?", "CMN exists would you like to load it  ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        using (CertificateInputForm form = new CertificateInputForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                        {
                            DialogResult dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                //LoadData();
                            }
                        }
                    }
                    else
                    {
                        using (CertificateInputForm form = new CertificateInputForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                        {
                            DialogResult dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                //LoadData();
                            }
                        }
                    }
                }
                else
                {
                    using (CertificateInputForm form = new CertificateInputForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                    {
                        DialogResult dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            //LoadData();
                        }
                    }
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["Delivery"].Index && e.RowIndex >= 0)
            {
                string exists = "";
                try
                {
                    exists = MySQL.value("SELECT no FROM delivery WHERE no  = '" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'");
                }
                catch (Exception y)
                {
                    exists = "";
                }
                if (!string.IsNullOrEmpty(exists))
                {
                    if (MessageBox.Show("YES or No?", "Order Delivery exists would you like to load it  ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        using (DeliveryPickupForm form = new DeliveryPickupForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                        {
                            DialogResult dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                LoadData();
                            }
                        }
                    }
                    else
                    {
                        using (DeliveryPickupForm form = new DeliveryPickupForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                        {
                            DialogResult dr = form.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                LoadData();
                            }
                        }
                    }
                }
                else
                {
                    using (DeliveryPickupForm form = new DeliveryPickupForm(dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString()))
                    {
                        DialogResult dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            LoadData();
                        }
                    }
                }
            }
            try
            {
                try
                {
                    if (Convert.ToInt32(Helper.Level) < 5)
                    {
                        MessageBox.Show("Access Denied !");
                        return;
                    }
                }
                catch (Exception c)
                {
                    //MessageBox.Show(c.Message.ToString());
                    Helper.Exceptions(c.Message, "Access level error ");
                    //MessageBox.Show("You have an invalid entry !");
                    return;
                }
                if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0)
                {
                    if (MessageBox.Show("YES or No?", "Are you sure you want to delete this Order? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        string Query = "DELETE from orders WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'";
                        MySQL.Query(Query);
                        Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(q);
                        string Query2 = "DELETE from casetransaction WHERE no ='" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'";
                        MySQL.Query(Query2);
                        Queries qa = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query2), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(qa);

                        string Query3 = "DELETE from certificate WHERE no ='" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'";
                        MySQL.Query(Query3);
                        Queries qas = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query3), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(qas);

                        string Query4 = "DELETE from delivery WHERE no ='" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'";
                        MySQL.Query(Query4);
                        Queries qa1 = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query4), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(qa1);

                        string Query5 = "DELETE from invoice WHERE no ='" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'";
                        MySQL.Query(Query5);
                        Queries qa2 = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query5), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(qa2);

                        string Query6 = "DELETE from instruction WHERE no ='" + dtGrid.Rows[e.RowIndex].Cells["no"].Value.ToString() + "'";
                        MySQL.Query(Query6);
                        Queries qa3 = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(Query6), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(qa3);


                        MessageBox.Show("Information deleted");
                        Helper.Log(Helper.UserName, "Deleted order " + dtGrid.Rows[e.RowIndex].Cells["no"] + "  " + DateTime.Now);
                        LoadData();
                    }
                }
            }
            catch { }
        }
Exemplo n.º 4
0
        private void Shifts_Click(object sender, EventArgs e)
        {
            OrderIntakeForm f = new OrderIntakeForm(null);

            f.Show();
        }
Exemplo n.º 5
0
        private void orderIntakeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OrderIntakeForm f = new OrderIntakeForm(null);

            f.Show();
        }