Exemple #1
0
        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()
            }));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        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());
                }
            }
        }
Exemple #5
0
        [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);
            }
        }
Exemple #6
0
        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());
                }
            }
        }
Exemple #7
0
        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);
            }
        }