public ActionResult Create(Model.Service collection, string IsContinue = "0") { ReturnMessage rm = new ReturnMessage(false); if (ModelState.IsValid) { try { if (!CheckRepeat(collection)) { rm.IsSuccess = false; rm.Message = "已有相同记录存在!"; } else { bool res = _bll.Add(collection); rm.IsSuccess = res; if (rm.IsSuccess) { OperateLogHelper.Create(collection); rm.IsContinue = IsContinue == "1"; } } } catch (Exception ex) { rm.Message = ex.Message; } } return(Json(rm)); }
public ActionResult Index() { var btnList = CommonHelper.GetBtnAuthorityForPage("服务名称管理"); ViewBag.BtnList = btnList; var maxPrimaryId = (int)(_bll.Max(t => t._id) ?? 0); //var list = DBContext.Mongo.Find<ServiceEntity>(DBContext.DbName, "ServiceList", // , new List<string> { "ServiceName", "PrimaryId" }); var list = BusinessContext.ServiceList.GetList(Query <ServiceEntity> .GT(t => t.PrimaryId, maxPrimaryId)); var gList = list.GroupBy(p => new { p.PrimaryId, p.ServiceName }). Select(p => new GroupName { _id = p.Key.PrimaryId, ServiceName = p.Key.ServiceName, ServiceNameCN = p.Key.ServiceName, CreateDateTime = DateTime.Now }).ToList(); if (gList.Count > 0) { _bll.Add(gList); } return(View()); }
public ActionResult Create(VirtualDevice collection, string isContinue = "0") { var rm = new ReturnMessage(false); if (ModelState.IsValid) { try { if (!string.IsNullOrEmpty(collection.ModelNum)) { if (!CheckRepeat(collection)) { rm.IsSuccess = false; rm.Message = "已有相同记录存在!"; } else { collection.CreateOn = DateTime.Now; collection.CreateBy = CurrentHelper.CurrentUser.User.UserName; var res = _bll.Add(collection); rm.IsSuccess = res; if (rm.IsSuccess) { //OperateLogHelper.Create(collection); rm.IsContinue = isContinue == "1"; } } } else { rm.IsSuccess = false; rm.Message = "型号不能为空!"; } } catch (Exception ex) { rm.Message = ex.Message; } } else { rm.IsSuccess = false; rm.Message = "数据格式不正确"; } return(Json(rm)); }
public ActionResult Create(PhysicalDevice collection, string IsContinue = "0") { ReturnMessage RM = new ReturnMessage(false); if (ModelState.IsValid) { try { if (!string.IsNullOrEmpty(collection.ModelNum)) { if (!CheckRepeat(collection)) { RM.IsSuccess = false; RM.Message = "已有相同记录存在!"; } else { bool res = _bll.Add(collection); RM.IsSuccess = res; if (RM.IsSuccess) { OperateLogHelper.Create(collection); RM.IsContinue = IsContinue == "1"; } } } else { RM.IsSuccess = false; RM.Message = "型号不能为空!"; } } catch (Exception ex) { RM.Message = ex.Message; } } else { RM.IsSuccess = false; RM.Message = "数据格式不正确"; } return(Json(RM)); }