コード例 #1
0
ファイル: frm_Patient.cs プロジェクト: tommy8595/dentistold
 private void frm_Patient_Load(object sender, EventArgs e)
 {
     try
     {
         this.fun_getAllPatientTableAdapter.Fill(this.dentist_DS.fun_getAllPatient);
         cboSearchChoice.SelectedIndex = 1;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient_Load " + t.Message);
     }
 }
コード例 #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dgvMd.Rows)
     {
         if (row.Cells["md_id"].Value​​.ToString() == cboMd.SelectedValue.ToString())
         {
             MyMSB.Show("ប្រវតិ្តវេជ្ជសាស្រ្តបានបញ្ចូលរួចហើយ", "0", false);
             return;
         }
     }
     dgvMd.Rows.Add(txtId.Text, cboMd.SelectedValue, GlobalMethod.getCboData(cboMd, "md_name"), txtDes.Text, "active");
 }
コード例 #3
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            string username = txt_username.Text;
            string password = txt_password.Text;

            StoreProcedure.sp_login(username, password);
            StoreProcedure.fn_login_admin(username, password);
            GlobalVariable._LowImageFilePath = GlobalMethod.GetLowImageFilePath("1");
            this.Close();
            th = new Thread(openHome);
            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
コード例 #4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         StoreProcedure.spd_update_mdHistoryByPatID(pat_id, md_id, cboMdStatus.SelectedItem.ToString(), txtMdDes.Text);
         this.Hide();
         GlobalVariable._isMSB = true;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Edit_Patient_Md / btnAdd_Click " + t.Message);
     }
 }
コード例 #5
0
ファイル: frm_Patient.cs プロジェクト: tommy8595/dentistold
 private void btnPatientDetail_Click(object sender, EventArgs e)
 {
     try
     {
         GlobalVariable._Patient_id = dataGridView1.CurrentRow.Cells["patidDataGridViewTextBoxColumn"].Value.ToString();
         frm_Patient_Detail form = new frm_Patient_Detail();
         form.ShowDialog();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient / btnEditPatient_Click " + t.Message);
     }
 }
コード例 #6
0
 private void btn_Reg_Pat_Save_Click(object sender, EventArgs e)
 {
     try
     {
         byte[] imgByte = null;
         if (!GlobalMethod.FormValidate(this))
         {
             return;
         }
         if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true))
         {
             return;
         }
         if (imgLoc != null)
         {
             imgByte = GlobalMethod.GetImageByte(imgLoc);
         }
         StoreProcedure.spd_update_patientByID(
             int.Parse(txtId.Text),
             txtKhFname.Text,
             txtKhLname.Text,
             txtFname.Text,
             txtLname.Text,
             txtGender.Text,
             nudDob.Value.ToString(),
             txtJob.Text,
             txtAddress.Text,
             imgByte,
             dtpAppoint.Value.ToString("yyyy-MM-dd"),
             txtNati.Text,
             txtTel.Text,
             string.Format("{0}:{1}", nudHour.Value.ToString(), nudMinute.Value.ToString())
             );
         if (dgvMd.Rows.Count > 0)
         {
             StoreProcedure.spd_insert_patient_md(dgvMd);
         }
         GlobalVariable._Patient_id = txtId.Text;
         if (MyMSB.Show("ការកែរប្រែបានជោគជ័យ", "1", false))
         {
             btn_Reg_Pat_Cancel.PerformClick();
         }
         ;
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient_Detail_Edit / btn_Reg_Pat_Save_Click : " + t.Message);
     }
 }
コード例 #7
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dgvMd.Rows)
     {
         if (row.Cells["md_id"].Value​​.ToString() == cboMd.SelectedValue.ToString())
         {
             MyMSB.Show("ប្រវតិ្តវេជ្ជសាស្រ្តបានបញ្ចូលរួចហើយ", "0", false);
             return;
         }
     }
     dgvMd.Rows.Add(txtId.Text, cboMd.SelectedValue, GlobalMethod.getCboData(cboMd, "md_name"), txtDes.Text, "Active");
     if (dgvMd.Rows.Count > 0)
     {
         StoreProcedure.spd_insert_patient_md(dgvMd);
     }
     GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive");
 }
