private void btnSave_Click(object sender, EventArgs e) { try { MessageBox.Show("Your ID is :" + this.ID); GenerateDoctorID(); this.Sql = "insert into dbo.DoctorInformation (id,name,contact,stime,etime,area,caddress,specialist) values ('" + this.ID + "','" + this.txtName.Text + "','" + this.txtContactNo.Text + "','" + this.dtmStart.Text + "','" + this.dtmEnd.Text + "','" + this.cbboxArea.Text + "','" + this.txtChamberAddress.Text + "','" + this.cbboxSpecilist.Text + "');"; string sql = "insert into dbo.signin (id,name,password,type) values('" + this.ID + "','" + this.txtName.Text + "','" + this.txtPassword.Text + "','doctor');"; this.Ds = Da.ExecuteQuery(this.Sql); this.Ds = Da.ExecuteQuery(sql); FormAppointmentList fal = new FormAppointmentList(); fal.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); } }