コード例 #1
0
ファイル: HomeController.cs プロジェクト: KeanZz/shxinfang
        public ActionResult AddSave(string Name, string Address, decimal AveragePrice, string Business, string School, string Hospital,
                                    string Enjoy, string DeadLine, decimal Areas, decimal Green, int Years, string Property, string Develops, string Certificate)
        {
            Model.Content.Builds builds = new Model.Content.Builds();
            builds.Name         = Name;
            builds.Address      = Address;
            builds.AveragePrice = AveragePrice;
            builds.Business     = Business;
            builds.School       = School;
            builds.Hospital     = Hospital;
            builds.Enjoy        = Enjoy;
            builds.DeadLine     = DeadLine;
            builds.Areas        = Areas;
            builds.Green        = Green;
            builds.Years        = Years;
            builds.Property     = Property;
            builds.Developers   = Develops;
            builds.Certificate  = Certificate;
            builds.Person       = "admin";
            builds.Time         = DateTime.Now;
            builds.PID          = Guid.NewGuid().ToString();
            bool ret = BD.Insert(builds);

            return(Json(new { Code = ret }));
        }
コード例 #2
0
        public ActionResult UserSave(string name, string phone, string Fid)
        {
            Model.Content.Customers customers = new Model.Content.Customers();
            customers.FID   = Fid;
            customers.Time  = DateTime.Now;
            customers.Name  = name;
            customers.Phone = phone;
            bool bol = Cus.Insert(customers);

            return(Json(new { status = bol }));
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: KeanZz/shxinfang
        public JsonResult UploadSave(string ID, string username, string comment)
        {
            string pathForSaving = Server.MapPath("~/");
            string sqlcount      = "select top 1* from builds where isdel=0 and  PID='" + ID + "'";

            Model.Content.Builds builds = BD.GetModelByValue(sqlcount, null);
            try
            {
                foreach (string strfile in Request.Files)
                {
                    try
                    {
                        HttpPostedFileBase uploadFile = Request.Files[strfile] as HttpPostedFileBase;
                        if (uploadFile != null && uploadFile.ContentLength > 0)
                        {
                            var paths = DateTime.Now.ToString("yyMMdd_hhmmss") + "_" + uploadFile.FileName;
                            uploadFile.SaveAs(Server.MapPath("/UploadFiles/") + paths);
                            //添加附件信息
                            Model.Content.BDetails bDetails = new Model.Content.BDetails();
                            bDetails.Person  = username;
                            bDetails.PID     = ID;
                            bDetails.Urls    = "/UploadFiles/" + paths;
                            bDetails.Time    = DateTime.Now;
                            bDetails.Explain = comment;
                            bDetails.Type    = 7;//7为评论图片
                            Details.Insert(bDetails);
                        }
                    }
                    catch (Exception ee)
                    {
                        //邮件通知
                    }
                }
            }
            catch (Exception ee)
            {
                return(Json(new { code = 1 }, JsonRequestBehavior.DenyGet));
            }
            return(Json(new { code = 0 }, JsonRequestBehavior.DenyGet));
        }