예제 #1
0
        /// <summary>
        /// 用户头像上传
        /// </summary>
        /// <param name="file"></param>
        /// <param name="uploaPath"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static KingResponse UploadAvatarFile(HttpPostedFile file, string uploaPath, string id)
        {
            KingResponse response;

            if (!Directory.Exists(uploaPath))
            {
                Directory.CreateDirectory(uploaPath);
            }
            string Extension = Path.GetExtension(file.FileName);

            //////////////重新命名文件名///////////////
            uploaPath = uploaPath + "\\" + id + Extension;
            try
            {
                if (File.Exists(uploaPath))
                {
                    File.Delete(uploaPath);
                }
                file.SaveAs(uploaPath);
            }
            catch (Exception ex)
            {
                //response = KingResponse.GetErrorResponse("保存文件失败:" + ex.Message);
                //return response;
            }
            Extension = Extension.Remove(Extension.IndexOf('.'), 1);
            response  = KingResponse.GetResponse(null, new
            {
                ID       = id,
                FileName = file.FileName.Substring(0, file.FileName.IndexOf('.')),
                //FilePath = string.Format("{0}/{1}/{2}.{3}", GetFileServerHttp(), "KingsunFiles/AvatarFile", id, Extension)
                FilePath = string.Format("{0}/{1}/{2}{3}", System.Configuration.ConfigurationManager.AppSettings["FileAddress"].ToString(), "KingsunFiles/AvatarFile", id, Extension)
            });
            return(response);
        }
예제 #2
0
        public JsonResult GetCourseAppList(int CourseID)
        {
            ApplyPartModel appList  = appbll.GetCourseAppList(CourseID);
            KingResponse   response = KingResponse.GetResponse(null, appList);

            return(Json(response));
        }
예제 #3
0
        public JsonResult GetBookListByEditionID(int ediID, int subjectId, int stageId)
        {
            List <CourseModel> appModel = appbll.GetBookListByEditionID(ediID, subjectId, stageId);
            KingResponse       response = KingResponse.GetResponse(null, appModel);

            return(Json(response));
        }
예제 #4
0
        /// <summary>
        /// 通过学段获取学科
        /// </summary>
        /// <param name="stageID"></param>
        /// <returns></returns>
        public JsonResult GetSubjectListByStageID(int stageID)
        {
            CookieHelper.SetCookie("StageID", stageID.ToString());
            List <SubjectModel> subModel = indexbll.GetSubjectByStage(stageID);
            KingResponse        response = KingResponse.GetResponse(null, subModel);

            return(Json(response));
        }
예제 #5
0
        /// <summary>
        /// 切换学段获取教材
        /// </summary>
        /// <param name="subjectId"></param>
        /// <param name="stageId"></param>
        /// <returns></returns>
        public JsonResult GetBookListAndMovice(int subjectId, int stageId)
        {
            CookieHelper.SetCookie("StageID", stageId.ToString());
            ApplyModel   appModel = appbll.GetCourseAndMovice(subjectId.ToString(), stageId);
            KingResponse response = KingResponse.GetResponse(null, appModel);

            return(Json(response));
        }
예제 #6
0
        public JsonResult GetMicroCourseByKey(string key = "")
        {
            MicroCourseBLL mCourseBll    = new MicroCourseBLL();
            MicroResource  microresource = mCourseBll.GetMicroCourseByKey(key);
            KingResponse   response      = KingResponse.GetResponse(null, microresource);

            return(Json(response));
        }