protected void ShowDataGridForUser_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (e.CommandName == "DeleteUser") { UserService us = new UserService(); int rowNumber = Convert.ToInt32(e.CommandArgument); string userId = ShowDataGridForUser.Rows[rowNumber].Cells[8].Text; //because there is no rtl mode Label1.Text = userId; us.DeleteUserFromDateBase(userId); DataSet data = us.ShowUserForManager(); ShowDataGridForDoctor.Visible = false; ShowDataGridForUser.Visible = true; ShowDataGridForUser.DataSource = data; ShowDataGridForUser.DataBind(); } if (e.CommandName == "ContactWithUser") { //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 = ShowDataGridForUser.Rows[rowNumber].Cells[0].Text; Session["adress"] = "user"; Session["id"] = id; } }
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 }