예제 #1
0
        protected void btnsearch_Click(object sender, EventArgs e)
        {
            string EventName;

            lblerror.Text = String.Empty;
            EventName     = txtevents.Text.ToString();
            if (EventName == "")
            {
                lblerror.Text = "*Please Make sure You've typed a Keyword in the Provided Field";
            }
            else
            {
                lblerror.Text = "";
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and e.name LIKE '%" + EventName + "%'";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
        }
예제 #2
0
        /// <summary>
        /// This method is used for binding the datagrid.
        /// </summary>
        public void Bindthedata()
        {
            //GridSearch.CurrentPageIndex=0;
            DataSet       ds  = new DataSet();
            EmployeeClass obj = new EmployeeClass();

            ds = obj.ShowEmployeeInfo(txtEmpID.Text.Trim().ToString(), txtName.Text.Trim().ToString(), txtDesig.Text.Trim().ToString());
            //****
            DataTable dt = ds.Tables[0];
            DataView  dv = new DataView(dt);

            dv.Sort = System.Convert.ToString(Cache["strorderby"]);
            //****
            //if(ds.Tables[0].Rows.Count>0)
            if (dv.Count > 0)
            {
                GridSearch.DataSource = dv;
                GridSearch.DataBind();
                GridSearch.Visible = true;
            }
            else
            {
                MessageBox.Show("Employee Not Found");
                GridSearch.Visible = false;
            }
        }
예제 #3
0
        /// <summary>
        /// This method is used to bindind the datagrid.
        /// </summary>
        public void initGrid()
        {
            try
            {
                PartiesClass obj = new PartiesClass();
                DataSet      ds;
                ds = obj.ShowSupplierInfo(txtSuppID.Text, txtName.Text, txtPlace.Text);

                //******
                DataTable dt = ds.Tables[0];
                DataView  dv = new DataView(dt);
                dv.Sort = System.Convert.ToString(Cache["strorderby"]);
                //******
                if (dv.Count > 0)
                //		if(ds.Tables[0].Rows.Count>0)
                {
                    GridSearch.DataSource = dv;
                    GridSearch.DataBind();
                    GridSearch.Visible = true;
                }
                else
                {
                    MessageBox.Show("Vendor not Found");
                    GridSearch.Visible = false;
                }
            }
            catch (Exception ex)
            {
                CreateLogFiles.ErrorLog("Form:Supplier_List.aspx,Method:initGrid(),Class:PartiesClass.cs.  EXCEPTION: " + ex.Message + "  User_ID: " + uid);
            }
        }
예제 #4
0
        /// <summary>
        /// This is used to binding the grid.
        /// </summary>
        public void gridInit()
        {
            try
            {
                PartiesClass  obj      = new PartiesClass();
                CustomerModel customer = new CustomerModel();
                DataSet       ds;
                ds = obj.ShowCustomerInfo(txtCustID.Text, txtName.Text, txtPlace.Text);
                //****
                DataTable dt = ds.Tables[0];
                DataView  dv = new DataView(dt);
                customer.CustomerID   = txtCustID.Text;
                customer.CustomerName = txtName.Text;
                customer.Place        = txtPlace.Text;

                //dv.Sort = System.Convert.ToString(Cache["strorderby"]);
                //using (var client = new HttpClient())
                //{
                //    client.BaseAddress = new Uri(BaseUri);
                //    var myContent = JsonConvert.SerializeObject(customer);
                //    var buffer = System.Text.Encoding.UTF8.GetBytes(myContent);
                //    var byteContent = new ByteArrayContent(buffer);
                //    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                //    client.DefaultRequestHeaders.Accept.Clear();
                //    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                //    var response = client.PostAsync("api/CustomerController/GetCustomersData", byteContent).Result;
                //    if (response.IsSuccessStatusCode)
                //    {
                //        string responseString = response.Content.ReadAsStringAsync().Result;
                //        dv = JsonConvert.DeserializeObject<DataView>(responseString);
                //    }
                //    else
                //        response.EnsureSuccessStatusCode();
                //}
                //dv.Sort = System.Convert.ToString(Cache["strorderby"]);
                if (dv.Count > 0)
                {
                    GridSearch.DataSource = dv;
                    GridSearch.DataBind();
                    GridSearch.Visible = true;
                }
                else
                {
                    MessageBox.Show("Customer not Found");
                    GridSearch.Visible = false;
                }
            }
            catch (Exception ex)
            {
                CreateLogFiles.ErrorLog("Form:Customer_list.aspx,Method:on_pageload  EXCEPTION: " + ex.Message + " User_ID: " + uid);
            }
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
            string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID";
            SqlConnection  connect2          = new SqlConnection(connectionstring2);
            SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            DataSet        ds2     = new DataSet();

            adapter.Fill(ds2);
            GridSearch.DataSource = ds2;
            GridSearch.DataBind();
        }
        /// <summary>
        /// This method is used for binding the datagrid.
        /// </summary>
        public void Bindthedata()
        {
            //GridSearch.CurrentPageIndex=0;
            DataSet       ds  = new DataSet();
            EmployeeClass obj = new EmployeeClass();

            DataSet dataset = new DataSet();
            string  ID1     = txtEmpID.Text.Trim().ToString();
            string  name1   = txtName.Text.Trim().ToString();
            string  desig1  = txtDesig.Text.Trim().ToString();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(BaseUri);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var Res = client.GetAsync("api/EmployeeClass/ShowEmployeeInfo1?ID1=" + ID1 + "&name1=" + name1 + "&desig1=" + desig1).Result;
                if (Res.IsSuccessStatusCode)
                {
                    var id = Res.Content.ReadAsStringAsync().Result;
                    dataset = JsonConvert.DeserializeObject <DataSet>(id);
                }
            }
            //ds =obj.ShowEmployeeInfo(txtEmpID.Text.Trim ().ToString(),txtName.Text.Trim ().ToString() , txtDesig.Text.Trim ().ToString());
            //
            ds = dataset;
            DataTable dt = ds.Tables[0];
            DataView  dv = new DataView(dt);

            dv.Sort = System.Convert.ToString(Cache["strorderby"]);
            //****
            //if(ds.Tables[0].Rows.Count>0)
            if (dv.Count > 0)
            {
                GridSearch.DataSource = dv;
                GridSearch.DataBind();
                GridSearch.Visible = true;
            }
            else
            {
                MessageBox.Show("Employee Not Found");
                GridSearch.Visible = false;
            }
        }
