public ActionResult EditMoney() { var id = Request["ID"] != null?Convert.ToInt64(Request["ID"]) : 0; var EditSumMoney = Convert.ToDecimal(Request["EditSumMoney"]); var Tfg = T_FGJHtmlDataService.LoadEntities(x => x.ID == id).FirstOrDefault(); Tfg.FwSumMoney = (EditSumMoney / 10000).ToString() + "万元"; Tfg.SumMoneyID = GetMoney(Tfg.FwSumMoney); Tfg.Money_int = Convert.ToDecimal(Math.Round(Convert.ToDouble(EditSumMoney / Tfg.Pingmi_int), 2)); if (T_FGJHtmlDataService.EditEntity(Tfg)) { return(Json("ok", JsonRequestBehavior.AllowGet)); } else { return(Json("no", JsonRequestBehavior.AllowGet)); } }
//添加写入信息//修改我写入的信息 public ActionResult AddEditData(T_FGJHtmlData tfhd) { if (tfhd.ID > 0)//修改 { if (T_FGJHtmlDataService.EditEntity(tfhd)) { return(Json(new { ret = "ok", msg = "修改成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = "no", msg = "在修改过程中出现未知错误,请联系管理员!" }, JsonRequestBehavior.AllowGet)); } } else { tfhd.AddItemsUserID = LoginUser.ID; tfhd.Laiyuan = "AddDAT"; tfhd.Pingmi_int = decimal.Parse(Request["FwMianji"]); tfhd.Money_int = decimal.Parse(Request["Smoney"]); tfhd.FwSumMoney = Request["Amoney"] + "万(单价" + tfhd.Money_int + "元/㎡)"; tfhd.FwHuXing = Request["HXs"] + "室" + Request["HXt"] + "厅" + Request["HXw"] + "卫"; tfhd.SumMoneyID = AllClass.GetMoney(Request["Smoney"].ToString()); tfhd.MianjiID = AllClass.GeiMinji(tfhd.FwMianji); tfhd.HuXingID = AllClass.GetHuxing(tfhd.FwHuXing); tfhd.AddUserTiem = MvcApplication.GetT_time(); tfhd.HLhref = ""; tfhd.Image_str = tfhd.Image_str != null?tfhd.Image_str.Trim().Length > 0 ? "有---" + tfhd.Image_str : tfhd.Image_str : tfhd.Image_str; var DisctD = T_FGJHtmlDataService.LoadEntities(x => x.photo == tfhd.photo && x.HLName == tfhd.HLName).FirstOrDefault(); if (DisctD != null) { return(Json(new { ret = "no", msg = "要新增的信息中电话与信息名称在数据库中的有重复,请核对信息在添加!" }, JsonRequestBehavior.AllowGet)); } T_FGJHtmlDataService.AddEntity(tfhd); return(Json(new { ret = "ok", msg = "添加成功!" }, JsonRequestBehavior.AllowGet)); } }