Ejemplo n.º 1
0
 private void frm_Patient_Detail_Edit_Load(object sender, EventArgs e)
 {
     try
     {
         if (GlobalVariable._Patient_id != "")
         {
             txtId.Text = GlobalVariable._Patient_id;
             RetrieveData(int.Parse(GlobalVariable._Patient_id));
             GlobalVariable._Patient_id = "";
             GlobalMethod.getGreenRed("md_status", dgvMd, "Inactive");
         }
         txtTel.KeyPress     += new KeyPressEventHandler(EventHandler.TextBoxNumberOnly);
         txtKhFname.KeyPress += new KeyPressEventHandler(EventHandler.TextBoxTextOnly);
         txtKhLname.KeyPress += new KeyPressEventHandler(EventHandler.TextBoxTextOnly);
         txtFname.KeyPress   += new KeyPressEventHandler(EventHandler.TextBoxTextOnly);
         txtLname.KeyPress   += new KeyPressEventHandler(EventHandler.TextBoxTextOnly);
         txtNati.KeyPress    += new KeyPressEventHandler(EventHandler.TextBoxTextOnly);
         txtJob.KeyDown      += new KeyEventHandler(EventHandler.TextBoxClearBackPress);
         txtJob.Leave        += new System.EventHandler(EventHandler.TextBoxLeaveReturnDefalut);
         txtAddress.KeyDown  += new KeyEventHandler(EventHandler.TextBoxClearBackPress);
         txtAddress.Leave    += new System.EventHandler(EventHandler.TextBoxLeaveReturnDefalut);
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient_Detail_Load :" + t.Message);
     }
 }
Ejemplo n.º 2
0
 public static int GetlastID()
 {
     try
     {
         int val;
         con = new SqlConnection(connectionString);
         con.Open();
         string     strCmd   = "select  max(pat_id) as LastID from tblPatient";
         SqlCommand cmd      = new SqlCommand(strCmd, con);
         object     objValue = cmd.ExecuteScalar();
         if (objValue.Equals(DBNull.Value))
         {
             val = 0;
         }
         else
         {
             val = (int)cmd.ExecuteScalar();
         }
         con.Close();
         return(val);
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_tp : " + t.Message);
         throw;
     }
 }
Ejemplo n.º 3
0
 public static void spd_insert_doctor(string doc_name, string doc_bod, string doc_qual, string doc_tel, string doc_iden)
 {
     //@doc_name nvarchar(max),
     //@doc_bod nvarchar(max),
     //@doc_qualification nvarchar(max),
     //@doc_tel nvarchar(max),
     //@doc_identifyNumber nvarchar(max)
     try
     {
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("dbo.spd_insert_doctor", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@doc_name", doc_name);
         cmd.Parameters.AddWithValue("@doc_bod", doc_bod);
         cmd.Parameters.AddWithValue("@doc_qualification", doc_qual);
         cmd.Parameters.AddWithValue("@doc_tel", doc_tel);
         cmd.Parameters.AddWithValue("@doc_identifyNumber", doc_iden);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_doctor : " + t.Message);
     }
 }
Ejemplo n.º 4
0
 public static void sp_insert_product(DataTable dt, string time)
 {
     try
     {
         using (con = new SqlConnection(connectionString))
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("insert_stock", con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@imp_date", time);
             SqlParameter param = new SqlParameter();
             //SqlParameter param = new SqlParameter("@sto", SqlDbType.Structured)
             //{
             //    TypeName = "dbo.stock",
             //    Value = dt
             //};
             param.ParameterName = "@sto";
             param.SqlDbType     = SqlDbType.Structured;
             param.Value         = dt;
             cmd.Parameters.Add(param);
             cmd.ExecuteNonQuery();
             con.Close();
         }
     }catch (Exception e)
     {
         GlobalMethod.HandleException("StoreProcedure / insert_stock : " + e.Message);
     }
 }
Ejemplo n.º 5
0
 public static void fun_get_pro_cat(string cat)
 {
     try
     {
     }catch (SqlException e)
     {
         GlobalMethod.HandleException("StoreProcedure / insert_stock : " + e.Message);
     }
 }
Ejemplo n.º 6
0
 private void frm_Patient_Activated(object sender, EventArgs e)
 {
     try
     {
         this.fun_getAllPatientTableAdapter.Fill(this.dentist_DS.fun_getAllPatient);
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("frm_Patient / btnEditPatient_Click " + t.Message);
     }
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
 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);
     }
 }
Ejemplo n.º 9
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);
     }
 }
Ejemplo n.º 10
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);
     }
 }
Ejemplo n.º 11
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);
     }
 }
Ejemplo n.º 12
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);
     }
 }
Ejemplo n.º 13
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);
     }
 }
Ejemplo n.º 14
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);
     }
 }
Ejemplo n.º 15
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);
     }
 }
Ejemplo n.º 16
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);
     }
 }
Ejemplo n.º 17
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);
     }
 }
Ejemplo n.º 18
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);
     }
 }
Ejemplo n.º 19
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);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 23
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);
     }
 }
Ejemplo n.º 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);
     }
 }