Exemple #1
0
    // 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
    }
Exemple #4
0
        public void Print()
        {
            frmViewReport oViewReport = new frmViewReport();

            DataSet ds = new DataSet();

            ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * From OrderTicket Where ID='{0}'", ID), "Ticket"));
            ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * From OrderTicketDetail Where TicketID='{0}'", ID), "TicketDetail"));
            ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * From Product Where Password='******'", this.Password), "Product"));


            TicketReport oRpt = new TicketReport();

            //ds.WriteXml("PrintTicket1.xml", XmlWriteMode.WriteSchema);

            oRpt.SetDataSource(ds);
            oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc.");

            oViewReport.cReport.ReportSource = oRpt;
            oViewReport.Show();
            //oViewReport.cReport.PrintReport();
        }
Exemple #5
0
        public void Print()
        {
            frmViewReport oViewReport = new frmViewReport();

            DataSet ds = new DataSet();

            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Customer c Left Join Orders o On c.CustomerID=o.CustomerID And c.CompanyID=o.CompanyID  Where o.ID='{0}'", this.OrderID), "Customer"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From OrderTicket Where ID='{0}'", ID), "Ticket"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From OrderTicketDetail Where TicketID='{0}'", ID), "TicketDetail"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Orders Where ID='{0}'", this.OrderID), "Orders"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Product Where ProductID='{0}'", this.ProductID), "Product"));


            TicketReport oRpt = new TicketReport();

            //ds.WriteXml("PrintTicket1.xml", XmlWriteMode.WriteSchema);

            oRpt.SetDataSource(ds);
            oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc.");

            oViewReport.cReport.ReportSource = oRpt;
            oViewReport.Show();
            //oViewReport.cReport.PrintReport();
        }