Esempio n. 1
0
        //експорт в Excel
        private void ExportButton_Click(object sender, RoutedEventArgs e)
        {
            string extension = "xlsx";
            //діалог збереження файлу
            SaveFileDialog dialog = new SaveFileDialog()
            {
                FilterIndex      = 0,
                DefaultExt       = extension,
                Title            = "Збереження",
                Filter           = String.Format("Файл {1} (*.{0})|*.{0}|Всі файли (*.*)|*.*", extension, "Excel"),
                RestoreDirectory = true
            };

            if (dialog.ShowDialog() == true)
            {
                using (Stream stream = dialog.OpenFile())
                {
                    //параметри експорту
                    SearchGridView.ExportToXlsx(stream,
                                                new GridViewDocumentExportOptions()
                    {
                        ExportDefaultStyles = true,
                        ShowColumnFooters   = true,
                        ShowColumnHeaders   = true,
                        ShowGroupFooters    = true
                    });
                }
                //Повідомлення про успішне експортування
                MessageBox.Show("Інформацію успішно експортовано!", "Повідомлення",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Esempio n. 2
0
    protected void SearchButton_Click(object sender, EventArgs e)
    {
        int         id      = int.Parse(SearchTextBox.Text);
        List <Book> theList = booksController.RetrieveByIDToList(id);

        SearchGridView.DataSource = theList;
        SearchGridView.DataBind();
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ((Layout)Page.Master).ShowSearch = false;
        var query = Session["query"] as string;

        if (!string.IsNullOrEmpty(query))
        {
            Session["query"] = null;
            SearchGridView.SearchPanelFilter = query;
        }
        SearchGridView.DataSource = BlogPostsProvider.GetBlogPosts();
        SearchGridView.DataBind();
    }
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            string        connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            string        sql     = "SELECT * FROM Catagories WHERE name LIKE '%" + SearchCatagoryTextBox.Text + "%'";
            SqlConnection con     = new SqlConnection(connStr);
            SqlCommand    cmd     = new SqlCommand(sql, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            SearchGridView.DataSource = reader;
            SearchGridView.DataBind();
            con.Close();
        }
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            string        connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            string        sql     = "SELECT Products.name as 'Product Name', price, quantity, Catagories.name as 'Catagory' FROM Products, Catagories where Products.catagory_id=Catagories.catagory_id and Products.name LIKE '%" + SearchTextBox.Text + "%'";
            SqlConnection con     = new SqlConnection(connStr);
            SqlCommand    cmd     = new SqlCommand(sql, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            SearchGridView.DataSource = reader;
            SearchGridView.DataBind();
            con.Close();
        }
Esempio n. 6
0
        private void LoadGridView()
        {
            if (string.IsNullOrWhiteSpace(this.GetSchema()))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(this.GetView()))
            {
                return;
            }

            using (System.Data.DataTable table = MixERP.Net.BusinessLayer.Helpers.FormHelper.GetTable(this.GetSchema(), this.GetView(), "", "", 10))
            {
                SearchGridView.DataSource = table;
                SearchGridView.DataBind();
            }
        }
Esempio n. 7
0
        protected void GoButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.GetSchema()))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(this.GetView()))
            {
                return;
            }

            using (System.Data.DataTable table = MixERP.Net.BusinessLayer.Helpers.FormHelper.GetTable(this.GetSchema(), this.GetView(), FilterDropDownList.SelectedItem.Value, FilterTextBox.Text, 10))
            {
                SearchGridView.DataSource = table;
                SearchGridView.DataBind();
            }
        }
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            string        connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            string        sql     = "update Catagories set name='" + UpdateTextBox.Text + "' where catagory_id=" + UpdateDropDownList.SelectedValue;
            SqlConnection con     = new SqlConnection(connStr);
            SqlCommand    cmd     = new SqlCommand(sql, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            SearchGridView.DataSource = reader;
            SearchGridView.DataBind();
            con.Close();
            this.LoadCatagory();
            this.LoadCatagoryNameForUpdate();
            this.LoadCatagoryName();
        }
Esempio n. 9
0
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            SurveyLogicControl surveyLogicControl = new SurveyLogicControl();

            List <int> answerOptionIdList = new List <int>();


            foreach (ListItem item in BankCheckBoxList.Items)
            {
                if (item.Selected == true)
                {
                    answerOptionIdList.Add(AppUtil.convertStringToInt(item.Value));
                }
            }


            foreach (ListItem item in ServicesCheckBoxList.Items)
            {
                if (item.Selected == true)
                {
                    answerOptionIdList.Add(AppUtil.convertStringToInt(item.Value));
                }
            }
            try
            {
                SearchGridView.DataSource =
                    surveyLogicControl.searchSurveyByAnswerIDLastNameOrGivenNames(answerOptionIdList, LastNameTextBox.Text, GivenNamesTextBox.Text);
                SearchGridView.DataBind();

                if (SearchGridView.Rows.Count == 0)
                {
                    ErrorMessageLabel.Text      = AppConstants.errorNoRecordsFound;
                    ErrorMessageLabel.ForeColor = System.Drawing.Color.Blue;
                }
            }
            catch (AppControlException ex)
            {
                ErrorMessageLabel.Text      = ex.Message;
                ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
            }
            this.clearSearchFields();
        }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["COMP_CODE"] == null || Session["COMP_CODE"].ToString() == "")
        {
            ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
        }

        if (!IsPostBack)
        {
            if (!Session["Approval_Id"].ToString().Equals(""))
            {
                load_sub_grid(Session["Approval_Id"].ToString());
            }
            else
            {
                SearchGridView.DataSource = null;
                SearchGridView.DataBind();
            }
        }
    }
Esempio n. 11
0
 private void load_sub_grid(string request_Id_edit)
 {
     try
     {
         d.con.Open();
         DataSet ds = new DataSet();
         // MySqlDataAdapter dr = new MySqlDataAdapter("select Id,services,pay_service_master.location,priority,pay_service_master.status,additional_comment,EMP_NAME as forword_to,documents from  pay_service_master inner join pay_employee_master on pay_service_master.comp_code=pay_employee_master.comp_code and  pay_service_master.forword_to=pay_employee_master.emp_code   where pay_service_master.comp_code='" + Session["comp_code"].ToString() + "' and pay_service_master.unit_code='" + Session["unit_code"].ToString() + "' order by Id  ", d.con);
         MySqlDataAdapter dr = new MySqlDataAdapter("SELECT ID,COMP_CODE,COMPANY_NAME,CITY,STATE FROM pay_company_master_approval where id = '" + request_Id_edit + "'", d.con);
         dr.Fill(ds);
         SearchGridView.DataSource = ds.Tables[0];
         SearchGridView.DataBind();
         d.con.Close();
         SearchGridView.Visible = true;
     }
     catch (Exception ex)
     { throw ex; }
     finally
     {
         d.con.Close();
     }
 }
Esempio n. 12
0
 protected void Page_Init(object sender, EventArgs e)
 {
     StudentsGridView.EnableDynamicData(typeof(Student));
     SearchGridView.EnableDynamicData(typeof(Student));
 }