예제 #7
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //below code does not work.....
            LearnEFEntities db  = new LearnEFEntities();
            int             ret = db.SearchEmployee(txtFirstNameSearch.Text, txtCitySearch.Text);

            db.Dispose();

            using (var context = new LearnEFEntities())
            {
                var firstNameParameter = new SqlParameter("@FirstName", txtFirstNameSearch.Text);
                var cityParameter      = new SqlParameter("@City", txtCitySearch.Text);
                var result             = context.Database
                                         .SqlQuery <Employee>("SearchEmployee @FirstName, @City", firstNameParameter, cityParameter)
                                         .ToList();
                //bind grid
                GridSearch.DataSource = result;
                GridSearch.DataBind();
            }
        }
예제 #8
0
 protected void GridSearch_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridSearch.PageIndex = e.NewPageIndex;
     GridSearch.DataBind();
 }
예제 #9
0
        protected void DropDownTickets_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DropDownTickets.SelectedValue == "$1.00-$10.00")
            {
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and a.price between 1 and 10 order by a.price ASC";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
            if (DropDownTickets.SelectedValue == "$11.00-$20.00")
            {
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and a.price between 11 and 20 order by a.price ASC";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
            if (DropDownTickets.SelectedValue == "$21.00-$30.00")
            {
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and a.price between 21 and 30 order by a.price ASC";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
            if (DropDownTickets.SelectedValue == "$31.00-$40.00")
            {
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and a.price between 31 and 40 order by a.price ASC";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
            if (DropDownTickets.SelectedValue == "$41.00-$50.00")
            {
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and a.price between 41 and 50 order by a.price ASC";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
            if (DropDownTickets.SelectedValue == "$50.00 or Above")
            {
                string         connectionstring2 = WebConfigurationManager.ConnectionStrings["CapstoneSQLConn"].ConnectionString;
                string         selectsql2        = "select e.name as 'Event', c.name as 'Artist', e.startDate as 'Date', e.startTime as 'Time', v.name as 'Venue', a.price as 'Ticket Price', s.name as 'Seat Section' from [Event] as e, [Venue] as v, [Section] as s, [AvailableTickets] as a, [Artist] as c where e.venueID = v.venueID and e.eventID = a.eventID and a.sectionID = s.sectionID and e.artistID = c.artistID and a.price > 50 order by a.price ASC";
                SqlConnection  connect2          = new SqlConnection(connectionstring2);
                SqlCommand     cmd     = new SqlCommand(selectsql2, connect2);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds2     = new DataSet();
                adapter.Fill(ds2);
                GridSearch.DataSource = ds2;
                GridSearch.DataBind();

                if (ds2.Tables[0].Rows.Count == 0)
                {
                    lblerror.Text = "*Your Search Returned Zero Result!!, Please Try Searching Again!!!";
                }
                else
                {
                    lblerror.Text = "";
                }
            }
        }