protected void btnDoctorSee_Command(object sender, CommandEventArgs e) { string ID = e.CommandArgument.ToString(); Check chk = new Check(); string Chk_Doc_Ser = chk.stringCheck("select SerialActive from Serial where ID=" + ID); string Set = ""; if (Chk_Doc_Ser == "TRUE") { Set = "FALSE"; } else { Set = "TRUE"; } SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "update Serial set SerialActive='" + Set + "' where ID=" + ID; con.Open(); cmd.ExecuteNonQuery(); con.Close(); GridQuery.DataBind(); GridScarch.DataBind(); GridSess.DataBind(); gridDate.DataBind(); }
protected void btnPaymentClear_Command(object sender, CommandEventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.Connection = con; string ID = e.CommandArgument.ToString(); Check chk = new Check(); string Doctor_ID = chk.stringCheck("select DoctorID from Serial where ID=" + ID); string Serial_Number = chk.stringCheck("select SerialID from Serial where ID=" + ID); string Schedul_ID = chk.stringCheck("select SchedulID from Serial where ID=" + ID); string Schedul_Date = chk.stringCheck("select SerialDate from Serial where ID=" + ID); string Taka = chk.stringCheck("select SerialPrice from Serial where ID=" + ID); string Submit_Date = DateTime.Now.ToString("MM/dd/yyyy"); string PatientName = chk.stringCheck("select PatientName from Serial where ID=" + ID); string Chk_Doc_Ser = chk.stringCheck("select PaymentClear from Serial where ID=" + ID); string Set = ""; if (Chk_Doc_Ser == "TRUE") { Set = "FALSE"; if (chk.int32Check("select count(*) from DoctorPayment where SerialNumber='" + Serial_Number + "'") == 1) { cmd.CommandText = "delete from DoctorPayment where SerialNumber='" + Serial_Number + "'"; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } else { Set = "TRUE"; cmd.CommandText = @"insert into DoctorPayment (DoctorID,SerialNumber,SchedulID,SchedulDate,SubmitDate,Payment,PatientName) Values (@DoctorID,@SerialNumber,@SchedulID,@SchedulDate,@SubmitDate,@Payment,@PatientName)"; cmd.Parameters.AddWithValue("@DoctorID", Doctor_ID); cmd.Parameters.AddWithValue("@SerialNumber", Serial_Number); cmd.Parameters.AddWithValue("@SchedulID", Schedul_ID); cmd.Parameters.AddWithValue("@SchedulDate", Schedul_Date); cmd.Parameters.AddWithValue("@SubmitDate", Submit_Date); cmd.Parameters.AddWithValue("@Payment", Convert.ToInt32(Taka)); cmd.Parameters.AddWithValue("@PatientName", PatientName); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } cmd.CommandText = "update Serial set PaymentClear='" + Set + "' where ID=" + ID; con.Open(); cmd.ExecuteNonQuery(); con.Close(); GridQuery.DataBind(); GridScarch.DataBind(); GridSess.DataBind(); gridDate.DataBind(); }