コード例 #8
0
        private void frm_Patient_Detail_Edit_Activated(object sender, EventArgs e)
        {
            dgvMd.Rows.Clear();
            DataTable dt = this.fun_getActiveMedicalHistoryForSpecificPaientTableAdapter.GetData(int.Parse(txtId.Text));

            foreach (DataRow row in dt.Rows)
            {
                dgvMd.Rows.Add(
                    row["pat_id"].ToString(),
                    row["md_id"].ToString(),
                    row["md_name"].ToString(),
                    row["md_description"].ToString(),
                    row["md_status"].ToString()
                    );
            }
            GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive");
        }
コード例 #9
0
 public static void fn_login_admin(string username, string password)
 {
     try
     {
         con = new SqlConnection(connectionString);
         con.Open();
         cmd = new SqlCommand("select [dbo].[fn_login_admin](@u,@p);", con);
         cmd.Parameters.AddWithValue("@u", username);
         cmd.Parameters.AddWithValue("@p", password);
         GlobalVariable._role = int.Parse(cmd.ExecuteScalar().ToString());
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_doctor : " + t.Message);
     }
 }
コード例 #10
0
 public static void update_notification(int stock_id)
 {
     try
     {
         using (con = new SqlConnection(connectionString))
         {
             SqlCommand cdm = new SqlCommand("update tbl_stock set alerted=1 where stock_id=" + stock_id, con);
             con.Open();
             cdm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (SqlException e)
     {
         GlobalMethod.HandleException("update_notification: " + e.Message);
     }
 }
コード例 #11
0
 private void btnBrowse_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog dlg = new OpenFileDialog();
         dlg.Filter = "JPG Files (*.jpg)|*.jpg";
         dlg.Title  = "Select Patient Image";
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             imgLoc           = dlg.FileName.ToString();
             pb.ImageLocation = imgLoc;
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("TestForm / btnBrowse_Click : " + t.Message);
     }
 }
