public JsonResult GetDistrict(string city) { // StatusData myStatusData = new StatusData();//返回状态 // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { try { long myLong = 0; bool isNumber = long.TryParse(city, out myLong); if (isNumber) { var myDataTable = myOperating.Sys_Area_District.Where(p => p.CityID == myLong).OrderBy(p => p.OrderBy).Select(s => new { DistrictName = s.DistrictName, DistrictNum = s.DistrictNum }).ToList(); myStatusData.operateStatus = 200; myStatusData.dataTable = myDataTable; } else { myStatusData.operateStatus = 200; } } catch { myStatusData.operateStatus = -1; } } return(Json(myStatusData)); }
// #region 修改密码 public StatusData EditPwd(string username, string newpwd) { StatusData myStatusData = new StatusData();//返回状态 // User_UserName myUserInfo = new User_UserName(); using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { myUserInfo = myOperating.User_UserName.FirstOrDefault(p => p.MobilePhone == username); if (myUserInfo == null) { myStatusData.operateStatus = 1;//用户名错误 } else { if (!String.IsNullOrWhiteSpace(newpwd)) { newpwd = Md5Class.CreateMd5(newpwd);// myUserInfo.PassWord = newpwd; myOperating.SaveChanges(); myStatusData.operateStatus = 200; } else { myStatusData.operateMsg = "新密码不能为空"; myStatusData.operateStatus = 400;//参数错误 } } } return(myStatusData); }
public static void ClearTable(string tableName, bool clearAll = false) { if (!String.IsNullOrWhiteSpace(tableName)) { tableName = tableName.ToLower(); } using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作objectContext.DefaultContainerName { var _metadataWorkspace = myOperating.ObjectContext.MetadataWorkspace; var container = _metadataWorkspace.GetEntityContainer("chefuzi_dataModelStoreContainer", DataSpace.SSpace); IEnumerable <string> myEntitySets; if (clearAll) { myEntitySets = container.EntitySets.Select(e => e.Name); if (myEntitySets != null) { CheFuZi.DataBaseModel.Configuration.DataCache.InvalidateSets(myEntitySets); CheFuZi.DataBaseModel.Configuration.DataCache.Purge(); } } else if (!String.IsNullOrWhiteSpace(tableName)) { myEntitySets = container.EntitySets.Where(p => p.Name.ToLower() == tableName).Select(e => e.Name); if (myEntitySets != null) { CheFuZi.DataBaseModel.Configuration.DataCache.InvalidateSets(myEntitySets); CheFuZi.DataBaseModel.Configuration.DataCache.Purge(); } } } }
// #region 获得阅读名次 public static long ReadDayRank(string username) { long myRank = 0; // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { // try { RankNum RankNumList = new RankNum(); // StringBuilder mySqlStr = new StringBuilder(); mySqlStr.Append("SELECT [Extent1].[MobilePhone],[Extent1].[GradeNum] From ( SELECT [Extent1].[MobilePhone] AS [MobilePhone], row_number() OVER (ORDER BY [Extent1].[ReadDayCount] DESC) AS [GradeNum] FROM [RuiKa_Public].[dbo].[User_Book_Click_ReadDay] AS [Extent1]) AS [Extent1] Where [Extent1].[MobilePhone]=@MobilePhone"); RankNumList = myOperating.ObjectContext.ExecuteStoreQuery <RankNum>(mySqlStr.ToString(), new SqlParameter("@MobilePhone", username)).FirstOrDefault(); if (RankNumList != null) { myRank = RankNumList.GradeNum; } } catch { } } return(myRank); }
// #region 获取阅读播放次数 public int GetReadPlayTimes(int classid, int albumid) { int returnCounts = 0; Nullable <int> counts = 0; using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { try { switch (classid) {///1点一点;2听一听;3看一看; ///4课程讲解;5幼儿公开课;6教育技能; ///7操作说明;8教师社区;9精彩瞬间;12用户录音 case 1: //点一点 counts = myOperating.Child_Book_Click.Where(p => p.BookClassID == albumid).Sum(p => p.ReadCount); break; case 2: //2听一听 counts = myOperating.Child_Audio_List.Where(p => p.AlbumId == albumid).Sum(p => p.PlayTimes); break; case 3: //3看一看 counts = myOperating.Child_Video_List.Where(p => p.AlbumId == albumid).Sum(p => p.PlayTimes); break; } } catch { } } if (counts != null) { int.TryParse(counts.ToString(), out returnCounts); } return(returnCounts); }
public JsonResult GetBgSound(string currentpage, string pagesize) { #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); #endregion // StatusData myStatusData = new StatusData();//返回状态 // if (checkAuthCodeBool) { using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { #region 翻页属性 int recordCount = 0; int pageCount = 0; string orderbyfiled = "OrderBy"; bool isDesc = true;//倒序 //当前页 int sqlCurrentpage = 1; if (!String.IsNullOrWhiteSpace(currentpage)) { bool isOk = int.TryParse(currentpage, out sqlCurrentpage); if (!isOk) { sqlCurrentpage = 1; } } //页大小 int sqlPagesize = 10; if (!String.IsNullOrWhiteSpace(pagesize)) { bool isOk = int.TryParse(pagesize, out sqlPagesize); if (!isOk) { sqlPagesize = 10; } } #endregion IQueryable <Audio_Background> myIQueryable = null; myIQueryable = myOperating.Audio_Background; // if (myIQueryable != null) { var BookTable = QueryableExtensions.OrderBy(myIQueryable, orderbyfiled, out recordCount, out pageCount, ref sqlCurrentpage, sqlPagesize, isDesc).Select(s => new { BgMusicId = s.BgMusicId, MusicTitle = s.MusicTitle, MusicUrl = StaticVarClass.myDomain + s.MusicUrl, TimeSeconds = s.TimeSeconds }).ToList(); myStatusData.dataPageCount = pageCount; myStatusData.dataRecordCount = recordCount; myStatusData.dataTable = BookTable; } myStatusData.operateStatus = 200; } } else { myStatusData.operateStatus = 5;//登陆失效 } return(Json(myStatusData)); }
public JsonResult ArticleContent(string articleid) { string mobilePhone = ""; // // StatusData myStatusData = new StatusData(); //返回状态 // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; } #endregion using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { ArticlDataContent myArticlDataContent = new ArticlDataContent(); long myLong = 0;//文章主键 bool isLong = long.TryParse(articleid, out myLong); if (isLong) { Teacher_Article myTable = myOperating.Teacher_Article.FirstOrDefault(p => p.ArticlId == myLong && p.Status == 200); DataMethodClass myDataMethodClass = new DataMethodClass(); if (myTable != null) { myArticlDataContent.ArticleId = myLong; myArticlDataContent.ArticleTitle = myTable.ArticleTitle; if (!String.IsNullOrWhiteSpace(myTable.ArticleImages)) { myArticlDataContent.ArticleImages = StaticVarClass.myDomain + myTable.ArticleImages; } else { myArticlDataContent.ArticleImages = StaticVarClass.myDomain + "defaultTeacherArticle.png"; } myArticlDataContent.AddDate = myTable.AddDate; myArticlDataContent.ReadTimes = myTable.ReadTimes; myArticlDataContent.OpenUrl = StaticVarClass.myDomain + "Community/" + myLong + ".html"; // #region 阅读次数加一 if (myTable.ReadTimes != null) { myTable.ReadTimes = myTable.ReadTimes + 1; } else { myTable.ReadTimes = 1; } myOperating.SaveChanges(); #endregion } myStatusData.dataTable = myArticlDataContent; } myStatusData.operateStatus = 200; } return(Json(myStatusData)); }
/// <summary> /// 使用非芮卡家园APP扫码后打开该页下载APP /// </summary> ///<param name="typestr">1</param> /// <param name="codestr">二维码字符串</param> /// <returns></returns> public ActionResult App(string typestr, string codestr) { string showMsg = ""; //提示信息 int typeId = 0; //类型;1学一学课件注册 bool typeIsInt = int.TryParse(typestr, out typeId); //----------------------- if (typeId == 1) { #region 判断并开通学一学电子书 using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { Sys_BookStudy_QRCode mySys_BookStudy_QRCode = new Sys_BookStudy_QRCode(); mySys_BookStudy_QRCode = myOperating.Sys_BookStudy_QRCode.FirstOrDefault(p => p.QRCode == codestr); if (mySys_BookStudy_QRCode != null) { long myBookId = mySys_BookStudy_QRCode.BookStudyID; if (mySys_BookStudy_QRCode.Used) {//注册码已经使用过 showMsg = "该二维码已经使用过,不能再次使用,请核对准确。"; } else { #region 要开通那本图书 Child_Book_Study myChild_Book_Study = new Child_Book_Study(); myChild_Book_Study = myOperating.Child_Book_Study.FirstOrDefault(p => p.BookID == myBookId); if (myChild_Book_Study != null) { showMsg = "要开通:《" + myChild_Book_Study.BookName + "》点读"; if (!String.IsNullOrWhiteSpace(myChild_Book_Study.BookImage)) { ViewBag.CoverImage = StaticVarClass.BookStudyResourceUrl + myChild_Book_Study.BookImage; } } else { showMsg = "该电子书不存在,请核实您的二维码。"; } #endregion } } else { showMsg = "该编码不存在,请核实您的二维码。"; } } #endregion } else { showMsg = "二维码错误。"; } ViewBag.Message = showMsg; //======================== return(View()); }
public JsonResult Register(string username, string pwd) { StatusData myStatusData = new StatusData();//返回状态 // DateTime myNowDate = DateTime.Now; // User_UserName myUserInfo = new User_UserName(); if (FunctionClass.isMobilePhone(username)) {//手机号规则判断 try { using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { myUserInfo = myOperating.User_UserName.FirstOrDefault(p => p.MobilePhone == username); if (myUserInfo == null) { int checkCodeCount = myOperating.User_CheckCode.Where(p => p.MobilePhone == username && p.AlreadCheck == true).Count(); if (checkCodeCount > 0) { User_UserName newUserInfo = new User_UserName(); newUserInfo.MobilePhone = username; newUserInfo.PassWord = Md5Class.CreateMd5(pwd); newUserInfo.AddDate = DateTime.Now; newUserInfo.Status = 200; newUserInfo.CheckDate = DateTime.Now; newUserInfo.RecentlyLoginDate = DateTime.Now; newUserInfo.RoleId = 0; newUserInfo.NickName = ""; myOperating.User_UserName.Add(newUserInfo); myOperating.SaveChanges(); myStatusData.operateStatus = 200; } else { myStatusData.operateStatus = 6;//验证码错误 } } else { myStatusData.operateStatus = 7;//已经存在 } } } catch { myStatusData.operateStatus = -1; } } else {//手机号错误 myStatusData.operateStatus = 400; } return(Json(myStatusData)); }
public JsonResult AddComment(string articleid, string content) { StatusData myStatusData = new StatusData(); //返回的类型 string mobilePhone = ""; // // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); #endregion if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { Discover_Article_Comment myRecord = new Discover_Article_Comment(); long myLong = 0;//要评论的文章 bool isOk = long.TryParse(articleid, out myLong); if (isOk) { try { myRecord.AboutId = myLong; myRecord.Detail = content; myRecord.MobilePhone = mobilePhone; myRecord.NickName = ""; myRecord.AddDate = DateTime.Now; myRecord.Status = 200; myOperating.Discover_Article_Comment.Add(myRecord); myOperating.SaveChanges(); myStatusData.operateStatus = 200; } catch { myStatusData.operateStatus = -1; } } else { myStatusData.operateStatus = 400; myStatusData.operateMsg = "参数错误"; } } } else { myStatusData.operateStatus = 5; } return(Json(myStatusData)); }
public JsonResult LessonList() { StatusData myStatusData = new StatusData(); //返回的类型 using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作 { var myTable = myOperating.Teacher_Video_Class_Lesson.Where(p => p.Status == 200).OrderBy(p => p.OrderBy).Select(s => new { ClassId = s.ClassId, ClassTitle = s.ClassTitle }).ToList(); myStatusData.dataTable = myTable; myStatusData.operateStatus = 200; } return(Json(myStatusData)); }
public JsonResult BookClassList() { StatusData myStatusData = new StatusData(); //返回的类型 using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作 { var myTable = myOperating.Child_Book_Click_Class.Where(p => p.Status == 200).OrderBy(p => p.OrderBy).Select(s => new { BookClassID = s.BookClassID, BookClassName = s.BookClassName, ClassImage = StaticVarClass.BookClickResourceUrl + s.ClassImage, ImgWidth = s.ImgWidth, ImgHeight = s.ImgHeight }).ToList(); myStatusData.dataTable = myTable; myStatusData.operateStatus = 200; } return(Json(myStatusData)); }
public JsonResult ClassList() { StatusData myStatusData = new StatusData(); //返回的类型 using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作 { var myTable = myOperating.Child_Audio_Class.Where(p => p.Status == 200).OrderBy(p => p.OrderBy).Select(s => new { ClassId = s.ClassId, ClassTitle = s.ClassTitle }).ToList(); myStatusData.dataTable = myTable; myStatusData.operateStatus = 200; } return(Json(myStatusData, JsonRequestBehavior.AllowGet)); }
// #region 获得听一听大类名称 public string GetAudioClassName(Nullable <int> classid) { string myClassName = ""; using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { #region 所属类别名 try { myClassName = myOperating.Child_Audio_Class.FirstOrDefault(p => p.ClassId == classid).ClassTitle; } catch { } #endregion } return(myClassName); }
// #region 检查是否收藏 public bool CollectExist(int classid, long aboutid, bool isTeacherVideo = false) {// // bool isExist = false; // #region 检查授权 string mobilePhone = "";//手机号 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); #endregion if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { int myCount = 0; // try { if (isTeacherVideo) {//classid=45679 myCount = myOperating.User_Collect.Count(p => p.MobilePhone == mobilePhone && p.IsTeacherVideo == true && p.AboutId == aboutid); } else { myCount = myOperating.User_Collect.Count(p => p.MobilePhone == mobilePhone && p.ClassId == classid && p.AboutId == aboutid); } if (myCount > 0) { isExist = true; } } catch { isExist = false; } } } return(isExist); }
public ActionResult Details(long myid) { TeacherArticleModel myArticlDataContent = new TeacherArticleModel(); // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { Teacher_Article myTable = myOperating.Teacher_Article.FirstOrDefault(p => p.ArticlId == myid && p.Status == 200); DataMethodClass myDataMethodClass = new DataMethodClass(); if (myTable != null) { myArticlDataContent.ArticlId = myid; myArticlDataContent.ArticleTitle = myTable.ArticleTitle; if (!String.IsNullOrWhiteSpace(myTable.ArticleImages)) { myArticlDataContent.ArticleImages = StaticVarClass.myDomain + myTable.ArticleImages; } if (!String.IsNullOrWhiteSpace(myTable.ArticleVideo)) { myArticlDataContent.ArticleVideo = StaticVarClass.myDomain + myTable.ArticleVideo; } DateTime myDateTime = DateTime.Now; DateTime.TryParse(myTable.AddDate.ToString(), out myDateTime); myArticlDataContent.AddDate = myDateTime; myArticlDataContent.ArticleAuthor = myTable.ArticleAuthor; myArticlDataContent.ArticleContent = myTable.ArticleContent; myArticlDataContent.CommentCount = myOperating.Teacher_Article_Comment.Count(p => p.AboutId == myid); myArticlDataContent.ReadTimes = myTable.ReadTimes; // #region 阅读次数加一 if (myTable.ReadTimes != null) { myTable.ReadTimes = myTable.ReadTimes + 1; } else { myTable.ReadTimes = 1; } myOperating.SaveChanges(); #endregion } } return(View(myArticlDataContent)); }
public JsonResult GetBook(string myid) { string mobilePhone = ""; // // StatusData myStatusData = new StatusData(); //返回状态 // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; } #endregion using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { if (!String.IsNullOrWhiteSpace(myid)) { long myLong = 0; bool isOk = long.TryParse(myid, out myLong); if (isOk) { var myChild_Book_Click = myOperating.Child_Book_Click.Where(p => p.BookID == myLong && p.BookStatus == 200).Select(s => new { BookID = s.BookID, BookName = s.BookName, BookOnlineUrl = StaticVarClass.BookClickResourceUrl + s.BookOnlineUrl, ScreenH = s.ScreenH }).ToList(); if (myChild_Book_Click != null) { myStatusData.dataTable = myChild_Book_Click; } myStatusData.operateStatus = 200; } else { myStatusData.operateStatus = 400; } } else { myStatusData.operateStatus = 400; } } return(Json(myStatusData)); }
public JsonResult DelCollectItem(string collectid) { #region 检查授权 string myMobilePhone = ""; AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); #endregion // StatusData myStatusData = new StatusData();//返回状态 // if (checkAuthCodeBool) { myMobilePhone = myAuthCodeInstance.mobilePhone; try { using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作 { long myLong = 0; // bool isLong = long.TryParse(collectid, out myLong); User_Collect myUser_Collect = new User_Collect(); myUser_Collect = myOperating.User_Collect.FirstOrDefault(p => p.MobilePhone == myMobilePhone && p.CollectId == myLong);; // if (myUser_Collect != null) { myOperating.User_Collect.Remove(myUser_Collect); // myOperating.SaveChanges(); // myStatusData.operateStatus = 200; } } } catch { myStatusData.operateStatus = -1; } } else { myStatusData.operateStatus = 5; } return(Json(myStatusData)); }
public JsonResult GetAudio(string myid) { //orderby=1按日期排序,2按播放次数排序 string mobilePhone = ""; // // StatusData myStatusData = new StatusData(); //返回状态 // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; } #endregion using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { if (!String.IsNullOrWhiteSpace(myid)) { long myLong = 0; bool isOk = long.TryParse(myid, out myLong); if (isOk) { // var myChild_Audio_List = myOperating.Child_Audio_List.Join(myOperating.Child_Audio_Album, tL => tL.AlbumId, album => album.AlbumId, (tL, album) => new { tL.AudioId, tL.AudioTitle, album.AlbumImage, tL.AudioUrl, tL.AudioWords, tL.PlayTimes, tL.TimeSeconds, tL.Status }).Where(p => p.AudioId == myLong && p.Status == 200).Select(s => new { AudioId = s.AudioId, AudioTitle = s.AudioTitle, AudioImage = StaticVarClass.myDomain + s.AlbumImage, AudioUrl = StaticVarClass.myDomain + s.AudioUrl, AudioWords = s.AudioWords, PlayTimes = s.PlayTimes, TimeSeconds = s.TimeSeconds }).ToList(); if (myChild_Audio_List != null) { myStatusData.dataTable = myChild_Audio_List; } myStatusData.operateStatus = 200; } else { myStatusData.operateStatus = 400; } } else { myStatusData.operateStatus = 400; } } return(Json(myStatusData)); }
public JsonResult GetUserInfo() { StatusData myStatusData = new StatusData();//返回状态 // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); #endregion // if (checkAuthCodeBool) { DataMethodClass myDataMethodClass = new DataMethodClass();//检查验证码 // //User_UserName myUserInfo = new User_UserName(); using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { var myUserInfo = myOperating.User_UserName.Select(s => new { MobilePhone = s.MobilePhone, HeadImage = StaticVarClass.myDomain + s.HeadImage, NickName = s.NickName, Sex = s.Sex, BirthDate = s.BirthDate, ProvinceName = s.ProvinceName, CityName = s.CityName, DistrictName = s.DistrictName, DistrictNum = s.DistrictNum, Address = s.Address, Kindergarten = s.Kindergarten, RoleId = s.RoleId }).FirstOrDefault(p => p.MobilePhone == myAuthCodeInstance.mobilePhone); if (myUserInfo == null) { myStatusData.operateStatus = 1;//用户名错误 } else { try { myStatusData.dataTable = myUserInfo; myStatusData.operateStatus = 200; } catch { myStatusData.operateStatus = -1; } } } } else { myStatusData.operateStatus = 5;//登陆失效 } return(Json(myStatusData)); }
public JsonResult GetVideo(string myid) { //orderby=1按日期排序,2按播放次数排序 string mobilePhone = ""; // // StatusData myStatusData = new StatusData(); //返回状态 // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; } #endregion using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { if (!String.IsNullOrWhiteSpace(myid)) { long myLong = 0; bool isOk = long.TryParse(myid, out myLong); if (isOk) { var myTeacher_Video_List = myOperating.Teacher_Video_List.Where(p => p.VideoId == myLong && p.Status == 200).Select(s => new { VideoId = s.VideoId, VideoTitle = s.VideoTitle, VideoDes = s.VideoDes, VideoImage = StaticVarClass.myDomain + s.VideoImage, VideoUrl = StaticVarClass.myDomain + s.VideoUrl, PlayTimes = s.PlayTimes, TimeSeconds = s.TimeSeconds, ClassId = s.ClassId }).ToList(); if (myTeacher_Video_List != null) { myStatusData.dataTable = myTeacher_Video_List; } myStatusData.operateStatus = 200; } else { myStatusData.operateStatus = 400; } } else { myStatusData.operateStatus = 400; } } return(Json(myStatusData)); }
public bool lookCheckCode(string username, string myCode) { bool isOk = false; using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { DateTime myNowDate = DateTime.Now; int isExist = myOperating.User_CheckCode.Count(p => p.MobilePhone == username && p.CheckCode == myCode && p.ExpiredDate > myNowDate); if (isExist > 0) { isOk = true; } else { isOk = false; } } return(isOk); }
public JsonResult EditPwd(string username, string pwd) { StatusData myStatusData = new StatusData(); //返回状态 // DataMethodClass myDataMethodClass = new DataMethodClass(); //检查验证码 // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { int checkCodeCount = myOperating.User_CheckCode.Where(p => p.MobilePhone == username && p.AlreadCheck == true).Count(); if (checkCodeCount > 0) { myStatusData = myUserOptionClass.EditPwd(username, pwd); } else { myStatusData.operateStatus = 6;//验证码错误 } } return(Json(myStatusData)); }
public JsonResult GetProvince() { // StatusData myStatusData = new StatusData();//返回状态 // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { try { var myDataTable = myOperating.Sys_Area_Province.OrderBy(p => p.OrderBy).Select(s => new { ProvinceName = s.ProvinceName, ProvinceNum = s.ProvinceNum }).ToList(); myStatusData.operateStatus = 200;//登录成功 myStatusData.dataTable = myDataTable; } catch { myStatusData.operateStatus = -1; } } return(Json(myStatusData)); }
public JsonResult CheckCode(string username, string checkcode) { StatusData myStatusData = new StatusData();//返回状态 // DateTime myNowDate = DateTime.Now; // User_UserName myUserInfo = new User_UserName(); try { using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { User_CheckCode myUserCheckCode = myOperating.User_CheckCode.FirstOrDefault(p => p.MobilePhone == username && p.CheckCode == checkcode && p.ExpiredDate > myNowDate); if (myUserCheckCode != null) { try { myUserCheckCode.AlreadCheck = true; myOperating.SaveChanges(); myStatusData.operateMsg = "验证通过"; myStatusData.operateStatus = 200; } catch { myStatusData.operateStatus = -1; } } else { myStatusData.operateStatus = 6;//验证码错误 } } } catch { myStatusData.operateStatus = -1; } return(Json(myStatusData)); }
// #region 文章查看 public ActionResult ItemView(DiscoverArticleModel model, string ReturnUrl, Nullable <long> myid = 0) { #region 获取来路路径 if (System.Web.HttpContext.Current.Request.UrlReferrer != null) { ViewBag.ReturnUrl = System.Web.HttpContext.Current.Request.UrlReferrer.PathAndQuery; } #endregion ViewBag.Headline = "文章查看"; //栏目主题 // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作 { if ((myid > 0) && (model.Operate == null)) { long mySelfId = 0; long.TryParse(myid.ToString(), out mySelfId); ViewBag.Headline = "文章查看"; // model.Operate = ""; #region 取出数据 Discover_Article editRecord = myOperating.Discover_Article.FirstOrDefault(p => p.ArticlId == mySelfId); if (editRecord != null) { model.ArticlId = editRecord.ArticlId; model.MobilePhone = editRecord.MobilePhone; model.ArticleTitle = editRecord.ArticleTitle; model.ArticleImages = FunctionClass.GetFileUrl(editRecord.ArticleImages); model.ArticleVideo = FunctionClass.GetFileUrl(editRecord.ArticleVideo); model.ArticleContent = editRecord.ArticleContent; model.ReadTimes = editRecord.ReadTimes; model.OrderBy = editRecord.OrderBy; model.Status = editRecord.Status; model.Operate = "look"; } #endregion } } // return(View(model)); }
// #region 用户信息查看 public ActionResult UserView(User_UserName model, string mobilestr = "") { #region 获取来路路径 if (System.Web.HttpContext.Current.Request.UrlReferrer != null) { ViewBag.ReturnUrl = System.Web.HttpContext.Current.Request.UrlReferrer.PathAndQuery; } #endregion ViewBag.Headline = "用户查看"; //栏目主题 // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作 { if (!String.IsNullOrWhiteSpace(mobilestr)) { #region 取出数据 model = myOperating.User_UserName.FirstOrDefault(p => p.MobilePhone == mobilestr); #endregion } } // return(View(model)); }
public StatusData Login(string username, string pwd, bool remember = true) { StatusData myStatusData = new StatusData(); //返回状态 // AuthCodeClass myAuthCodeClass = new AuthCodeClass(); //授权码类 // User_UserName myUserInfo = new User_UserName(); using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { // myUserInfo = myOperating.User_UserName.FirstOrDefault(p => p.MobilePhone == username); if (myUserInfo != null) { if (!String.IsNullOrWhiteSpace(pwd)) { pwd = Md5Class.CreateMd5(pwd);// } if (myUserInfo.PassWord != pwd) { myStatusData.operateStatus = 2;//密码错误 } else if (myUserInfo.Status != 200) { myStatusData.operateStatus = myUserInfo.Status;//201锁定,联系客服 } else { string myAuthCodeStr = myAuthCodeClass.CreateAuthCode(myUserInfo.MobilePhone, myUserInfo.RoleId, remember); myStatusData.operateStatus = 200;//登录成功 myStatusData.userAuthCode = myAuthCodeStr; myUserInfo.RecentlyLoginDate = DateTime.Now; myOperating.SaveChanges(); } } } return(myStatusData); }
// #region 获取用户昵称和头像 public bool GetNickNameAndPic(string username, out string nickname, out string headimage) { bool isOk = false; using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { #region 昵称和头像 headimage = StaticVarClass.DefaultHeadImage; //头像 nickname = "匿名"; //昵称 if (!String.IsNullOrWhiteSpace(username)) { User_UserName myUserNameTable = myOperating.User_UserName.FirstOrDefault(p => p.MobilePhone == username); if (myUserNameTable != null) { if (!String.IsNullOrWhiteSpace(myUserNameTable.NickName)) {//昵称 nickname = myUserNameTable.NickName; } else { if (myUserNameTable.MobilePhone.Length > 7) { nickname = myUserNameTable.MobilePhone.Substring(7) + "****"; } } // if (!String.IsNullOrWhiteSpace(myUserNameTable.HeadImage)) {//头像 headimage = StaticVarClass.myDomain + myUserNameTable.HeadImage; } isOk = true; } } #endregion } return(isOk); }
public JsonResult GetReadDays() { string mobilePhone = ""; // // StatusData myStatusData = new StatusData(); //返回状态 // #region 检查授权 AuthCodeInstance myAuthCodeInstance = new AuthCodeInstance(); AuthCodeClass myAuthCodeClass = new AuthCodeClass(); bool checkAuthCodeBool = myAuthCodeClass.checkAuthCode(out myAuthCodeInstance); #endregion using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { if (checkAuthCodeBool) { mobilePhone = myAuthCodeInstance.mobilePhone; // ReadCount myReadCount = new ReadCount(); // var myUser_Book_Click_ReadDay = myOperating.User_Book_Click_ReadDay.Where(p => p.MobilePhone == mobilePhone).Select(s => new { ReadDayCount = s.ReadDayCount, RecentlyReadBookId = s.RecentlyReadBookId }).FirstOrDefault(); if (myUser_Book_Click_ReadDay != null) { myReadCount.RecentlyReadBookId = myUser_Book_Click_ReadDay.RecentlyReadBookId; myReadCount.ReadDayCount = myUser_Book_Click_ReadDay.ReadDayCount; myReadCount.RankNum = UserOptionClass.ReadDayRank(mobilePhone); } // myStatusData.dataTable = myReadCount; myStatusData.operateStatus = 200; } } return(Json(myStatusData)); }