Esempio n. 1
0
 public static void spd_insert_prescription(DataGridView dgv)
 {       //Table Structure
         //[pat_id] [int] NULL,
         //[ps_date] [date] NULL,
         //[ps_des] [nvarchar](max) NULL,
         //[ps_unit] [nvarchar](max) NULL,
         //[ps_amount] [int] NULL,
         //[ps_price] [decimal](18, 0) NULL,
         //[ps_total] [decimal](18, 0) NULL,
         //[ps_status] [nvarchar](5) NULL
         //[pro_id] [int] NULL,
     //@tempPs
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[spd_insert_prescription]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@tempPs";
         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);
     }
 }
Esempio n. 2
0
 public static void spd_insert_tp(DataGridView dgv)
 {
     //TableStructure
     //pat_id | [tp_date] | [sd_id] | [charge_amount] | [discount_amount] | [total_amount] | [doc_id] [int] NULL | [paid_status] | [tp_amount] decimal(18,0)
     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);
         dt.Columns.Remove("service_name");
         dt.Columns.Remove("doc_name");
         dt.Columns["tp_amount"].SetOrdinal(8);
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / spd_insert_tp : " + t.Message + t.StackTrace);
     }
 }
Esempio n. 3
0
 public static void sp_prescript(DataGridView dgv)
 {
     //[pro_id][int] NULL,
     //[qty][int] NULL
     //@pres
     try
     {
         DataTable dt;
         con = new SqlConnection(connectionString);
         con.Open();
         cmd             = new SqlCommand("[dbo].[sp_prescript]", con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param.ParameterName = "@pres";
         dt = GlobalMethod.convertDGVtoDT(dgv);
         dt.Columns.Remove("pat_id");
         dt.Columns.Remove("ps_date");
         dt.Columns.Remove("ps_unit");
         dt.Columns.Remove("ps_des");
         dt.Columns.Remove("ps_price");
         dt.Columns.Remove("ps_total");
         dt.Columns.Remove("ps_status");
         dt.Columns.Add("id");
         dt.Columns["id"].SetOrdinal(0);
         dt.Columns["p_id"].SetOrdinal(1);
         dt.Columns["ps_amount"].SetOrdinal(2);
         int i = 1;
         foreach (DataRow row in dt.Rows)
         {
             row["id"] = i;
             i++;
         }
         param.Value = dt;
         cmd.Parameters.Add(param);
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception t)
     {
         GlobalMethod.HandleException("StoreProcedure / sp_prescript : " + t.Message);
     }
 }
Esempio n. 4
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);
     }
 }