/// <summary> /// 添加巡查日志管理 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddPatrolLogs(QW_PatrolLogModel model) { using (Entities db = new Entities()) { qw_patrollogs newmodel = new qw_patrollogs(); newmodel.userid = model.userid; newmodel.checkid = model.checkid; newmodel.checkname = model.checkname; newmodel.isfound = model.isfound; newmodel.reporttime = DateTime.Now; newmodel.remark = model.remark; db.qw_patrollogs.Add(newmodel); db.SaveChanges(); return(newmodel.logid); } }
public object AddPatrolLogs(PatrolLog model) { QW_PatrolLogModel qpmodel = new QW_PatrolLogModel(); int success = 0; string checkid = ""; string checkname = ""; foreach (var item in model.list) { if (item.isnot != 0) { checkid += item.id + ","; checkname += item.name + ","; qpmodel.isfound = item.isnot; } } if (checkid == "" && checkname == "") { foreach (var ite in model.list) { checkid += ite.id + ","; checkname += ite.name + ","; qpmodel.isfound = 0; } } qpmodel.checkid = checkid; qpmodel.checkname = checkname.Substring(0, checkname.Length - 1); qpmodel.userid = model.userid; qpmodel.remark = model.remark; success = bll.AddPatrolLogs(qpmodel); if (success > 0) { return(new { msg = "上报成功", resCode = 1 }); } else { return(new { msg = "json数据不正确", resCode = 0 }); } }
/// <summary> /// 添加巡查日志管理 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddPatrolLogs(QW_PatrolLogModel model) { return(dal.AddPatrolLogs(model)); }