public ActionResult BackMoney(string clubid, string str) { var result = new ResultInfo(false); int clubid1 = int.Parse(clubid); try { using (var db = new ClusDBEntities()) { var q = db.t_f_activity.FirstOrDefault(m => m.ID == clubid1); q.option3 = "审核完成,待汇报经费"; q.option5 = str; if (db.SaveChanges() > 0) { result.IsSucceed = true; } else { result.IsSucceed = false; } } } catch (Exception ex) { result.IsSucceed = false; } return(Json(result)); }
public ActionResult AdminLiPage(string id) { ClusDBEntities db = new ClusDBEntities(); int pid1 = int.Parse(id); var dataa = (from a in db.t_f_activity join b in db.t_f_User on a.club_ID equals b.ID where a.ID == pid1 select new Activity { acid = a.ID, //活动ID actittle = a.tittle, //活动主题 acclub = b.Name, //社团名称 clubtime = a.option2, //活动时间 clubplace = a.place, //活动地点 lastmoney = b.option1, // 社团剩余经费 money = a.option1, //活动经费 sarttime = a.starttime, //申请时间 option3 = a.option3, //活动状态 clubform = a.ac_form, //活动内容 }).First(); ViewData["acid"] = dataa.acid; ViewData["actittle"] = dataa.actittle; ViewData["acclub"] = dataa.acclub; ViewData["clubtime"] = dataa.clubtime; ViewData["clubplace"] = dataa.clubplace; ViewData["lastmoney"] = dataa.lastmoney; ViewData["money"] = dataa.money; ViewData["sarttime"] = dataa.sarttime; ViewData["option3"] = dataa.option3; ViewData["clubform"] = dataa.clubform; return(View()); }
public ActionResult DeleteNews(string id) { var db = new ClusDBEntities(); decimal newsid = decimal.Parse(id); var q = db.t_f_news.FirstOrDefault(m => m.ID == newsid); q.isDel = true; db.SaveChanges(); var data = from a in db.t_f_news where a.isDel == false orderby a.ID ascending select new NewsCom { ID = a.ID, EditTime = a.EditTime, Title = a.Title, Content = a.Content, }; return(Json(new GridModel() { Data = data, Total = data.Count() })); }
public ActionResult NewsContent(string id) { ClusDBEntities db = new ClusDBEntities(); decimal pid1 = decimal.Parse(id); t_f_news dd = db.t_f_news.Where(s => s.ID == pid1).First(); ViewData["did"] = dd.ID; //编号 ViewData["endtime"] = dd.EditTime; //时间 ViewData["content"] = dd.Content; //内容 ViewData["TTitle"] = dd.Title; //标题 return(View()); }
public ActionResult EditNews(string id) { ClusDBEntities db = new ClusDBEntities(); List <SelectListItem> recuit = new List <SelectListItem>(); decimal newsid = decimal.Parse(id); t_f_news dd = db.t_f_news.Where(s => s.ID == newsid).First(); ViewData["newsid"] = dd.ID; //编号ID ViewData["time"] = dd.EditTime; //时间 ViewData["title1"] = dd.Title; //标题 ViewData["content"] = dd.Content; //内容 return(View()); }
public ActionResult Index(FormCollection fc) { //string content = Request.Form["editor"]; //return View(); ////var title = SaveTitle(json); string data = Request.Form["title"]; string content = fc["editor"]; System.DateTime starttime = new System.DateTime(); starttime = DateTime.Now; if (data == "") { ViewData["back_news"] = "标题为空,请重新输入"; return(View()); } else if (content == "") { ViewData["back_news"] = "内容为空,请重新输入"; return(View()); } else { try { using (var db = new ClusDBEntities()) { var news = new t_f_news() { Title = data, Content = content, EditTime = starttime, isDel = false }; db.t_f_news.Add(news); db.SaveChanges(); ViewData["back_news"] = "保存成功!"; return(View()); } } catch (Exception ex) { ViewData["back_news"] = "保存失败"; return(View()); } } }
public string SaveUMoney(string json) { var result = new ResultInfo(false); JsonObject obj = new JsonObject(json); int clubid = int.Parse(obj["clubid"].Value.ToString()); string factmoney = obj["factmoney"].Value.ToString(); string com_content = obj["com_content"].Value.ToString(); System.DateTime com_starttime = new System.DateTime(); com_starttime = DateTime.Now; try { using (var db = new ClusDBEntities()) { var finance = new t_f_finance() { price = factmoney, //消费金额 tittle = com_content, //文件位置 fi_time = com_starttime, //申请时间 fi_type = clubid //活动id }; db.t_f_finance.Add(finance); if (db.SaveChanges() > 0) { var q = db.t_f_activity.FirstOrDefault(m => m.ID == clubid); q.option3 = "待转账"; if (db.SaveChanges() > 0) { return("success"); } else { return("existed"); } } else { return("existed"); } } } catch (Exception ex) { return(ex.Message); } }
[HttpPost]//保存new user public string SaveActivity(string json) { JsonObject obj = new JsonObject(json); string clubtittle = obj["clubtittle"].Value.ToString(); string clubtime = obj["clubtime"].Value.ToString(); string clubplace = obj["clubplace"].Value.ToString(); string cluboption1 = obj["cluboption1"].Value.ToString(); string clubform = obj["clubform"].Value.ToString(); System.DateTime com_starttime = new System.DateTime(); com_starttime = DateTime.Now; try { using (var db = new ClusDBEntities()) { t_f_User user = Session["user"] as t_f_User; int userid = user.ID;//社团ID if (userid != null) { var activity = new t_f_activity() { club_ID = userid, //社团ID tittle = clubtittle, //活动主题 option2 = clubtime, //活动时间 place = clubplace, //活动地点 option1 = cluboption1, //活动经费 ac_form = clubform, //活动内容 starttime = com_starttime, //申请时间 option3 = "审核中……" }; db.t_f_activity.Add(activity); db.SaveChanges(); return("success"); } else { return("existed"); } } } catch (Exception ex) { return(ex.Message); } }
public ActionResult AddMoneyList(string id) { ClusDBEntities db = new ClusDBEntities(); int pid1 = int.Parse(id); var dataa = (from a in db.t_f_activity where a.ID == pid1 select new Activity { acid = a.ID, //活动ID actittle = a.tittle, //活动主题 money = a.option1, //活动经费 }).First(); ViewData["acid1"] = dataa.acid; ViewData["actittle1"] = dataa.actittle; ViewData["money1"] = dataa.money; return(View()); }
////案例 public ActionResult File_Save(HttpPostedFileBase file_upload) { //获取文件的类型 string filename = Path.GetFileName(file_upload.FileName); string filetype = System.IO.Path.GetExtension(filename); //string filetype = "." + file_upload.ContentType.Split('/')[1]; //获取文件的路径 string fileName = file_upload.FileName; //判断格式 if (filetype == ".xlsx" || filetype == ".xlsm" || filetype == ".xltx" || filetype == ".xltm" || filetype == ".xlsb" || filetype == ".xlam") { //转换只取文件名,去掉路径。 if (fileName.LastIndexOf("\\") > -1) { fileName = fileName.Substring(fileName.LastIndexOf("\\") + 1); } //保存到相对路径下。 bool abc = Directory.Exists(Server.MapPath("~/Upload")); if (abc == false) { Directory.CreateDirectory(Server.MapPath("~/Upload")); } file_upload.SaveAs(Server.MapPath("~/Upload/" + fileName)); //以下代码是将路径保存到数据库。 string FilePath = "../../Upload/" + fileName; //插入到数据库 try { using (var db = new ClusDBEntities()) { return(Content("1|" + FilePath + "|上传成功!|")); } } catch (Exception ex) { return(Content("0|网络繁忙,请稍后在试!")); } } else { return(Content("0|请选择Excel格式的文件!")); } }
public ActionResult EditNews(FormCollection fc) { //string content = Request.Form["editor"]; //return View(); ////var title = SaveTitle(json); decimal newsid = Decimal.Parse(Request.Form["newsid"]); string data = Request.Form["title"]; string content = fc["editor"]; System.DateTime starttime = new System.DateTime(); starttime = DateTime.Now; if (data == "") { ViewData["back_news"] = "标题为空,请重新输入"; return(View()); } else if (content == "") { ViewData["back_news"] = "内容为空,请重新输入"; return(View()); } else { try { using (var db = new ClusDBEntities()) { var recruit = db.t_f_news.FirstOrDefault(s => s.ID == newsid); recruit.Title = data; recruit.Content = content; recruit.EditTime = starttime; db.SaveChanges(); ViewData["back_news"] = "保存成功!"; return(View()); } } catch (Exception ex) { ViewData["back_news"] = "保存失败"; return(View()); } } }
public string SaveUActivity(string json) { var result = new ResultInfo(false); JsonObject obj = new JsonObject(json); int acid = int.Parse(obj["clubid"].Value.ToString()); string clubtittle = obj["clubtittle"].Value.ToString(); string clubtime = obj["clubtime"].Value.ToString(); string clubplace = obj["clubplace"].Value.ToString(); string cluboption1 = obj["cluboption1"].Value.ToString(); string clubform = obj["clubform"].Value.ToString(); System.DateTime com_starttime = new System.DateTime(); com_starttime = DateTime.Now; try { using (var db = new ClusDBEntities()) { var q = db.t_f_activity.FirstOrDefault(m => m.ID == acid); q.tittle = clubtittle; //活动主题 q.option2 = clubtime; //活动时间 q.place = clubplace; //活动地点 q.option1 = cluboption1; //活动经费 q.ac_form = clubform; //活动内容 q.starttime = com_starttime; //申请时间 q.option3 = "审核中……"; if (db.SaveChanges() > 0) { return("success"); } else { return("existed"); } } } catch (Exception ex) { return(ex.Message); } }
public string LogOn(string handno, string pwd) { try { using (var db = new ClusDBEntities()) { var user = db.t_f_User.Where(p => p.HandNo == handno && p.Password == pwd && p.IsDelete == false).FirstOrDefault(); if (user != null) { Session["user"] = user; return("success"); } else { return("密码有误!"); } } } catch (Exception ex) { return("用户名有误!" + ex.Message); } }