Exemplo n.º 1
0
        /// <summary>
        /// 详细
        /// </summary>
        /// <returns></returns>
        public ActionResult Details(string id)
        {
            ViewData["WebName"] = GolbalDbContext.Instace().confige.Find(0).webName;
            var db      = GolbalDbContext.Instace();
            var busines = db.businessplan.FirstOrDefault(u => u.Id == id);

            if (busines != null)
            {
                return(View("Details", busines));
            }
            return(RedirectToAction("Exhibition"));
        }
Exemplo n.º 2
0
        /// <summary>
        ///  删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Delete(string id)
        {
            var db     = GolbalDbContext.Instace();
            var entity = db.businessplan.SingleOrDefault(u => u.Id == id);

            if (entity != null)
            {
                db.businessplan.Remove(entity);
                db.SaveChanges();
                // 删除信息同时是否删除文件夹???
            }
            return(RedirectToAction("Exhibition"));
        }
Exemplo n.º 3
0
        public ActionResult Index(FormCollection file, HttpPostedFileBase FilePath)
        {
            if (ModelState.IsValid)
            {
                var db = GolbalDbContext.Instace();

                var    date      = file["Birthday"] == null ? DateTime.Now : DateTime.Parse(file["Birthday"]);
                var    payout    = file["PayMoney"] == null ? 0 : decimal.Parse(file["PayMoney"]);
                string FilesName = UploadFile(file["Name"], FilePath);
                try
                {
                    db.businessplan.Add(new businessplan
                    {
                        Id               = Guid.NewGuid().ToString(),
                        Birthday         = date,
                        Partner          = file["Partner"],
                        Address          = file["Address"].Replace(",", ""),
                        CompanyUrl       = file["CompanyUrl"],
                        C__CompanyName   = file["C__CompanyName"],
                        C__ProjectPayOut = Communal.StringBuil(file["C__ProjectPayOut"]),
                        C__Setback       = file["C__Setback"],
                        ProjectTantistop = Communal.StringBuil(file["ProjectTantistop"]),
                        Dictum           = file["Dictum"],
                        Email            = file["Email"],
                        InDetails        = file["InDetails"],
                        Name             = file["Name"],
                        PayMoney         = payout,
                        Phone            = file["Phone"],
                        ProjectDescribe  = file["ProjectDescribe"],
                        Sex              = file["Sex"],
                        ProjectName      = file["ProjectName"],
                        TeamDescribe     = file["TeamDescribe"],
                        WeChat           = file["WeChat"],
                        FilePath         = "/File/" + FilesName
                    });
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    return(Content("<script>alert('信息添加失败,请在仔细核对..');window.location.href='home/index'</script>"));
                }

                return(Content("<script>alert('已收到您的信息,请耐心等待,我们会向您联系,请保持电话畅通.!');window.location.href='home/index'</script>"));
            }
            else
            {
                ModelState.AddModelError("Error", "数据库添加失败");
                return(Content("<script>alert('数据添加失败,请在仔细核对..')</script>"));
            }
        }
Exemplo n.º 4
0
        public ActionResult Index(FormCollection files)
        {
            var db = GolbalDbContext.Instace().confige.Find(0);

            if (files != null)
            {
                db.webName  = files["WebName"].ToString().Trim();
                db.Parthers = files["Parthers"].ToString().Trim();
                db.brief    = files["Webbrief"].ToString().Trim();
                db.PayOut   = files["PayOut"].ToString().Trim();
                db.keyWord  = files["keyWord"].ToString().Trim();
                GolbalDbContext.Instace().SaveChanges();
            }
            return(RedirectToAction(Url.Action("Index", "Home")));
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            ///给输入框赋值
            var db = GolbalDbContext.Instace().confige;

            foreach (var item in db.Where(u => u.id == 0))
            {
                ViewData["WebName"] = item.webName;
                ViewData["Brief"]   = item.brief.Trim();
                ViewData["Parther"] = item.Parthers;
                ViewData["PayOut"]  = item.PayOut.Trim();
                ViewData["keyWord"] = item.keyWord.Trim();
            }
            return(View());
        }
Exemplo n.º 6
0
        public ActionResult Index()
        {
            var db = GolbalDbContext.Instace().confige;

            foreach (var item in db.Where(u => u.id == 0))
            {
                ViewData["WebName"] = item.webName;
                ViewData["Brief"]   = item.brief.Trim();
                ViewData["Parther"] = Communal.ReturnList(item.Parthers).ToList();
                ViewData["PayOut"]  = Communal.ReturnList(item.PayOut).ToList();
                ViewData["keyWord"] = Communal.ReturnList(item.keyWord).ToList();
            }
            Dictionary <string, string> pairs = new Dictionary <string, string>()
            {
            };

            pairs.Add("男", "男");
            pairs.Add("女", "女");
            ViewData["Sex"] = new SelectList(pairs, "Key", "Value");
            return(View());
        }
Exemplo n.º 7
0
        /// <summary>
        ///  文件下载
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Download(string id)
        {
            var filepath = GolbalDbContext.Instace().businessplan.FirstOrDefault(u => u.Id == id).FilePath;

            if (filepath != null)
            {
                try
                {
                    string path     = AppDomain.CurrentDomain.BaseDirectory + filepath;
                    string fileName = filepath.Split('/')[3];
                    return(File(new FileStream(path, FileMode.Open), "application/octet-stream", fileName));
                }
                catch (Exception el)
                {
                    return(Content("<script>alert('文件下载失败,请重试');window.history.back(-1); </script>"));
                }
            }
            else
            {
                return(Content("<script>alert('文件下载失败,请重试');window.history.back(-1); </script>"));
            }
        }
Exemplo n.º 8
0
 /// <summary>
 ///  显示数据
 /// </summary>
 /// <returns></returns>
 public ActionResult Exhibition()
 {
     ViewData["WebName"] = GolbalDbContext.Instace().confige.Find(0).webName;
     return(View(GolbalDbContext.Instace().businessplan.ToList()));
 }
Exemplo n.º 9
0
 // GET: Admin
 public ActionResult Index()
 {
     ViewData["WebName"] = GolbalDbContext.Instace().confige.Find(0).webName;
     return(View());
 }