Ejemplo n.º 1
0
        private void btnSearchReport_Click(object sender, EventArgs e)
        {
            LogDAL      logDAL       = new LogDAL();
            CategoryDAL categorDAL   = new CategoryDAL();
            var         categoryName = "";
            var         statusName   = "";
            var         typeName     = "";

            if (cmbCategoryReport.Text != "")
            {
                var categoryId = Convert.ToInt32(cmbCategoryReport.Text.Split('-')[0]);
                categoryName = categorDAL.GetByFilter(x => x.Id == categoryId).Name;
            }
            if (cmbStatusReport.Text != "")
            {
                var statusId = Convert.ToInt32(cmbStatusReport.Text.Split('-')[0]);
                statusName = ((ProductStatusEnum)statusId).ToString();
            }
            if (cmbTypeReport.Text != "")
            {
                var typeId = Convert.ToInt32(cmbTypeReport.Text.Split('-')[0]);
                typeName = ((LogTypeEnum)typeId).ToString();
            }
            List <string> SearchString = new List <string>
            {
                tbxProductNameReport.Text,
                tbxPriceReport.Text,
                categoryName,
                tbxCountReport.Text,
                tbxSoldReport.Text,
                tbxDescriptionReport.Text,
                statusName,
                typeName,
            };

            if (CurrentUser.Type == 2)
            {
                logDAL.GetGridAdvancedSearch(dgvReport, SearchString);
            }
            else
            {
                logDAL.GetGridAdvancedSearch(dgvReport, SearchString, CurrentUser.Email);
            }
        }