コード例 #1
0
    public void ExportExcel_Click()
    {
        state_load();
        //foreach (char gr in   FlatGrid.Model.ColumnSelected.ToList())
        //  {
        //      TextBox1.Text = gr.ToString();
        //  }
        BindDataSource1();//this is importent kanna
        //GridAssetList = this.FlatGrid.DataSource as List<Assets>;//this is importent kanna
        Syncfusion.JavaScript.DataSources.DataOperations ds = new Syncfusion.JavaScript.DataSources.DataOperations();
        var data1 = ds.Execute(AssetList, this.FlatGrid.Model); // passed the grid dataSource and grid dataSource in DataOperations execute method

        //var data1 = ds.Execute(GridAssetList, this.FlatGrid.Model); // passed the grid dataSource and grid dataSource in DataOperations execute method
        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition", "attachment;filename=AssetRegister.xls");
        Response.Charset     = "";
        Response.ContentType = "application/vnd.ms-excel";
        using (StringWriter sw = new StringWriter())
        {
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            GridView1.AllowPaging = false;
            GridView1.DataSource  = data1;
            GridView1.DataBind();
            GridView1.RenderControl(hw);

            string style = @"<style>.textmode { } </style>";
            Response.Write(style);
            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();
        }
    }
コード例 #2
0
        public async Task <IActionResult> GetMasters(Syncfusion.JavaScript.DataManager dataManagerObj, string value)
        {
            dynamic DataSource = new System.Dynamic.ExpandoObject();

            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();

            switch (value)
            {
            case "Country":
                DataSource = await _masterService.GetAllCountries();

                return(Json(operation.Execute(DataSource, dataManagerObj)));

            case "Modules":
                DataSource = await _masterService.GetAllMasterDetailsbyIds(new List <int>() { 12, 10 });

                return(Json(operation.Execute(DataSource, dataManagerObj)));

            case "SecurityQuestion":
                DataSource = await _masterService.GetAllMasterDetailsbyIds(new List <int>() { ModuleConstantHelper.SecurityModule });

                return(Json(operation.Execute(DataSource, dataManagerObj)));

            default:
                return(null);
            }
        }
コード例 #3
0
        public ActionResult DataEmpleado(Syncfusion.JavaScript.DataManager dm)
        {
            DataResultEmpleado result = new DataResultEmpleado();

            Syncfusion.JavaScript.DataSources.DataOperations dataOperations = new Syncfusion.JavaScript.DataSources.DataOperations();
            result.result = context.Empleados.Include(e => e.Departamento).Include(e => e.Sexo).Include(e => e.EstadoCivil).ToList();
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                result.result = dataOperations.PerformSorting(result.result, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                result.result = dataOperations.PerformWhereFilter(result.result, dm.Where, dm.Where[0].Operator);
                if (!dm.RequiresCounts)
                {
                    return(Json(result.result));
                }
            }
            result.count = context.Empleados.Include(e => e.Departamento).Include(e => e.Sexo).Include(e => e.EstadoCivil).AsQueryable().Count();
            if (dm.Skip != 0)
            {
                result.result = dataOperations.PerformSkip(result.result, dm.Skip);
            }
            if (dm.Take != 0)
            {
                result.result = dataOperations.PerformTake(result.result, dm.Take);
            }

            return(Json(new { result = result.result, count = result.count }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)
        {
            DataResult result = new DataResult();

            Syncfusion.JavaScript.DataSources.DataOperations dataOperations = new Syncfusion.JavaScript.DataSources.DataOperations();

            result.result = context.Albums.Include(a => a.Artista).Include(a => a.Genero).ToList();
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                result.result = dataOperations.PerformSorting(result.result, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                result.result = dataOperations.PerformWhereFilter(result.result, dm.Where, dm.Where[0].Operator);
                if (!dm.RequiresCounts)
                {
                    return(Json(result.result));
                }
            }
            result.count = context.Albums.Include(a => a.Artista).Include(a => a.Genero).AsQueryable().Count();
            if (dm.Skip != 0)
            {
                result.result = dataOperations.PerformSkip(result.result, dm.Skip);
            }
            if (dm.Take != 0)
            {
                result.result = dataOperations.PerformTake(result.result, dm.Take);
            }
            if (dm.Search != null)
            {
                result.result = dataOperations.PerformSearching(result.result, dm.Search);
            }

            return(Json(new { result = result.result, count = result.count }, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public ActionResult GetOutletsForAutocomplete(DataManager value)
        {
            var models = GetTestData();

            IEnumerable <AutocompleteModel> Data = GetTestData();

            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();
            if (value.Where != null && value.Where.Count > 0) //Filtering
            {
                Data = operation.PerformWhereFilter(models, value.Where, value.Where[0].Operator);
            }
            return(Json(Data, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        // GET: Employee
        public ActionResult Index(DataManager value)
        {
            var models = GetTestData();

            IEnumerable Data = GetTestData();

            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();

            var data = operation.Execute(models, value);

            if (value.Where != null && value.Where.Count > 0) //Filtering
            {
                data = operation.PerformWhereFilter(models, value.Where, value.Where[0].Operator);
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }