Пример #1
0
        public JsonResult UploadAttendance(HttpPostedFileBase ExcelFileAttendence)
        {
            ViewBag.msg = "";
            try
            {
                if (SaveExcelFile(ExcelFileAttendence))
                {
                    objattendanceproperty = new Attendance_Property();
                    objattendanceproperty.tbl_Attendance = ToDataTable(ReadExcelFile(ExcelFileAttendence.FileName));
                    objattendancebll = new Attendance_BLL();
                    var flag = objattendancebll.Insert(objattendanceproperty.tbl_Attendance);
                    if (flag)
                    {
                        ViewBag.msg = "Success";
                    }
                    else
                    {
                        ViewBag.msg = "Contact Administrator";
                    }
                }

                return(Json(new { success = true, msg = ViewBag.msg }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, msg = "Contact Administrator" }, JsonRequestBehavior.AllowGet));
            }
        }