public void PostImportExcel()
        {
            string _fileExt = string.Empty;
            int    _code    = 0;
            string _message = string.Empty;

            try
            {
                HttpPostedFile _uploadFiles = Request.Files["uploadFile"] as HttpPostedFile;

                if (_uploadFiles == null || _uploadFiles.FileName.Length < 3)
                {
                    _message = "您没有选择要上传的文件!";
                    _code    = -4;
                }
                else
                {
                    _fileExt = Path.GetExtension(_uploadFiles.FileName).ToLower(); //获取文件扩展名
                    String[] _allowedExt = { ".xls", ".xlsx" };                    //允许上传的文件格式
                    if (!_allowedExt.Contains(_fileExt))
                    {
                        _message = "您上传的格式为" + _fileExt + ", 本统只接受扩展名为" + string.Join("、", _allowedExt) + "格式文件";
                        _code    = -3;
                    }
                    else if (_uploadFiles.ContentLength == 0)
                    {
                        _message = "上传的内容为空!";
                        _code    = -2;
                    }
                    else if (_uploadFiles.ContentLength > 1024 * 1024 * 8)
                    {
                        _message = "您上传的文件超过了8M!";
                        _code    = -1;
                    }
                }

                if (_code == 0)
                {
                    string _fileName    = ShortFileNameUtil.ShortFileName(Guid.NewGuid().ToString()) + _fileExt;
                    string _virtualPath = "/UploadFiles/registrationXls/";

                    string _physicalPath = HttpContext.Server.MapPath(_virtualPath);
                    if (!Directory.Exists(_physicalPath))
                    {
                        Directory.CreateDirectory(_physicalPath);
                    }
                    string _fullPath = _physicalPath + _fileName;
                    _uploadFiles.SaveAs(_fullPath);

                    DataTable _employeeData = JNyuluUtils.ImportExcel(_fullPath);
                    int       _i            = 0;

                    StringBuilder _result = new StringBuilder();
                    _result.AppendLine("上传路径为:" + _virtualPath + _fileName);
                    _result.AppendLine("Excel解析日志记录:");
                    foreach (DataRow dr in _employeeData.Rows)
                    {
                        _i++;
                        try
                        {
                            //["学籍号"] ["学生姓名"] dr["报名时间"] dr["班级"] dr["原校"] dr["原来年级"] dr["金额"] dr["备注"]
                            string _name = dr["学籍号"].ToString() + "";
                            if (!string.IsNullOrEmpty(_name))
                            {
                                Employee _employee = _employeeService.GetEmployeeByName(_name);
                                if (_employee != null)
                                {
                                    string _gradeName = dr["原来年级"].ToString() + "";
                                    Grade  _grade     = _gradeService.GetGradeByName(_gradeName);
                                    if (_grade != null)
                                    {
                                        int        _stID           = 0;
                                        string     _schoolTermName = dr["班级"].ToString();
                                        SchoolTerm _schoolTerm     = _schoolTermService.GetBaseSchoolTermByName(_schoolTermName);
                                        if (_schoolTerm != null)
                                        {
                                            _stID = _schoolTerm.ID;
                                        }

                                        int _schoolFee = 0;
                                        int.TryParse(dr["金额"].ToString(), out _schoolFee);

                                        Registration _registration = new Registration();
                                        _registration.EmployeeID = _employee.ID;

                                        _registration.SchoolName = dr["原校"].ToString() + "";
                                        _registration.GradeID    = _grade.ID;
                                        _registration.GradeName  = _grade.Name;

                                        _registration.STID      = _stID;
                                        _registration.SchoolFee = _schoolFee;
                                        _registration.Remark    = dr["备注"].ToString() + "";

                                        DateTime _recordDate = DateTime.Today;
                                        if (DateTime.TryParse(dr["报名时间"].ToString() + "", out _recordDate))
                                        {
                                            _registration.RecordDate = _recordDate;
                                        }
                                        else
                                        {
                                            LogHelper.Info("记录[" + _i + "]考试时间格式错误");
                                            _result.AppendLine("记录[" + _i + "]考试时间格式错误");
                                            continue;
                                        }

                                        _code = _registrationService.InsertRegistration(_registration);
                                    }
                                    else
                                    {
                                        LogHelper.Error("记录[" + _i + "]原来年级" + _gradeName + "不存在");
                                        _result.AppendLine("记录[" + _i + "]原来年级" + _gradeName + "不存在");
                                    }
                                }
                                else
                                {
                                    LogHelper.Error("记录[" + _i + "]学籍号" + _name + "不存在,您必须选注册学籍号");
                                    _result.AppendLine("记录[" + _i + "]学籍号" + _name + "不存在,您必须选注册学籍号");
                                }
                            }
                            else
                            {
                                LogHelper.Error("记录[" + _i + "] 中的学籍号不能为空");
                                _result.AppendLine("记录[" + _i + "] 中的学籍号不能为空");
                            }
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Error("记录[" + _i + "]导入出错 " + ex.ToString());
                            _result.AppendLine("记录[" + _i + "]导入出错 " + ex.ToString());
                            continue;
                        }
                        _i++;
                    }

                    _message = _result.ToString();
                }
            }
            catch (Exception ex)
            {
                _code    = -1;
                _message = ex.Message;
            }
            finally
            {
                RenderText("{code: " + _code + ",message: '" + _message + "'}");

                CancelLayout();
            }
        }
Esempio n. 2
0
        public void PostImportExcel()
        {
            string _fileExt = string.Empty;
            int    _code    = 0;
            string _message = string.Empty;

            try
            {
                HttpPostedFile _uploadFiles = Request.Files["uploadFile"] as HttpPostedFile;

                if (_uploadFiles == null || _uploadFiles.FileName.Length < 3)
                {
                    _message = "您没有选择要上传的文件!";
                    _code    = -4;
                }
                else
                {
                    _fileExt = Path.GetExtension(_uploadFiles.FileName).ToLower(); //获取文件扩展名
                    String[] _allowedExt = { ".xls", ".xlsx" };                    //允许上传的文件格式
                    if (!_allowedExt.Contains(_fileExt))
                    {
                        _message = "您上传的格式为" + _fileExt + ", 本统只接受扩展名为" + string.Join("、", _allowedExt) + "格式文件";
                        _code    = -3;
                    }
                    else if (_uploadFiles.ContentLength == 0)
                    {
                        _message = "上传的内容为空!";
                        _code    = -2;
                    }
                    else if (_uploadFiles.ContentLength > 1024 * 1024 * 8)
                    {
                        _message = "您上传的文件超过了8M!";
                        _code    = -1;
                    }
                }

                if (_code == 0)
                {
                    string _fileName    = ShortFileNameUtil.ShortFileName(Guid.NewGuid().ToString()) + _fileExt;
                    string _virtualPath = "/UploadFiles/syllabusXls/";

                    string _physicalPath = HttpContext.Server.MapPath(_virtualPath);
                    if (!Directory.Exists(_physicalPath))
                    {
                        Directory.CreateDirectory(_physicalPath);
                    }
                    string _fullPath = _physicalPath + _fileName;
                    _uploadFiles.SaveAs(_fullPath);

                    DataTable _employeeData = JNyuluUtils.ImportExcel(_fullPath);
                    int       _i            = 0;

                    StringBuilder _result = new StringBuilder();
                    _result.AppendLine("上传路径为:" + _virtualPath + _fileName);
                    _result.AppendLine("Excel解析日志记录:");
                    foreach (DataRow dr in _employeeData.Rows)
                    {
                        try
                        {
                            //dr["班级"] dr["学籍号"] dr["学生姓名"] dr["课程表路径"];
                            string   _name     = dr["学籍号"].ToString() + "";
                            Employee _employee = _employeeService.GetEmployeeByName(_name);

                            if (_employee == null)
                            {
                                LogHelper.Info("记录[" + _i + "]学籍:" + _name + "  不存在");
                                _result.AppendLine("记录[" + _i + "]学籍:" + _name + "  不存在");
                                continue;
                            }

                            int        _stID           = 0;
                            string     _schoolTermName = dr["班级"].ToString() + "";
                            SchoolTerm _schoolTerm     = _schoolTermService.GetBaseSchoolTermByName(_schoolTermName);

                            if (_schoolTerm == null)
                            {
                                LogHelper.Info("记录[" + _i + "]班级:" + _schoolTermName + "  不存在");
                                _result.AppendLine("记录[" + _i + "]班级:" + _schoolTermName + "  不存在");
                                continue;
                            }

                            if (_employee.ID > 0 && _stID > 0)
                            {
                                Syllabus _syllabus = new Syllabus();
                                _syllabus.EmployeeID = _employee.ID;
                                _syllabus.STID       = _stID;

                                _syllabus.SyllabusUrl = _virtualPath + dr["课程表路径"].ToString() + "";

                                IList <Syllabus> _syllabusList = _syllabusService.GetBaseSyllabus(_syllabus);
                                if (_syllabusList.Count > 0)
                                {
                                    _code = _syllabusList[0].ID;
                                    _syllabusService.UpdateSyllabus(_syllabus);
                                }
                                else
                                {
                                    _code = _syllabusService.InsertSyllabus(_syllabus);
                                }
                                if (_code > 0)
                                {
                                    LogHelper.Info("记录[" + _i + "]导入成功");
                                    _result.AppendLine("记录[" + _i + "]导入成功");
                                }

                                _code = _syllabus.ID;
                            }
                        }
                        catch (Exception ex)
                        {
                            _result.AppendLine(ex.ToString());
                            LogHelper.Error(ex.ToString());
                            continue;
                        }
                        _i++;
                    }

                    _message = _result.ToString();
                }
            }
            catch (Exception ex)
            {
                _code    = -1;
                _message = ex.Message;
            }
            finally
            {
                RenderText("{code: " + _code + ",message: \"" + _message.Replace(@"\", @"\\") + "\"}");

                CancelLayout();
            }
        }
        public void PostImportExcel()
        {
            string _fileExt = string.Empty;
            int    _code    = 0;
            string _message = string.Empty;

            try
            {
                HttpPostedFile _uploadFiles = Request.Files["uploadFile"] as HttpPostedFile;

                if (_uploadFiles == null || _uploadFiles.FileName.Length < 3)
                {
                    _message = "您没有选择要上传的文件!";
                    _code    = -4;
                }
                else
                {
                    _fileExt = Path.GetExtension(_uploadFiles.FileName).ToLower(); //获取文件扩展名
                    String[] _allowedExt = { ".xls", ".xlsx" };                    //允许上传的文件格式
                    if (!_allowedExt.Contains(_fileExt))
                    {
                        _message = "您上传的格式为" + _fileExt + ", 本统只接受扩展名为" + string.Join("、", _allowedExt) + "格式文件";
                        _code    = -3;
                    }
                    else if (_uploadFiles.ContentLength == 0)
                    {
                        _message = "上传的内容为空!";
                        _code    = -2;
                    }
                    else if (_uploadFiles.ContentLength > 1024 * 1024 * 8)
                    {
                        _message = "您上传的文件超过了8M!";
                        _code    = -1;
                    }
                }

                if (_code == 0)
                {
                    string _fileName    = ShortFileNameUtil.ShortFileName(Guid.NewGuid().ToString()) + _fileExt;
                    string _virtualPath = "/UploadFiles/reportCardXls/";

                    string _physicalPath = HttpContext.Server.MapPath(_virtualPath);
                    if (!Directory.Exists(_physicalPath))
                    {
                        Directory.CreateDirectory(_physicalPath);
                    }
                    string _fullPath = _physicalPath + _fileName;
                    _uploadFiles.SaveAs(_fullPath);

                    DataTable _employeeData = JNyuluUtils.ImportExcel(_fullPath);
                    int       _i            = 0;

                    StringBuilder _result = new StringBuilder();
                    _result.AppendLine("上传路径为:" + _virtualPath + _fileName);
                    _result.AppendLine("导入记录数为:" + _employeeData.Rows.Count + " , Excel解析日志记录:");
                    foreach (DataRow dr in _employeeData.Rows)
                    {
                        _i++;
                        try
                        {
                            //dr["班级"] dr["学籍号"] dr["学生姓名"] dr["考试时间"] dr["试卷路径"];
                            string   _name     = dr["学籍号"].ToString() + "";
                            Employee _employee = _employeeService.GetEmployeeByName(_name);

                            if (_employee == null)
                            {
                                LogHelper.Info("记录[" + _i + "]学籍:" + _name + "  不存在");
                                _result.AppendLine("记录[" + _i + "]学籍:" + _name + "  不存在");
                                continue;
                            }

                            string     _schoolTermName = dr["班级"].ToString() + "";
                            SchoolTerm _schoolTerm     = _schoolTermService.GetBaseSchoolTermByName(_schoolTermName);
                            if (_schoolTerm == null)
                            {
                                LogHelper.Info("记录[" + _i + "]班级:" + _schoolTermName + "  不存在");
                                _result.AppendLine("记录[" + _i + "]班级:" + _schoolTermName + "  不存在");
                                continue;
                            }

                            _result.AppendLine("记录[" + _i + "] employeeID:[" + _employee.ID + "]  班级ID:[" + _schoolTerm.ID + "]");

                            if (_employee.ID > 0 && _schoolTerm.ID > 0)
                            {
                                ReportCard _reportCard = new ReportCard();
                                _reportCard.EmployeeID = _employee.ID;
                                _reportCard.STID       = _schoolTerm.ID;

                                DateTime _examDate = DateTime.Today;
                                if (DateTime.TryParse(dr["考试时间"].ToString() + "", out _examDate))
                                {
                                    _reportCard.ExamDate = _examDate;
                                }
                                else
                                {
                                    LogHelper.Info("记录[" + _i + "]考试时间格式错误");
                                    _result.AppendLine("记录[" + _i + "]考试时间格式错误");
                                    continue;
                                }
                                string _testPaper = dr["试卷路径"].ToString() + "";
                                if (!string.IsNullOrEmpty(_testPaper))
                                {
                                    _reportCard.TestPaperUrl = "/UploadFiles/testPaperFiles/" + _testPaper;
                                }

                                IDictionary _hash = new Hashtable();

                                _hash.Add("EmployeeID", _reportCard.EmployeeID);
                                _hash.Add("STID", _reportCard.STID);
                                _hash.Add("TestPaperUrl", _reportCard.TestPaperUrl);

                                IList <ReportCard> _reportCardList = _reportCardService.GetReportCard(_hash);
                                _result.AppendLine("记录[" + _i + "](" + _reportCard.TestPaperUrl + ") _reportCardList.Count:" + _reportCardList.Count);
                                if (_reportCardList.Count > 0)
                                {
                                    _reportCard.ID = _reportCardList[0].ID;
                                    _code          = _reportCardService.UpdateReportCard(_reportCard);
                                }
                                else
                                {
                                    _reportCard.ID = _reportCardService.InsertReportCard(_reportCard);
                                }
                                _result.AppendLine("记录[" + _i + "] _reportCard.ID:" + _reportCard.ID);

                                _code = _reportCard.ID;
                            }
                        }
                        catch (Exception ex)
                        {
                            _result.AppendLine(ex.ToString());
                            LogHelper.Error(ex.ToString());
                            continue;
                        }
                    }

                    _message = _result.ToString();
                }
            }
            catch (Exception ex)
            {
                _code    = -1;
                _message = ex.Message;
            }
            finally
            {
                RenderText("{code: " + _code + ",message: \"" + _message.Replace(@"\", @"\\") + "\"}");

                CancelLayout();
            }
        }
Esempio n. 4
0
        public void PostImportExcel()
        {
            string _fileExt = string.Empty;
            int    _code    = 0;
            string _message = string.Empty;

            try
            {
                HttpPostedFile _uploadFiles = Request.Files["uploadFile"] as HttpPostedFile;

                if (_uploadFiles == null || _uploadFiles.FileName.Length < 3)
                {
                    _message = "您没有选择要上传的文件!";
                    _code    = -4;
                }
                else
                {
                    _fileExt = Path.GetExtension(_uploadFiles.FileName).ToLower(); //获取文件扩展名
                    String[] _allowedExt = { ".xls", ".xlsx" };                    //允许上传的文件格式
                    if (!_allowedExt.Contains(_fileExt))
                    {
                        _message = "您上传的格式为" + _fileExt + ", 本统只接受扩展名为" + string.Join("、", _allowedExt) + "格式文件";
                        _code    = -3;
                    }
                    else if (_uploadFiles.ContentLength == 0)
                    {
                        _message = "上传的内容为空!";
                        _code    = -2;
                    }
                    else if (_uploadFiles.ContentLength > 1024 * 1024 * 8)
                    {
                        _message = "您上传的文件超过了8M!";
                        _code    = -1;
                    }
                }

                if (_code == 0)
                {
                    string _fileName    = ShortFileNameUtil.ShortFileName(Guid.NewGuid().ToString()) + _fileExt;
                    string _virtualPath = "/UploadFiles/scheNoticeXls/";

                    string _physicalPath = HttpContext.Server.MapPath(_virtualPath);
                    if (!Directory.Exists(_physicalPath))
                    {
                        Directory.CreateDirectory(_physicalPath);
                    }
                    string _fullPath = _physicalPath + _fileName;
                    _uploadFiles.SaveAs(_fullPath);

                    DataTable _employeeData = JNyuluUtils.ImportExcel(_fullPath);
                    int       _i            = 0;

                    StringBuilder _result = new StringBuilder();
                    _result.AppendLine("上传路径为:" + _virtualPath + _fileName);
                    _result.AppendLine("Excel解析日志记录:");
                    foreach (DataRow dr in _employeeData.Rows)
                    {
                        try
                        {
                            //dr["电话"] dr["姓名"] dr["内容"]
                            string _userName = dr["电话"].ToString() + "";
                            string _trueName = dr["姓名"].ToString() + "";
                            string _context  = dr["内容"].ToString() + "";

                            if (!string.IsNullOrEmpty(_userName) && !string.IsNullOrEmpty(_trueName) && !string.IsNullOrEmpty(_context))
                            {
                                ScheNotice _scheNotice = new ScheNotice();
                                _scheNotice.UserName = _userName;
                                _scheNotice.TrueName = _trueName;
                                _scheNotice.Context  = _context;

                                {
                                    _code = _scheNoticeService.InsertScheNotice(_scheNotice);
                                }
                                if (_code > 0)
                                {
                                    LogHelper.Info("记录[" + _i + "]导入成功");
                                    _result.AppendLine("记录[" + _i + "]导入成功");
                                }

                                _code = _scheNotice.ID;
                            }
                        }
                        catch (Exception ex)
                        {
                            _result.AppendLine(ex.ToString());
                            LogHelper.Error(ex.ToString());
                            continue;
                        }
                        _i++;
                    }

                    _message = _result.ToString();
                }
            }
            catch (Exception ex)
            {
                _code    = -1;
                _message = ex.Message;
            }
            finally
            {
                RenderText("{code: " + _code + ",message: \"" + _message.Replace(@"\", @"\\") + "\"}");

                CancelLayout();
            }
        }
Esempio n. 5
0
        public void UploadFiles(string editor, int returnType = 0)
        {
            int    _code    = 0;
            string _message = string.Empty;
            String _fileExt = string.Empty;

            try
            {
                HttpPostedFile _uploadFiles = Request.Files["uploadFile"] as HttpPostedFile;

                if (_uploadFiles == null || _uploadFiles.FileName.Length < 3)
                {
                    _message = "您没有选择要上传的文件!";
                    _code    = -4;
                }
                else
                {
                    _fileExt = Path.GetExtension(_uploadFiles.FileName).ToLower();                             //获取文件扩展名
                    String[] _allowedExt = { ".gif", ".jpg", ".png", ".zip", ".rar", ".doc", ".swf", ".xls" }; //允许上传的文件格式

                    if (!_allowedExt.Contains(_fileExt))
                    {
                        _message = "系统只接受扩展名为" + string.Join("、", _allowedExt) + "格式文件";
                        _code    = -3;
                    }
                    else if (_uploadFiles.ContentLength == 0)
                    {
                        _message = "上传的内容为空!";
                        _code    = -2;
                    }
                    else if (_uploadFiles.ContentLength > 1024 * 1024 * 10)
                    {
                        _message = "您上传的文件超过了10M!";
                        _code    = -1;
                    }
                }

                if (_code == 0)
                {
                    string _fileName = ShortFileNameUtil.ShortFileName(Guid.NewGuid().ToString()) + _fileExt;
                    _uploadFilePath += _fileExt.TrimStart('.') + "/" + DateTime.Today.ToString("yyyy-MM-dd") + @"/";
                    if (!Directory.Exists(_uploadFilePath))
                    {
                        Directory.CreateDirectory(_uploadFilePath);
                    }

                    string _savePath = _uploadFilePath + _fileName;
                    _uploadFiles.SaveAs(_savePath);

                    _message = "/UploadFiles/" + _fileExt.TrimStart('.') + "/" + DateTime.Today.ToString("yyyy-MM-dd") + @"/" + _fileName;
                }
            }
            catch (Exception ex)
            {
                _code    = -1;
                _message = ex.Message;
            }
            finally
            {
                if (returnType == 1 && _code == 0)
                {
                    StringBuilder _jsString = new StringBuilder();

                    _jsString.AppendLine("<script>");
                    _jsString.AppendLine("window.parent." + editor + ".insertContent(\"<img src='" + _message + "'/>\")");
                    _jsString.AppendLine("window.parent." + editor + ".plugins.upload.finish();");
                    _jsString.AppendLine("</script>");

                    RenderText(_jsString.ToString());
                }
                else
                {
                    RenderText("{\"code\":\"" + _code + "\",\"message\": \"" + _message.Replace(@"\", @"\\") + "\"}");
                }

                CancelLayout();
            }
        }
Esempio n. 6
0
        public void PostImportExcel()
        {
            string _fileExt = string.Empty;
            int    _code    = 0;
            string _message = string.Empty;

            try
            {
                HttpPostedFile _uploadFiles = Request.Files["uploadFile"] as HttpPostedFile;

                if (_uploadFiles == null || _uploadFiles.FileName.Length < 3)
                {
                    _message = "您没有选择要上传的文件!";
                    _code    = -4;
                }
                else
                {
                    _fileExt = Path.GetExtension(_uploadFiles.FileName).ToLower(); //获取文件扩展名
                    String[] _allowedExt = { ".xls", ".xlsx" };                    //允许上传的文件格式
                    if (!_allowedExt.Contains(_fileExt))
                    {
                        _message = "您上传的格式为" + _fileExt + ", 本统只接受扩展名为" + string.Join("、", _allowedExt) + "格式文件";
                        _code    = -3;
                    }
                    else if (_uploadFiles.ContentLength == 0)
                    {
                        _message = "上传的内容为空!";
                        _code    = -2;
                    }
                    else if (_uploadFiles.ContentLength > 1024 * 1024 * 8)
                    {
                        _message = "您上传的文件超过了8M!";
                        _code    = -1;
                    }
                }

                if (_code == 0)
                {
                    string _fileName    = ShortFileNameUtil.ShortFileName(Guid.NewGuid().ToString()) + _fileExt;
                    string _virtualPath = "/UploadFiles/employeeXls/";

                    string _physicalPath = HttpContext.Server.MapPath(_virtualPath);
                    if (!Directory.Exists(_physicalPath))
                    {
                        Directory.CreateDirectory(_physicalPath);
                    }
                    string _fullPath = _physicalPath + _fileName;
                    _uploadFiles.SaveAs(_fullPath);

                    DataTable _employeeData = JNyuluUtils.ImportExcel(_fullPath);
                    int       _i            = 0;

                    StringBuilder _result = new StringBuilder();
                    _result.AppendLine("上传路径为:" + _virtualPath + _fileName);
                    _result.AppendLine("Excel解析日志记录:");
                    foreach (DataRow dr in _employeeData.Rows)
                    {
                        _i++;
                        try
                        {
                            //["学籍号"] dr["学生姓名"] dr["家长手机"] dr["家庭电话"] dr["备注"]
                            string _name = dr["学籍号"].ToString() + "";
                            if (!string.IsNullOrEmpty(_name))
                            {
                                Employee _employee = _employeeService.GetEmployeeByName(_name);
                                if (_employee == null)
                                {
                                    _employee = new Employee();

                                    _employee.UserType = 0;
                                    _employee.Name     = _name;
                                    _employee.TrueName = dr["学生姓名"].ToString() + "";

                                    string _phone = dr["家庭电话"].ToString() + "";
                                    if (_phone.IndexOf("e+") > 0)
                                    {
                                        _phone = (double.Parse(_phone)).ToString();
                                    }
                                    _employee.Phone = _phone;

                                    LogHelper.Info(dr["家长手机"].GetType().ToString() + "  " + dr["家长手机"]);

                                    string _mobile = dr["家长手机"].ToString() + "";
                                    if (_mobile.IndexOf("e+") > 0)
                                    {
                                        _mobile = (double.Parse(_mobile)).ToString();
                                    }
                                    _employee.Mobile     = _mobile;
                                    _employee.PassWord   = _mobile; //初始密码设为用户的手机号
                                    _employee.Permission = 0;
                                    _employee.ID         = _employeeService.InsertEmployee(_employee);
                                }
                            }
                            else
                            {
                                LogHelper.Error("记录[" + _i + "] 中的学籍号不能为空");
                                _result.AppendLine("记录[" + _i + "] 中的学籍号不能为空");
                            }
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Error("记录[" + _i + "]导入出错 " + ex.ToString());
                            _result.AppendLine("记录[" + _i + "]导入出错 " + ex.ToString());
                            continue;
                        }
                        _i++;
                    }

                    _message = _result.ToString();
                }
            }
            catch (Exception ex)
            {
                _code    = -1;
                _message = ex.Message;
            }
            finally
            {
                RenderText("{code: " + _code + ",message: \"" + _message.Replace(@"\", @"\\") + "\"}");

                CancelLayout();
            }
        }