コード例 #12
0
 private void frm_Patient_Detail_Load(object sender, EventArgs e)
 {
     try
     {
         if (GlobalVariable._Patient_id != "")
         {
             txtId.Text = GlobalVariable._Patient_id;
             RetrieveData(int.Parse(GlobalVariable._Patient_id));
             txtAppoint.Text            = Convert.ToDateTime(txtAppoint.Text).ToString("dd-MM-yyyy");
             GlobalVariable._Patient_id = "";
             GlobalMethod.getGreenRed("md_status", fun_getActiveMedicalHistoryForSpecificPaientDataGridView, "Inactive");
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient_Detail_Load :" + t.Message);
     }
 }
コード例 #13
0
 public static DataTable get_pro_detail_by_cat(int cat_id)
 {
     try
     {
         DataTable dt = new DataTable();
         using (con = new SqlConnection(connectionString))
         {
             SqlCommand     cdm = new SqlCommand("select * from tbl_product where cat_id= " + cat_id + " order by pro_name asc", con);
             SqlDataAdapter adp = new SqlDataAdapter(cdm);
             adp.Fill(dt);
         }
         return(dt);
     }
     catch (SqlException e)
     {
         GlobalMethod.HandleException("StoreProcedure / insert_stock : " + e.Message);
         return(null);
     }
 }
コード例 #14
0
 public static DataTable get_pro_detail(string name)
 {
     try
     {
         DataTable dt = new DataTable();
         using (con = new SqlConnection(connectionString))
         {
             SqlCommand     cdm = new SqlCommand("select top 1* from tbl_product where pro_name like'" + name + "' +'%'", con);
             SqlDataAdapter adp = new SqlDataAdapter(cdm);
             adp.Fill(dt);
         }
         return(dt);
     }
     catch (SqlException e)
     {
         GlobalMethod.HandleException("StoreProcedure / insert_stock : " + e.Message);
         return(null);
     }
 }
コード例 #15
0
        private void btnInactive_Click(object sender, EventArgs e)
        {
            string md_status, pat_id, md_id;

            pat_id = txtId.Text;
            md_id  = dgvMd.CurrentRow.Cells["md_id"].Value.ToString();
            if (dgvMd.CurrentRow.Cells["md_status"].Value.ToString() == "Inactive")
            {
                dgvMd.CurrentRow.Cells["md_status"].Value = "Active";
                md_status = "Active";
            }
            else
            {
                dgvMd.CurrentRow.Cells["md_status"].Value = "Inactive";
                md_status = "Inactive";
            }
            GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive");
            StoreProcedure.spd_update_mdHistoryByPatID(int.Parse(pat_id), int.Parse(md_id), md_status);
        }
コード例 #16
0
 public static void spd_insert_patient(string pat_kh_fname, string pat_kh_lname, string pat_fname, string pat_lname, string pat_gender, string pat_birthyear, string pat_job, string pat_address, byte[] pat_image, string pat_app_date, string pat_nation, string pat_tel, string pat_app_time)
 {
     //    @pat_kh_fname NVARCHAR(MAX),
     //    @pat_kh_lname NVARCHAR(MAX),
     //    @pat_fname NVARCHAR(MAX),
     //    @pat_lname NVARCHAR(MAX),
     //    @pat_gender NVARCHAR(10),
     //    @pat_birthyear NVARCHAR(MAX),
     //    @pat_job NVARCHAR(MAX),
     //    @pat_address NVARCHAR(MAX),
     //    @pat_image IMAGE
     //    @pat_app_date date
     //    @pat_nation
     //    @pat_tel
     //    @pat_app_time nvarchar(max)
     try
     {
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("dbo.spd_insert_patient", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@pat_kh_fname", pat_kh_fname);
         cmd.Parameters.AddWithValue("@pat_kh_lname", pat_kh_lname);
         cmd.Parameters.AddWithValue("@pat_fname", pat_fname);
         cmd.Parameters.AddWithValue("@pat_lname", pat_lname);
         cmd.Parameters.AddWithValue("@pat_gender", pat_gender);
         cmd.Parameters.AddWithValue("@pat_birthyear", pat_birthyear);
         cmd.Parameters.AddWithValue("@pat_job", pat_job);
         cmd.Parameters.AddWithValue("@pat_address", pat_address);
         cmd.Parameters.AddWithValue("@pat_image", pat_image);
         cmd.Parameters.AddWithValue("@pat_app_date", pat_app_date);
         cmd.Parameters.AddWithValue("@pat_nation", pat_nation);
         cmd.Parameters.AddWithValue("@pat_tel", pat_tel);
         cmd.Parameters.AddWithValue("@pat_app_time", pat_app_time);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_patient : " + t.Message);
     }
 }
コード例 #17
0
        private void btn_Reg_Pat_Save_Click(object sender, EventArgs e)
        {
            if (!GlobalMethod.FormValidate(this) || IsPassValidated())
            {
                return;
            }
            if (!MyMSB.Show("តើអ្នកពិតជាចង់រក្សាទុកមែនទេ?", "1", true))
            {
                return;
            }


            byte[] imgBinary = GlobalMethod.GetImageByte(imgLoc);
            StoreProcedure.spd_insert_patient(
                txtKhFname.Text,
                txtKhLname.Text,
                txtFname.Text,
                txtLname.Text,
                cboGender.Text,
                nudDob.Value.ToString(),
                txtJob.Text,
                txtAddress.Text,
                imgBinary,
                dtpAppoint.Value.ToString("yyyy-MM-dd"),
                txtNati.Text,
                txtTel.Text,
                string.Format("{0}:{1}", nudHour.Value.ToString(), nudMinute.Value.ToString())
                );
            if (dgvMd.Rows.Count > 0)
            {
                StoreProcedure.spd_insert_patient_md(dgvMd);
            }
            GlobalVariable._Patient_id = txtId.Text;


            MyMSB.Show("ការរក្សាទុកបានជោគជ័យ", "1", true);
            this.Close();
            Thread th = new Thread(openPatient);

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
コード例 #18
0
 private void cbo_Pro_Imp_Cat_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbo_Pro_Imp_Cat.SelectedValue != null)
         {
             int id = 0;
             int.TryParse(cbo_Pro_Imp_Cat.SelectedValue.ToString(), out id);
             DataTable dt = StoreProcedure.get_pro_detail_by_cat(id);
             cbo_Pro_Imp_Name.DataSource    = dt;
             cbo_Pro_Imp_Name.DisplayMember = "pro_name";
             cbo_Pro_Imp_Name.ValueMember   = "pro_id";
             txt_Pro_Imp_Unit.Text          = dt.Rows[0][3].ToString();
         }
     }
     catch (Exception ex)
     {
         GlobalMethod.HandleException(ex.Message);
     }
 }
コード例 #19
0
 public static void sp_insert_expense(string detail, string name, float price)
 {
     try
     {
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("dbo.sp_insert_expense", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@detail", detail);
         cmd.Parameters.AddWithValue("@amount", price);
         cmd.Parameters.AddWithValue("@name", name);
         cmd.Parameters.AddWithValue("@user", GlobalVariable._user_name);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_patient : " + t.Message);
     }
 }
コード例 #20
0
        public static DataTable get_pro_expire()
        {
            DataTable dt = new DataTable();

            try
            {
                using (con = new SqlConnection(connectionString))
                {
                    SqlCommand cdm = new SqlCommand("select stock_id,(select pro_name from tbl_product where st.pro_id=pro_id) as Name,location,stock_qty,expiredate from tbl_stock st "
                                                    + "where DATEDIFF(day, getdate(), expiredate) < 30 and expiredate > GETDATE()  and alerted is null", con);
                    SqlDataAdapter adp = new SqlDataAdapter(cdm);
                    adp.Fill(dt);
                }
                return(dt);
            }
            catch (SqlException e)
            {
                GlobalMethod.HandleException("StoreProcedure / insert_stock : " + e.Message);
                return(null);
            }
        }
コード例 #21
0
 public static void sp_login(string username, string password)
 {
     try
     {
         using (con = new SqlConnection(connectionString))
         {
             SqlCommand cmd = new SqlCommand("sp_login", con);
             cmd.Parameters.AddWithValue("@name", username);
             cmd.Parameters.AddWithValue("@pass", password);
             cmd.CommandType = CommandType.StoredProcedure;
             SqlDataAdapter adp = new SqlDataAdapter();
             adp.SelectCommand = cmd;
             DataTable ds = new DataTable();
             adp.Fill(ds);
             GlobalVariable._user_data = ds;
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / sp_login : " + t.Message);
     }
 }
コード例 #22
0
 public static DataTable sp_get_expense(string peroid)
 {
     try
     {
         using (con = new SqlConnection(connectionString))
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("sp_get_expense", con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@peroid", peroid);
             SqlDataAdapter rdr = new SqlDataAdapter(cmd);
             DataTable      dt  = new DataTable();
             rdr.Fill(dt);
             return(dt);
         }
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("sp_get_expense : " + t.Message);
         return(null);
     }
 }
コード例 #23
0
        private void RetrieveData(int v)
        {
            DataTable dt;

            this.fun_getPatientByIDTableAdapter.Fill(dentist_DS.fun_getPatientByID, v);
            dt = this.fun_getPatientByIDTableAdapter.GetData(v);
            string[] spl = dt.Rows[0]["pat_app_time"].ToString().Split(':');
            nudHour.Value   = Convert.ToDecimal(spl[0]);
            nudMinute.Value = Convert.ToDecimal(spl[1]);
            //this.fun_getActiveMedicalHistoryForSpecificPaientTableAdapter.Fill(dentist_DS.fun_getActiveMedicalHistoryForSpecificPaient, v);
            this.fun_getMedicalHistoryForSpecificPatientTableAdapter.Fill(dentist_DS.fun_getMedicalHistoryForSpecificPatient, v);
            dt = this.fun_getActiveMedicalHistoryForSpecificPaientTableAdapter.GetData(v);
            foreach (DataRow row in dt.Rows)
            {
                dgvMd.Rows.Add(
                    row["pat_id"].ToString(),
                    row["md_id"].ToString(),
                    row["md_name"].ToString(),
                    row["md_description"].ToString(),
                    row["md_status"].ToString()
                    );
            }
            GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive");
        }
コード例 #24
0
 public static void spd_insert_tp(DataGridView dgv)
 {
     //TableStructure
     //pat_id | [tp_date] | [sd_id] | [charge_amount] | [discount_amount] | [total_amount] | [doc_name] | [paid_status]
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[spd_insert_tp]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@tempTp";
         dt          = GlobalMethod.convertDGVtoDT(dgv);
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_tp : " + t.Message);
     }
 }
コード例 #25
0
 public static void spd_insert_patient_md(DataGridView dgv)
 {
     //TableStructure
     //pat_id | md_id | md_name | md_description | md_status
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[spd_insert_patientMd]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@tempMd";
         dt          = GlobalMethod.convertDGVtoDT(dgv);
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_patient_diagnose : " + t.Message);
     }
 }