protected void ShowDataGridForDoctor_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (e.CommandName == "DeleteDoctor") { DoctorService ds = new DoctorService(); int rowNumber = Convert.ToInt32(e.CommandArgument); string docId = ShowDataGridForDoctor.Rows[rowNumber].Cells[11].Text; //because there is no rtl mode ds.DeleteDoctorFromDateBase(docId); string where = " where CityId=DoctorCity and SpecialityId=DoctorSpecailty"; DataSet data = ds.ShowDoctorForManager(where); ShowDataGridForDoctor.Visible = true; ShowDataGridForUser.Visible = false; ShowDataGridForDoctor.DataSource = data; ShowDataGridForDoctor.DataBind(); } if (e.CommandName == "ContactWithDoctor") { //revil label and buttons to send the message Label4.Visible = true; ThemeTB.Visible = true; Label2.Visible = true; MessageContent.Visible = true; CloseMessage.Visible = true; ResetMessage.Visible = true; SendMessage.Visible = true; MessageContent.Text = ""; int rowNumber = Convert.ToInt32(e.CommandArgument); string id = ShowDataGridForDoctor.Rows[rowNumber].Cells[0].Text; Session["adress"] = "doctor"; Session["id"] = id; } if (e.CommandName == "DoctorVacation") { } }
protected void ShowGrid_Click(object sender, EventArgs e) { ShowDataGridForDoctor.Visible = false; ShowDataGridForUser.Visible = false; //get the selected index in dropdownlist int x = ShowAllData.SelectedIndex; //write query in DoctorService and UserService I DID IT //if index is 1 Doctor, 2 for user, if the index is 0 print Choose who do you want to see DataSet ds; if (x == 1) { DoctorService docSer = new DoctorService(); string where = " where CityId=DoctorCity and SpecialityId=DoctorSpecailty"; ds = docSer.ShowDoctorForManager(where); if (ds.Tables[0].Rows.Count != 0) { ShowDataGridForDoctor.Visible = true; ShowDataGridForUser.Visible = false; ShowDataGridForDoctor.DataSource = ds; ShowDataGridForDoctor.DataBind(); CloseGrid.Visible = true; } } else if (x == 2) { UserService userSer = new UserService(); ds = userSer.ShowUserForManager(); if (ds.Tables[0].Rows.Count != 0) { ShowDataGridForDoctor.Visible = false; ShowDataGridForUser.Visible = true; ShowDataGridForUser.DataSource = ds; ShowDataGridForUser.DataBind(); CloseGrid.Visible = true; } } else { //tell the manager that he need to choose between doctor and user Response.Write("<script>alert('עליך לבחור בין רופאים ללקוחות')</script>"); } //make the close button visible true //check if dataset is empty //write Delete query in DoctorService and UserService //add labels and textbox under the grid view in order to contect //check if the content is valid //add to message service the manegar ID as a doctor //when you show data in one grid the other one is visible false }