// GoDaddy ConnectionString //SqlConnection con = new SqlConnection(@"Data Source=148.72.232.167 ;Database=techelpDB;Integrated Security=False;user ID=Reem; password=Manal1908 ;Connect Timeout=15;Encrypt=False;Packet Size=4096;"); // Local ConnectionString protected void LoadTicketsDate() { DateBox.Visible = true; Status_list.Visible = false; Meassage_lbl.Visible = false; // GoDaddy ConnectionString //SqlConnection con = new SqlConnection(@"Data Source=148.72.232.167 ;Database=techelpDB;Integrated Security=False;user ID=Reem; password=Manal1908 ;Connect Timeout=15;Encrypt=False;Packet Size=4096;"); // Local ConnectionString SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\apple\Desktop\TecHelpDB.mdf;Integrated Security=True;Connect Timeout=30"); con.Open(); SqlCommand command = new SqlCommand("SELECT TicketNo, Title, Date,Status, Content from Ticket WHERE EmployeeEmail = '" + Session["Email"].ToString() + "' ", con); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(command); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { TicketReport.Visible = true; TicketReport.DataSource = ds; TicketReport.DataBind(); con.Close(); } else { Meassage_lbl.Text = "There is No Tickets To Display"; TicketReport.Visible = false; Meassage_lbl.Visible = true; DateBox.Visible = true; } }
protected void LoadTicketsStatue() { Status_list.Visible = true; // GoDaddy ConnectionString //SqlConnection con = new SqlConnection(@"Data Source=148.72.232.167 ;Database=techelpDB;Integrated Security=False;user ID=Reem; password=Manal1908 ;Connect Timeout=15;Encrypt=False;Packet Size=4096;"); // Local ConnectionString SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\apple\Desktop\TecHelpDB.mdf;Integrated Security=True;Connect Timeout=30"); con.Open(); SqlCommand Deptcommand = new SqlCommand(" Select DepartementNo from Employee Where Email = '" + Session["email"].ToString() + "'", con); DataSet Deptds = new DataSet(); SqlDataAdapter Deptda = new SqlDataAdapter(Deptcommand); Deptda.Fill(Deptds); if (Deptds.Tables[0].Rows.Count > 0) { string getDeptNo = Deptds.Tables[0].Rows[0]["DepartementNo"].ToString(); deptToNo = Int32.Parse(getDeptNo); SqlCommand command = new SqlCommand("SELECT Ticket.TicketNo, Ticket.Title, Ticket.Date, Ticket.Status, Ticket.Content, Employee.Fname + ' ' + Lname AS FullName from Ticket inner join Employee ON Ticket.DepartementNo = " + deptToNo + "AND Ticket.EmployeeEmail = Employee.Email AND Ticket.Status ='" + Status_list.SelectedValue + "'", con); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(command); da.Fill(ds); Status_list.Visible = true; TicketReport.Visible = true; Meassage_lbl.Visible = false; ticketNO_list.Visible = false; DateBox.Visible = false; if (ds.Tables[0].Rows.Count > 0) { TicketReport.DataSource = ds; TicketReport.DataBind(); con.Close(); } else { Meassage_lbl.Text = "There is No Tickets With this statue"; TicketReport.Visible = false; Meassage_lbl.Visible = true; ticketNO_list.Visible = false; DateBox.Visible = false; } } else { Meassage_lbl.Text = "There is No Tickets With this statue"; TicketReport.Visible = false; Meassage_lbl.Visible = true; ticketNO_list.Visible = false; DateBox.Visible = false; } }
protected void Date_TextChanged(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\apple\Desktop\TecHelpDB.mdf;Integrated Security=True;Connect Timeout=30"); try { DateTime dt = DateTime.ParseExact(DateBox.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None); con.Open(); SqlCommand Deptcommand = new SqlCommand(" Select DepartementNo from Employee Where Email = '" + Session["email"].ToString() + "'", con); DataSet Deptds = new DataSet(); SqlDataAdapter Deptda = new SqlDataAdapter(Deptcommand); Deptda.Fill(Deptds); if (Deptds.Tables[0].Rows.Count > 0) { string getDeptNo = Deptds.Tables[0].Rows[0]["DepartementNo"].ToString(); deptToNo = Int32.Parse(getDeptNo); SqlCommand command = new SqlCommand("SELECT Ticket.TicketNo, Ticket.Title, Ticket.Date, Ticket.Status, Ticket.Content, Employee.Fname + ' ' + Lname AS FullName from Ticket inner join Employee ON Ticket.DepartementNo = " + deptToNo + "AND Ticket.EmployeeEmail = Employee.Email AND DATE ='" + dt.Date + "'", con); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(command); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { TicketReport.Visible = true; TicketReport.DataSource = ds; TicketReport.DataBind(); con.Close(); } else { Meassage_lbl.Text = "There is No Tickets To Display"; TicketReport.Visible = false; Meassage_lbl.Visible = true; DateBox.Visible = true; con.Close(); } } } catch { Meassage_lbl.Text = "Incorrect Date Syntax"; Meassage_lbl.Visible = true; con.Close(); } // GoDaddy ConnectionString //SqlConnection con = new SqlConnection(@"Data Source=148.72.232.167 ;Database=techelpDB;Integrated Security=False;user ID=Reem; password=Manal1908 ;Connect Timeout=15;Encrypt=False;Packet Size=4096;"); // Local ConnectionString }