Example #1
0
 public ExportDataView()
 {
     InitializeComponent();
     _dataContext = new ExportDataViewModel(Token);
     DataContext = _dataContext;
     SetDialogFilters();
     AddKeyBindings<Dataset>();
 }
        public ActionResult Export(ExportDataViewModel Model)
        {
            DataTableFilterModel filter = new DataTableFilterModel();
            DataTable            dt     = new DataTable("Grid");

            dt.Columns.AddRange(new DataColumn[12] {
                new DataColumn("Sr.No"),
                new DataColumn("Reg.No"),
                new DataColumn("Student Name"),
                new DataColumn("Email"),
                new DataColumn("Mobile"),
                new DataColumn("DOB"),
                new DataColumn("Gender"),
                new DataColumn("Payment"),
                new DataColumn("Course"),
                new DataColumn("Batch"),
                new DataColumn("Reg.Date"),
                new DataColumn("Screening")
            });

            int currDate       = Convert.ToInt32(Session["CurrentYear"]);
            var ScreenningData = registerService.GetScreenningExportData(Model, currDate);

            if (ScreenningData.Count() > 0)
            {
                int i = 1;
                if (Model.IsSelected == "Stand-By")
                {
                    foreach (var item in ScreenningData)
                    {
                        dt.Rows.Add(i, item.RegistartionNo, item.StudentName, item.Email, item.Mobile, item.DOBStr, item.Gender, item.PaymentStatusStr, item.CourseName, item.BatchName, item.RegisterDate, Model.IsSelected);
                        i++;
                    }
                }
                else
                {
                    foreach (var item in ScreenningData)
                    {
                        dt.Rows.Add(i, item.RegistartionNo, item.StudentName, item.Email, item.Mobile, item.DOBStr, item.Gender, item.PaymentStatusStr, item.CourseName, item.BatchName, item.RegisterDate, item.ScreenningStatus);
                        i++;
                    }
                }
            }
            string handle = Guid.NewGuid().ToString();

            using (XLWorkbook wb = new XLWorkbook())
            {
                wb.Worksheets.Add(dt);
                Response.Clear();
                Response.Buffer      = true;
                Response.Charset     = "";
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", "attachment;filename= EmployeeReport.xlsx");
                using (MemoryStream stream = new MemoryStream())
                {
                    wb.SaveAs(stream);
                    stream.Position    = 0;
                    TempData["handle"] = stream.ToArray();
                }
            }
            string FileName = "ScreeningAllCandidateList";

            if (Model.IsSelected == "Pending")
            {
                FileName = "ScreeningPendingCandidateList";
            }
            else if (Model.IsSelected == "Selected")
            {
                FileName = "ScreeningSelectedCandidateList";
            }
            else if (Model.IsSelected == "Rejected")
            {
                FileName = "ScreeningRejectedCandidateList";
            }
            else if (Model.IsSelected == "Stand-By")
            {
                FileName = "ScreeningStandByCandidateList";
            }
            return(Json(FileName, JsonRequestBehavior.AllowGet));
        }
Example #3
0
 public ExportDataView(ExportDataViewModel model)
 {
     InitializeComponent();
     DataContext = model;
 }