public object AddBulletin([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userid = dy.userid; //获取用户基本信息 OperatorProvider.AppUserId = userid; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } var entity = new BulletinEntity { SGNAME = dy.SgName, SGTYPE = dy.SgType, SGTYPENAME = dy.SgTypeName, HAPPENTIME = dy.HappenTime, SGLEVEL = dy.SgLevel, AREAID = dy.AreaId, AREANAME = dy.AreaName, SGLEVELNAME = dy.SgLevelName, RSSHSGTYPE = dy.RsshsgType, RSSHSGTYPENAME = dy.RsshsgTypeName, ISTZSBSG = Convert.ToInt32(dy.IstzsbSg), EQUIPMENTNAME = dy.EquipmentName, EQUIPMENTID = dy.EquipmentId, JYJG = dy.Jyjg, SWNUM = Convert.ToInt32(dy.SwNum), ZSNUM = Convert.ToInt32(dy.ZsNum), SZNUM = Convert.ToInt32(dy.SzNum), QSNUM = Convert.ToInt32(dy.QsNum), SHQKSHJE = dy.Shqkshje, TDQK = dy.Tdqk, CBYY = dy.Cbyy, HFQK = dy.Hfqk, FILES = dy.Files, DEPARTMENTID = dy.DepartmentId, DEPARTMENTNAME = dy.DepartmentName, SGKBUSERID = dy.SgkbUserId, SGKBUSERNAME = dy.SgkbUserName, TBTIME = dy.Tbtime, MOBILE = dy.Mobile }; bulletinbll.SaveForm("", entity); } catch (Exception) { return(new { code = -0, count = 0, info = "保存失败" }); } return(new { code = 0, count = 0, info = "保存成功" }); }
public ActionResult SaveForm(string keyValue, BulletinEntity entity) { string HAPPENTIME = Request["HAPPENTIME"] ?? ""; if (HAPPENTIME.Length > 0) { entity.HAPPENTIME = DateTime.Parse(HAPPENTIME); } bulletinbll.SaveForm(keyValue, entity); return(Success("操作成功。")); }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, BulletinEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }