private void btnConfirm_Click(object sender, EventArgs e) { try { if (rbtnMale.Checked == true) { this.Gender = "Male"; } else { this.Gender = "Female"; } if (rbtnSignle.Checked == true) { this.MaritialStatus = "Single"; } if (rbtnMarried.Checked == true) { this.MaritialStatus = "Married"; } else { this.MaritialStatus = "Widowed"; } GeneratePatientID(); //MessageBox.Show(this.str[1]); //this.ID = "p101"; string sql = "insert into dbo.signin (id,name,password,type) values('" + this.ID + "','" + this.txtName.Text + "','" + this.textBox1.Text + "','patient');"; this.Sql = "insert into dbo.appointmentlist (id,name,gender,contactno,maritalstatus,date,type,description,time,area,age,appid) values('" + this.ID + "','" + this.txtName.Text + "','" + this.Gender + "','" + this.txtContact.Text + "','" + this.MaritialStatus + "','" + this.dtpDate.Text + "','" + this.cmboxVisitType.Text + "','" + this.ckBox.SelectedItem + "','" + this.dtpTime.Text + "','" + this.cmboxSelectArea.Text + "','" + this.txtAge.Text + "','');"; this.Ds = Da.ExecuteQuery(this.Sql); this.Ds = Da.ExecuteQuery(sql); ; FormDoctorList fdl = new FormDoctorList(); fdl.getId(ID); fdl.Visible = true; this.Visible = false; } catch (Exception exc) { MessageBox.Show("An error has occored during saving data\n" + exc.Message); } }
private void btnLogin_Click(object sender, EventArgs e) { try { string id = this.txtId.Text; string sql = @"select * from signin where id = '" + this.txtId.Text + "' and password = '******';"; DataAccess da = new DataAccess(); DataSet ds = da.ExecuteQuery(sql); string name = ds.Tables[0].Rows[0]["name"].ToString(); if (ds.Tables[0].Rows[0]["type"].ToString() == "patient") { //MessageBox.Show(id); FormDoctorList fap = new FormDoctorList(); fap.getId(id); fap.Visible = true; this.Visible = false; } if (ds.Tables[0].Rows[0]["type"].ToString() == "doctor") { //MessageBox.Show(name); FormAppointmentList fal = new FormAppointmentList(); fal.GetName(name); fal.Visible = true; this.Visible = false; } } catch (Exception exc) { MessageBox.Show("An Error Occored in login \n" + exc.Message); } }