Beispiel #1
0
        public JsonResult LoadEvaluationDetailsForGrid(string dept = "", string fromDate = "", string toDate = "")
        {
            string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();

            if (dept == "--Select--")
            {
                dept = "";
            }
            if (fromDate == "--Select--")
            {
                fromDate = "";
            }
            else if (!string.IsNullOrEmpty(fromDate))
            {
                string[] monthYear = fromDate.Split(' ');
                string   month     = monthYear[0].Substring(0, 3);
                string   year      = monthYear[1];
                fromDate = month + "-" + year;
            }

            if (toDate == "--Select--")
            {
                toDate = "";
            }
            else if (!string.IsNullOrEmpty(toDate))
            {
                string[] monthYear = toDate.Split(' ');
                string   month     = monthYear[0].Substring(0, 3);
                string   year      = monthYear[1];
                toDate = month + "-" + year;
            }
            _repoResponse   = new RepositoryResponse();
            _evaluationRepo = new EvaluationRepo();
            _repoResponse   = _evaluationRepo.LoadAllEvaluationData(_loggedInUserID, dept, fromDate, toDate);
            if (_repoResponse.success)
            {
                var _sa = new JsonSerializerSettings();
                return(Json(_repoResponse.Data));
            }
            else
            {
                return(Json(new { success = _repoResponse.success.ToString(), message = _repoResponse.message }));
            }
        }
Beispiel #2
0
        public ActionResult EvaluationDataExport()
        {
            string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();

            _evaluationRepo = new EvaluationRepo();
            _repoResponse   = new RepositoryResponse();
            _repoResponse   = _evaluationRepo.LoadAllEvaluationData(_loggedInUserID);

            if (_repoResponse.success)
            {
                DataSet ds    = Assistant.ToDataSet(_repoResponse.Data);
                string  path  = HostingEnvironment.MapPath("~/bin/Pdf/");
                string  fName = "SOM_EvaluationDetails_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xlsx";

                if (Assistant.DatasetToExcelExport(ds, path, fName, 20, "EvaluationDetails")) // 4th parameter is field Count
                {
                    byte[] fileBytes = System.IO.File.ReadAllBytes(path + "" + fName);

                    return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fName));
                }
            }
            return(Json(new { success = _repoResponse.success.ToString(), message = _repoResponse.message }));
        }