Exemplo n.º 1
0
        private void btn_packing_Click(object sender, EventArgs e)
        {
            Public.door_id = "";
            packing_report packing = new packing_report();

            packing.Show();
        }
Exemplo n.º 2
0
        private void grid_packing_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == grid_packing.Columns["btn_print"].Index && e.RowIndex >= 0)
            {
                try
                {
                    int i = e.RowIndex;

                    Public.door_id = dt_packing.Rows[i][0].ToString();
                    packing_report packing = new packing_report();
                    packing.Show();
                }
                catch
                {
                }
            }
            if (e.ColumnIndex == grid_packing.Columns["btn_packing_note"].Index && e.RowIndex >= 0)
            {
                try
                {
                    int i = e.RowIndex;

                    Public.note_id         = dt_packing.Rows[i][0].ToString();
                    Public.note_department = "Packing";
                    allocation_note note_menu = new allocation_note();

                    note_menu.Show();
                }
                catch
                {
                }
            }

            else if (e.ColumnIndex == grid_packing.Columns["btn_taken_packing"].Index && e.RowIndex >= 0)
            {
                try
                {
                    int    i       = e.RowIndex;
                    string date    = dt_packing.Rows[i][4].ToString();
                    string door_id = dt_packing.Rows[i][0].ToString();
                    if (date != "")
                    {
                        DialogResult complete = MessageBox.Show("That Door is already taken, Mark as Paused?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (complete == DialogResult.Yes)
                        {
                            if (Public.order_database != null && Public.order_database.State == ConnectionState.Closed)
                            {
                                Public.order_database.Open();
                            }
                            SqlCommand mark_paused_packing    = new SqlCommand(Public.mark_paused_packing, Public.order_database);
                            SqlCommand insert_stopped_packing = new SqlCommand(Public.insert_stopped_packing, Public.order_database);
                            mark_paused_packing.Parameters.AddWithValue("@door_id", door_id);
                            insert_stopped_packing.Parameters.AddWithValue("@staff_id", cmb_search.SelectedValue);
                            insert_stopped_packing.Parameters.AddWithValue("@door_id", door_id);
                            insert_stopped_packing.Parameters.AddWithValue("@date", DateTime.Now);
                            mark_paused_packing.ExecuteNonQuery();
                            insert_stopped_packing.ExecuteNonQuery();
                            Public.order_database.Close();
                            pct_search_Click(sender, e);
                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                    SqlCommand insert_started_packing = new SqlCommand(Public.insert_started_packing, Public.order_database);
                    SqlCommand mark_taken             = new SqlCommand(Public.mark_taken_packing, Public.order_database);
                    if (Public.order_database != null && Public.order_database.State == ConnectionState.Closed)
                    {
                        Public.order_database.Open();
                    }
                    mark_taken.Parameters.AddWithValue("@date", DateTime.Now);
                    mark_taken.Parameters.AddWithValue("@door_id", door_id);
                    insert_started_packing.Parameters.AddWithValue("@staff_id", cmb_search.SelectedValue);
                    insert_started_packing.Parameters.AddWithValue("@door_id", door_id);
                    insert_started_packing.Parameters.AddWithValue("@date", DateTime.Now);
                    insert_started_packing.ExecuteNonQuery();
                    mark_taken.ExecuteNonQuery();
                    MessageBox.Show("Door " + door_id + " Marked as taken", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Public.order_database.Close();
                    pct_search_Click(sender, e);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    if (Public.order_database != null && Public.order_database.State == ConnectionState.Open)
                    {
                        Public.order_database.Close();
                    }
                }
            }
        }