private void BtnAdd_Click(object sender, System.EventArgs e)
        {
            var frm = new Form_ReceiveAddEdit();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                LoadReceive();
            }
        }
        private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView senderGrid = (DataGridView)sender;
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    string receiveNo = gv.Rows[e.RowIndex].Cells[4].Value.ToString();

                    switch (senderGrid.Columns[e.ColumnIndex].Name)
                    {
                    case "Edit":
                        var frm = new Form_ReceiveAddEdit
                        {
                            receiveNo = receiveNo
                        };
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            LoadReceive();
                        }
                        break;

                    case "colSwineReport":
                        var frmSwineReport = new Form_ReportSwineReceiveByQueue
                        {
                            ReceiveNo = receiveNo
                        };
                        frmSwineReport.ShowDialog();
                        break;

                    case "colCarcassReport":
                        var frmCarcassReport = new Form_ReportCarcassReceiveByQueue
                        {
                            ReceiveNo = receiveNo
                        };
                        frmCarcassReport.Show();
                        break;

                    case "CloseFlag":
                        var receivedFlag = ReceiveController.GetReceiveFlag(receiveNo);
                        switch (receivedFlag)
                        {
                        case 1:
                            if (MessageBox.Show("ต้องการ ปิดคิว การรับ Yes/No?", "ยืนยัน", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                            {
                                return;
                            }
                            ReceiveController.CloseFlagSwineReceive(receiveNo, "system");
                            break;

                        case 2:
                            if (MessageBox.Show("ต้องการ ยกเลิกปิดคิว การรับ Yes/No?", "ยืนยัน", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                            {
                                return;
                            }
                            ReceiveController.ReverseCloseFlagSwineReceive(receiveNo);
                            break;
                        }
                        MessageBox.Show("บันทึกข้อมูล เรียบร้อยแล้ว", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadReceive();

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