private void btnInOrderDetail_Click(object sender, EventArgs e)
        {
            FarmManageDataSet.CowRow Cow = ((this.cowBindingSource.Current as DataRowView).Row as FarmManageDataSet.CowRow);

            if (Convert.ToByte(this.cbxOrderInType.SelectedValue) == 2)
            {
                var form = new AddBornForm();
                form.OrderInID = Cow.OrderInID;
                var result = form.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    this.orderInTableAdapter.FillByCowNO(farmManageDataSet.OrderIn, CowNO);
                }
            }
            else
            {
                var form = new InOrderForm();
                form.OrderInID = Cow.OrderInID;
                var result = form.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    this.orderInTableAdapter.FillByCowNO(farmManageDataSet.OrderIn, CowNO);
                }
            }
        }
        private void CowDetailForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'farmManageDataSet.Stock' table. You can move, or remove it, as needed.
            this.stockTableAdapter.Fill(this.farmManageDataSet.Stock);
            // TODO: This line of code loads data into the 'farmManageDataSet.UsersView' table. You can move, or remove it, as needed.
            this.usersViewTableAdapter.Fill(this.farmManageDataSet.UsersView);
            // TODO: This line of code loads data into the 'farmManageDataSet.Corral' table. You can move, or remove it, as needed.
            this.corralTableAdapter.Fill(this.farmManageDataSet.Corral);
            // TODO: This line of code loads data into the 'farmManageDataSet.Gene' table. You can move, or remove it, as needed.
            this.geneTableAdapter.Fill(this.farmManageDataSet.Gene);
            // TODO: This line of code loads data into the 'farmManageDataSet.DiseaseHistory' table. You can move, or remove it, as needed.
            this.diseaseHistoryTableAdapter.Fill(this.farmManageDataSet.DiseaseHistory);
            // TODO: This line of code loads data into the 'farmManageDataSet.Vaccine' table. You can move, or remove it, as needed.
            this.vaccineTableAdapter.Fill(this.farmManageDataSet.Vaccine);
            // TODO: This line of code loads data into the 'farmManageDataSet.OrderOut' table. You can move, or remove it, as needed.
            this.orderOutTableAdapter.Fill(this.farmManageDataSet.OrderOut);
            // TODO: This line of code loads data into the 'farmManageDataSet.OrderIn' table. You can move, or remove it, as needed.
            this.orderInTableAdapter.Fill(this.farmManageDataSet.OrderIn);
            // TODO: This line of code loads data into the 'farmManageDataSet.Cow' table. You can move, or remove it, as needed.
            this.cowTableAdapter.FillByPK(this.farmManageDataSet.Cow, CowNO);
            // TODO: This line of code loads data into the 'farmManageDataSet.DiseaseHistory' table. You can move, or remove it, as needed.
            this.diseaseHistoryTableAdapter.Fill(this.farmManageDataSet.DiseaseHistory);



            this.userLogUC.FillEvent(TypeUtil.Cow, CowNO);

            FarmManageDataSet.CowRow CowCurrent = ((this.cowBindingSource.Current as DataRowView).Row as FarmManageDataSet.CowRow);
            if (CowCurrent.OrderOutID == -1)
            {
                this.gbxOutOrder.Visible = false;
            }
            else
            {
                this.cbxSex.Enabled               = false;
                this.cbxCorral.Enabled            = false;
                this.cbxGene.Enabled              = false;
                this.tbxCor.ReadOnly              = true;
                this.btnAddMedicine.Enabled       = false;
                this.btnAddVaccineHistory.Enabled = false;
                this.btnSave.Visible              = false;
                this.btnCancel.Text               = "ปิด";
                this.orderOutTableAdapter.FillByCowNO(farmManageDataSet.OrderOut, CowNO);
            }


            if (!MainForm.User.SuperUser)
            {
                this.tcMain.TabPages.Remove(this.tabRecord);
            }
        }