コード例 #1
0
        /*   private void dGV_PetProfile_SelectionChanged(object sender, EventArgs e) //ไว้ทดสอบ
         * {
         *     foreach (DataGridViewRow row in dGV_PetProfile.SelectedRows)
         *     {
         *         txb_PetProfileID.Text = row.Cells["ccPet_ID"].Value.ToString();
         *         txb_PetName.Text = row.Cells["ccPet_Name"].Value.ToString();
         *         //เพศ ccPet_Sex Combobox
         *         int isex = Convert.ToInt32(row.Cells["ccPet_Sex"].Value);
         *         if (isex == 0)
         *         {
         *             rb_F.Checked = true;
         *         }
         *         else if (isex == 1)
         *         {
         *             rb_M.Checked = true;
         *         }
         *
         *         //วันเกิด ccPet_DOB DateTimePicker
         *         txb_PetColor.Text = row.Cells["ccPet_Color"].Value.ToString();
         *         //ประเภทสัตว์ ccPetType_ID  Combobox
         *         //พันธุ์สัตว์ ccPet_Breed_ID Combobox
         *         //ทำหมัน ccPet_Sterility DateTimePicker
         *         DateTime iSterility = Convert.ToDateTime(row.Cells["ccPet_Sterility"].Value);
         *         if (iSterility > DateTime.MinValue)
         *         {
         *             CheckBox_Sterility.Checked = true;
         *             //DateTime  iSterility = Convert.ToDateTime(row.Cells["ccPet_Sterility"].Value);
         *             dTP_Sterility.Value = iSterility;
         *         }
         *         else
         *         {
         *             CheckBox_Sterility.Checked = false;
         *         }
         *         txb_NameOwner.Text = row.Cells["ccOwner_Name"].Value.ToString();
         *         Txb_Addr.Text = row.Cells["ccOwner_Addr"].Value.ToString();
         *         txb_TelOwner.Text = row.Cells["ccOwner_Tel"].Value.ToString();
         *     }
         * } */

        private void bt_HealRecordDetail_Click(object sender, EventArgs e)
        {
            if ((lb_HealDetailID.Text != string.Empty) && (lb_HealDetailID.Text != null))
            {
                foreach (Form form in Application.OpenForms) //คำสั่งห้ามเปิดซ้อนสอง
                {
                    if (form.GetType() == typeof(FrmHealRecord))
                    {
                        form.Activate();
                        return;
                    }
                }
                FrmHealRecord iFrmHealRecord = new FrmHealRecord();
                iFrmHealRecord.MdiParent = MainForm.ActiveForm;
                iFrmHealRecord.Show();
                iFrmHealRecord.lb_HealRecordID.Text = lb_HealDetailID.Text;
            }
            //string itxbPetProfiles = txb_PetProfileID.Text.Trim();
        }
コード例 #2
0
        private void bt_Service_Click(object sender, EventArgs e)
        {
            if ((txb_PetProfileID.Text != null) && (txb_PetProfileID.Text != string.Empty))
            {
                foreach (Form form in Application.OpenForms) //คำสั่งห้ามเปิดซ้อนสอง
                {
                    if (form.GetType() == typeof(FrmHealRecord))
                    {
                        form.Activate();
                        return;
                    }
                }

                FrmHealRecord iFrmHealRecord = new FrmHealRecord();
                iFrmHealRecord.MdiParent = MainForm.ActiveForm;
                iFrmHealRecord.Show();
                iFrmHealRecord.txb_PetID.Text = txb_PetProfileID.Text;
                //this.Close();
            }
            else
            {
                MessageBox.Show("กรุณาเลือกสัตว์ไข้", "ไม่พบสัตว์ไข้");
            }
        }