private void RefreshData() { string strSql = " SELECT id, firstname || ' ' || lastname as Name " + " FROM login where isdoctor = false and isadmin=false " + " and isnewuser=true order by Name"; DataSet ds = BaseDA.ExecuteDataSet(strSql); gvHist.DataSource = ds; gvHist.DataBind(); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { gvHist.DataSource = ds.Tables[0]; gvHist.DataBind(); } else { gvHist.Visible = false; this.ErrorMessage += "No Results Found"; } } else { this.ErrorMessage += "DataSet is null"; } }
protected void btnlogin_Click(object sender, EventArgs e) { try { // Checking for Required Fields if (string.IsNullOrEmpty(txtuser.Text.Trim())) { this.ErrorMessage += "User Name is Required <br />"; } if (string.IsNullOrEmpty(txtpassword.Text.Trim())) { this.ErrorMessage += "Password is Required<br />"; } //Checking for Errors if (string.IsNullOrEmpty(this.ErrorMessage)) { DataSet ds = BaseDA.ExecuteDataSet(string.Format("select * from login where username = '******' and password ='******'", BaseDA.Escape(txtuser.Text), BaseDA.Escape(txtpassword.Text))); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr != null) { if (dr["Id"] != null) { this.UserId = Convert.ToInt32(dr["Id"]); this.UserName = dr["lastname"].ToString() + " " + dr["firstname"].ToString(); this.IsAdmin = Convert.ToBoolean(dr["isadmin"]); this.IsDoctor = Convert.ToBoolean(dr["isdoctor"]); } } } if (this.UserId > 0) { if (IsDoctor) { Response.Redirect("DoctorsPage.aspx", false); } else if (IsAdmin) { Response.Redirect("ClerksPage.aspx", false); } else { Response.Redirect("PatientEntry.aspx", false); } } else { this.ErrorMessage += "Invalid Username or Password"; } } } catch (Exception ex) { this.ErrorMessage = "Exception " + ex; } }
protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); if (this.UserId > 0) { int pid = 0; if (this.IsDoctor && Request.QueryString["id"] != null) { pid = Convert.ToInt32(Request.QueryString["id"]); } else { pid = this.UserId; } String sql = "SELECT id,firstname,lastname,firstname||' '||lastname as fullname FROM public.Login where id = " + pid; DataSet dsname = BaseDA.ExecuteDataSet(sql); if (dsname != null) { if (dsname.Tables.Count > 0) { DataTable dt = dsname.Tables[0]; foreach (DataRow dr in dt.Rows) { lblfullname.Text = dr["fullname"].ToString(); } } } string strSql = " SELECT *, bphigh || '/' || bplow as bp " + " FROM public.Patient where pid = " + pid + " order by entrydate desc"; DataSet ds = BaseDA.ExecuteDataSet(strSql); gvHist.DataSource = ds; gvHist.DataBind(); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { gvHist.DataSource = ds.Tables[0]; gvHist.DataBind(); } else { gvHist.Visible = false; this.ErrorMessage += "No Resluts Found"; } } else { this.ErrorMessage += "DataSet is null"; } } else { this.ErrorMessage += "Please login to the System for further Access <br />"; Response.Redirect("Default.aspx"); } }
private DataTable getDoctorInfo() { string strSql = " SELECT id, firstname || ' ' || lastname as Name " + " FROM login where isdoctor = true " + " order by Name"; DataSet ds = BaseDA.ExecuteDataSet(strSql); gvHist.DataSource = ds; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { return(ds.Tables[0]); } return(null); }
private DataTable RefreshData() { string strSql = " select dr.*, l.*, l.lastname || ' ' || l.firstname as name" + " from doctorpatient dr " + " inner join login l on dr.patientid=l.id " + " where dr.doctorid = " + this.UserId; DataSet ds = BaseDA.ExecuteDataSet(strSql); if (ds != null && ds.Tables.Count > 0) { return(ds.Tables[0]); } return(null); }
protected void btnAssociate_Click(object sender, System.EventArgs e) { try { if (this.ValidateData()) { string strSql = " insert into doctorpatient(doctorid, patientid) " + " values ({0}, {1}); " + " update login set isnewuser=false where id={2} "; foreach (GridViewRow row in gvHist.Rows) { CheckBox chk = (CheckBox)(row.FindControl("chkSelect")); if (chk.Checked) { int PatId = Convert.ToInt32(row.Cells[1].Text); DropDownList ddlDoc = (DropDownList)(row.FindControl("ddlDoctor")); int intDocId = Convert.ToInt32(ddlDoc.SelectedValue); //check duplicate string userIdSql = string.Format("select * from doctorpatient where doctorid = " + intDocId + " and patientid = " + PatId); DataSet ds = BaseDA.ExecuteDataSet(userIdSql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr != null) { if (dr["doctorid"] != null) { ErrorMessage += "Patient " + row.Cells[2].Text + " already associated to the selected Doctor <br/>"; } } } else { BaseDA.ExecuteNonQuery(string.Format(strSql, intDocId, PatId, PatId)); } } } this.RefreshData(); } } catch (Exception ex) { this.ErrorMessage = "Exception : " + ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ErrorMessage = string.Empty; lblErrors.Text = string.Empty; try { //check for required field validation if (string.IsNullOrEmpty(txtUserId.Text.Trim())) { ErrorMessage += "User name is required <br/>"; } /* if (Int16.Parse(listSecQuestion.SelectedValue.Trim())== -1) * { * ErrorMessage += "Security question is required <br/>"; * }*/ if (string.IsNullOrEmpty(txtAnswer.Text.Trim())) { ErrorMessage += "Answer is required <br/>"; } if (string.IsNullOrEmpty(listMonth.SelectedValue.Trim()) || string.IsNullOrEmpty(txtDay.Text.Trim()) || string.IsNullOrEmpty(txtYear.Text.Trim())) { ErrorMessage += "Birthdate is required <br/>"; } DateTime birthDate = DateTime.MinValue; //Build birth date from the values entered and validate it if (!string.IsNullOrEmpty(listMonth.SelectedValue.Trim()) && !string.IsNullOrEmpty(txtDay.Text.Trim()) && !string.IsNullOrEmpty(txtYear.Text.Trim())) { double Num; bool isValidDay, isValidYear; isValidDay = double.TryParse(txtDay.Text, out Num); if (!isValidDay) { ErrorMessage = "Enter a valid date<br/>"; } isValidYear = double.TryParse(txtYear.Text, out Num); if (!isValidYear) { ErrorMessage = "Enter a valid date<br/>"; } if (!IsValidDate(listMonth.SelectedValue, txtDay.Text.Trim(), txtYear.Text.Trim())) { ErrorMessage = "Enter a valid date<br/>"; } } if (!string.IsNullOrEmpty(ErrorMessage)) { lblErrors.Text = ErrorMessage; } //Valid entry if (string.IsNullOrEmpty(ErrorMessage)) { int month = Int16.Parse(listMonth.SelectedValue); int day = Int16.Parse(txtDay.Text.Trim()); int year = Int16.Parse(txtYear.Text.Trim()); birthDate = new DateTime(year, month, day); string sql = string.Format( "SELECT * FROM LOGIN WHERE username= '******'and dob = '{1}' and securityQuestion= '{2}' and answer = '{3}'", BaseDA.Escape(txtUserId.Text.Trim()), birthDate, BaseDA.Escape(listSecQuestion.SelectedValue), BaseDA.Escape(txtAnswer.Text.Trim())); DataSet ds = BaseDA.ExecuteDataSet(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr != null) { Response.Redirect("ChangePassword.aspx?username="******"User does not exist. Please check if you have entered valid information </BR>"; } } } catch (Exception ex) { ErrorMessage = "Exception " + ex; lblErrors.Text = ErrorMessage; } }
protected void btnRegister_Click(object sender, EventArgs e) { ErrorMessage = string.Empty; lblErrors.Text = string.Empty; try { //check for required field validation if (string.IsNullOrEmpty(txtUserId.Text.Trim())) { ErrorMessage += "User name is required <br/>"; } //check if the user name selected already exists in the database, if it exists its an invalid entry if (!string.IsNullOrEmpty(txtUserId.Text.Trim())) { string userIdSql = string.Format("SELECT * FROM LOGIN WHERE username = '******'", BaseDA.Escape(txtUserId.Text.Trim())); DataSet ds = BaseDA.ExecuteDataSet(userIdSql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr != null) { if (dr["Id"] != null) { ErrorMessage += "User name already exists. Please choose a different user name <br/>"; } } } } if (string.IsNullOrEmpty(txtPassword.Text.Trim())) { ErrorMessage += "Password is required <br/>"; } if (string.IsNullOrEmpty(txtRetypePwd.Text.Trim())) { ErrorMessage += "Retype Password is required <br/>"; } // check that password = retyped password if (!string.IsNullOrEmpty(txtPassword.Text.Trim()) && !string.IsNullOrEmpty(txtRetypePwd.Text.Trim())) { if (txtPassword.Text.Trim() != txtRetypePwd.Text.Trim()) { ErrorMessage += "Password and Retyped Password must be the same <br/>"; } } if (string.IsNullOrEmpty(txtFirstName.Text.Trim())) { ErrorMessage += "First name is required <br/>"; } if (string.IsNullOrEmpty(txtLastName.Text.Trim())) { ErrorMessage += "Last name is required <br/>"; } /* if (Int16.Parse(listSecQuestion.SelectedValue.Trim())== -1) * { * ErrorMessage += "Security question is required <br/>"; * }*/ if (string.IsNullOrEmpty(txtAnswer.Text.Trim())) { ErrorMessage += "Answer is required <br/>"; } if (string.IsNullOrEmpty(listMonth.SelectedValue.Trim()) || string.IsNullOrEmpty(txtDay.Text.Trim()) || string.IsNullOrEmpty(txtYear.Text.Trim())) { ErrorMessage += "Birthdate is required <br/>"; } DateTime birthDate = DateTime.MinValue; //Build birth date from the values entered and validate it if (!string.IsNullOrEmpty(listMonth.SelectedValue.Trim()) && !string.IsNullOrEmpty(txtDay.Text.Trim()) && !string.IsNullOrEmpty(txtYear.Text.Trim())) { double Num; bool isValidDay, isValidYear; isValidDay = double.TryParse(txtDay.Text, out Num); if (!isValidDay) { ErrorMessage = "Enter a valid date<br/>"; } isValidYear = double.TryParse(txtYear.Text, out Num); if (!isValidYear) { ErrorMessage = "Enter a valid date<br/>"; } if (!IsValidDate(listMonth.SelectedValue, txtDay.Text.Trim(), txtYear.Text.Trim())) { ErrorMessage = "Enter a valid date<br/>"; } } if (!string.IsNullOrEmpty(ErrorMessage)) { lblErrors.Text = ErrorMessage; } //If there is no error message , Valid entry if (string.IsNullOrEmpty(ErrorMessage)) { int month = Int16.Parse(listMonth.SelectedValue); int day = Int16.Parse(txtDay.Text.Trim()); int year = Int16.Parse(txtYear.Text.Trim()); birthDate = new DateTime(year, month, day); //No validation errors, insert the entry string sql = string.Format("INSERT INTO LOGIN (username ,password,firstname,lastname,gender,dob,address,securityQuestion,answer,isnewuser) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", BaseDA.Escape(txtUserId.Text), BaseDA.Escape(txtPassword.Text), BaseDA.Escape(txtFirstName.Text), BaseDA.Escape(txtLastName.Text), BaseDA.Escape(listGender.SelectedValue), birthDate, BaseDA.Escape(txtAddress.Text), BaseDA.Escape(listSecQuestion.SelectedValue), BaseDA.Escape(txtAnswer.Text), "TRUE"); BaseDA.ExecuteNonQuery(sql); Response.Redirect("Default.aspx", true); } } catch (Exception ex) { ErrorMessage = "Exception " + ex; lblErrors.Text = ErrorMessage; } }
protected override void OnPreRender(System.EventArgs e) { base.OnPreRender(e); btnHelp.Attributes.Add("onclick", "window.open('PatientEntryhelp.aspx',null,'left=400, top=100, height=250, width= 400, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no');"); lnkTip.Attributes.Add("onclick", "window.open('HealthTips.aspx',null,'left=400, top=100, height=250, width= 400, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no');"); //ErrorMessage = string.Empty; //Clerks logs in if (IsAdmin == true) { lblpatient.Text = "Patient"; lblstar.Text = "*"; lblpatient.Visible = true; lblstar.Visible = true; lnkHist.Visible = false; lnkTip.Visible = false; listpid.Visible = true; if (this.UserId > 0) { //Fetch all the Patients' list String sql = "SELECT id,firstname,lastname,firstname||' '||lastname as fullname FROM public.Login where isadmin = false and isdoctor = false"; DataSet ds = BaseDA.ExecuteDataSet(sql); if (ds != null) { if (ds.Tables.Count > 0) { listpid.DataSource = ds; listpid.DataTextField = "fullname"; listpid.DataValueField = "fullname"; listpid.DataBind(); } else { this.ErrorMessage += "No Patient Entry Maintained <br />"; } } else { this.ErrorMessage += "DataSet is null"; } } else { this.ErrorMessage += "Please login to the System for further Access <br />"; Response.Redirect("Default.aspx"); } String sqlid = "SELECT id FROM public.Login where isadmin = false and isdoctor = false and firstname||' '||lastname = '" + listpid.SelectedItem.Value + "'"; DataSet dspatid = BaseDA.ExecuteDataSet(sqlid); if (dspatid != null) { if (dspatid.Tables.Count > 0) { DataTable dt = dspatid.Tables[0]; foreach (DataRow dr in dt.Rows) { lblpatid.Text = dr["id"].ToString(); } } } } //Patient logs in if ((IsAdmin == false) && (IsDoctor == false)) { lblpatid.Text = this.UserId.ToString(); listpid.Visible = false; lblpatient.Visible = false; lblstar.Visible = false; lnkHist.Visible = true; lnkTip.Visible = true; } }
protected void btnpatient_Click(object sender, EventArgs e) { try { /*StringBuilder sb = new StringBuilder(); * sb.Append("<script language=\"javascript\">" + "\n"); * sb.Append("function confirmthis() { if(confirm(”Do you want to do save this record?”)) { return true; } else { return false; } }"); * sb.Append("</script>"); * Page.ClientScript.RegisterStartupScript( * this.Page.GetType(), * "OpenPopup", * sb.ToString());*/ ErrorMessage = string.Empty; //clerk if (IsAdmin == true) { //populate list box with patient names String sql1 = "SELECT id FROM public.Login where isadmin = false and isdoctor = false and firstname||' '||lastname = '" + listpid.SelectedValue + "'"; DataSet ds = BaseDA.ExecuteDataSet(sql1); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr != null) { if (dr["Id"] != null) { lblpatid.Text = dr["id"].ToString(); } } } } //patient //store the patient id to be inserted later for new records if (IsAdmin == false) { lblpatid.Text = this.UserId.ToString(); } //Field Validations if (string.IsNullOrEmpty(listpid.Text.Trim())) { this.ErrorMessage += "No Patient Selected <br />"; } if ((string.IsNullOrEmpty(txttemp.Text.Trim()))) { ErrorMessage += "Temperature Is Required. <br />"; } else { if (!CheckIfNumbericTemp(txttemp.Text)) { this.ErrorMessage += "Temperature should be a Numeric Value<br />"; } else { if ((Convert.ToDouble(txttemp.Text) <= 80.00) || (Convert.ToDouble(txttemp.Text) >= 120.00)) { this.ErrorMessage += "Temperature should be a positive number between 80 and 120, decimal numbers are accepted. <br />"; } } } if (string.IsNullOrEmpty(txtbphigh.Text.Trim())) { this.ErrorMessage += "Blood Pressure - HIGH Is Required. <br />"; } else { if (!CheckIfNumberic(txtbphigh.Text)) { this.ErrorMessage += "Blood Pressure - HIGH should be Numeric Value<br />"; } else { if ((txtbphigh.Text.Length) > 5) { this.ErrorMessage += "Invalid Blood Pressure - HIGH value.Digits Cannot be Greater than 5 <br />"; } else { if (((Convert.ToInt32(txtbphigh.Text) <= 0))) { this.ErrorMessage += "Blood Pressure - HIGH value must be positive number, decimal numbers are not accepted. <br />"; } } } } if (string.IsNullOrEmpty(txtbplow.Text.Trim())) { this.ErrorMessage += "Blood Pressure - LOW Is Required. <br />"; } else { if (!CheckIfNumberic(txtbplow.Text)) { this.ErrorMessage += "Blood Pressure - LOW should be Numeric Value<br />"; } else { if ((txtbplow.Text.Length) > 5) { this.ErrorMessage += "Invalid Blood Pressure - LOW value.Digits Cannot be Greater than 5 <br />"; } else { if (((Convert.ToInt32(txtbplow.Text) <= 0))) { this.ErrorMessage += "Blood Pressure - LOW value must be positive number, decimal numbers are not accepted. <br />"; } } } if ((Convert.ToInt32(txtbplow.Text)) > (Convert.ToInt32(txtbphigh.Text))) { this.ErrorMessage += "Blood Pressure - LOW value must be Less Than Blood Pressure - HIGH. <br/>"; } } if (string.IsNullOrEmpty(txtpulserate.Text.Trim())) { this.ErrorMessage += "Pulse Rate Is Required. <br />"; } else { if (!CheckIfNumberic(txtpulserate.Text)) { this.ErrorMessage += "Pulse Rate should be a Numeric Value<br />"; } else { if (((Convert.ToInt32(txtpulserate.Text) <= 20)) || ((Convert.ToInt32(txtpulserate.Text) >= 200))) { this.ErrorMessage += "Pulse Rate must be a positive number between 20 and 200, decimal numbers are not accepted. <br />"; } } } if (string.IsNullOrEmpty(txtglucose.Text.Trim())) { } else { if (!CheckIfNumberic(txtglucose.Text)) { this.ErrorMessage += "Glucose should be a Numeric Value <br />"; } else { if ((Convert.ToInt32(txtglucose.Text) <= 20) || (Convert.ToInt32(txtglucose.Text) >= 300)) { this.ErrorMessage += "Glucose level must be a positive number between 20 and 300. Decimal numbers are not accepted. <br />"; } } } String sql; int dbinsert = 0; bool isConfirmNeeded = false; string confirmMessage = string.Empty; // All server side execution goes here and, if user confirmation is needed, // set isConfirmNeeded to true and create the confirmMessage text. //Insert Records if (string.IsNullOrEmpty(ErrorMessage)) { //glucose is blank, pain and desc are not blank if ((string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue != "Select") && (!string.IsNullOrEmpty(txtdescription.Text.Trim()))) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + "NULL" + "," + listpainlevel.Text + ",'" + txtdescription.Text + "',CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //pain and glucose is blank,desc is not blank if ((string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue.Trim().Contains("Select")) && (!string.IsNullOrEmpty(txtdescription.Text.Trim()))) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + "NULL" + "," + "NULL" + ",'" + txtdescription.Text + "',CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //desc and glucose is blank,pain is not blank if ((string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue != "Select") && (string.IsNullOrEmpty(txtdescription.Text.Trim()))) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + "NULL" + "," + listpainlevel.Text + "," + "NULL" + ",CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //pain and desc is blank, glucose is not blank if ((!string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue.Trim().Contains("Select")) && (string.IsNullOrEmpty(txtdescription.Text.Trim()))) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + txtglucose.Text + "," + "NULL" + "," + "NULL" + ",CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //pain is blank, glucose and desc are not blank if ((listpainlevel.SelectedValue.Trim().Contains("Select")) && (!string.IsNullOrEmpty(txtglucose.Text.Trim())) && (!string.IsNullOrEmpty(txtdescription.Text.Trim()))) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + txtglucose.Text + "," + "NULL" + ",'" + txtdescription.Text + "',CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //desc is blank, glucose and pain is not blank if ((string.IsNullOrEmpty(txtdescription.Text.Trim())) && (!string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue != "Select")) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + txtglucose.Text + "," + listpainlevel.Text + "," + "NULL" + ",CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //all blank if ((string.IsNullOrEmpty(txtdescription.Text.Trim())) && (string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue.Trim().Contains("Select"))) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + "NULL" + "," + "NULL" + "," + "NULL" + ",CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } //all filled if (!string.IsNullOrEmpty(txtdescription.Text.Trim()) && (!string.IsNullOrEmpty(txtglucose.Text.Trim())) && (listpainlevel.SelectedValue != "Select")) { sql = string.Format("INSERT into public.patient (pid,temperature,bphigh,bplow,glucose,painlevel,description,entrydate,pulserate) VALUES (" + lblpatid.Text + "," + txttemp.Text + "," + txtbphigh.Text + "," + txtbplow.Text + "," + txtglucose.Text + "," + listpainlevel.Text + ",'" + txtdescription.Text + "',CURRENT_DATE," + txtpulserate.Text + ")"); dbinsert = BaseDA.ExecuteNonQuery(sql); } if (dbinsert != -1) // Record Inserted Successfuly { StringBuilder sb = new StringBuilder(); sb.Append("<script language=\"javascript\">" + "\n"); sb.Append("alert(\"Record Inserted Successfuly\")"); sb.Append("</script>"); Page.ClientScript.RegisterStartupScript( this.Page.GetType(), "OpenPopup", sb.ToString()); } else //Failed to Insert the Record" { StringBuilder sb = new StringBuilder(); sb.Append("<script language=\"javascript\">" + "\n"); sb.Append("alert(\"Failed to Insert the Record\")"); sb.Append("</script>"); Page.ClientScript.RegisterStartupScript( this.Page.GetType(), "OpenPopup", sb.ToString()); } } } catch (Exception ex) { lblErrors.Text = ErrorMessage; } }