public ActionResult AdminApply(int id, int state, string msg) { using (LoveBankDBContext db = new LoveBankDBContext()) { Supervise model = db.T_Supervise.Find(id); var vol = db.T_Vol; Vol vEntity = vol.Find(model.AddUser); if (model.State != SuperviseRowState.已回复) { vEntity.LoveBankScore = vEntity.LoveBankScore + 5; db.Update<Vol>(vEntity); db.SaveChanges(); } model.Msg = msg.Trim(); model.State = (SuperviseRowState)state; db.Update<Supervise>(model); db.SaveChanges(); #region 发送通知信息 //短信通知 //string failMsg = "【社区1+1】您于" + model.AddTime.ToString("yyyy-MM-dd HH:mm") + "投诉的:" + model.Content + ".管理员处理,处理意见是:" + msg; SMSComm.Send(vEntity.Phone, "【社区1+1】您于" + model.AddTime.ToString("yyyy-MM-dd HH:mm") + "反映的问题我们将尽快核实处理,感谢您的参与."); //App 推送通知待完善 #endregion } return Success("操作成功"); }
public ActionResult ChangeStateAdImg(int id, int state) { using (LoveBankDBContext db = new LoveBankDBContext()) { AppVer img = db.T_AppVer.Find(id); img.State = state; db.Update<AppVer>(img); db.SaveChanges(); db.Dispose(); return Success("操作成功"); } }
public ActionResult Delete(int id) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_i = db.T_InfoManage; InfoManage iEntity = t_i.Find(id); iEntity.State = RowState.删除; db.Update(iEntity); db.SaveChanges(); return Success("删除成功"); } }
public ActionResult PostEdit(IncomeAndPayDetail parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_wsn = db.T_IncomeAndPayDetail; IncomeAndPayDetail model = t_wsn.Find(parm.ID); model.Sort = parm.Sort; model.Title = parm.Title; model.Content = parm.Content; model.FlowTo = parm.FlowTo; model.Type = parm.Type; db.Update(model); db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(WebSitNotice parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_wsn = db.T_WebSitNotice; WebSitNotice model = t_wsn.Find(parm.ID); model.Sort = parm.Sort; model.Source = parm.Source; model.Title = parm.Title; model.Content = parm.Content; db.Update(model); db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(LBStartOrBottomAdModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_m = db.T_Machine; var t_a = db.T_LBStartOrBottomAd; var t_s = db.T_SourceFile; #region 初始化参数 LBStartOrBottomAd model = t_a.Find(parm.ID); model.Title = parm.Title; model.Desc = parm.Desc; model.LinkUrl = parm.LinkUrl; model.DeptId = parm.DeptId; model.Postion = parm.Postion; ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where s.Guid == model.Guid select s; db.T_SourceFile.RemoveRange(delSourceFile); db.SaveChanges(); #endregion db.Update<LBStartOrBottomAd>(model); db.SaveChanges(); foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(InfoManageModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_m = db.T_Machine; var t_a = db.T_InfoManage; var t_s = db.T_SourceFile; #region 初始化参数 InfoManage model = t_a.Find(parm.ID); model.Title = parm.Title; model.Desc = parm.Desc; model.DeptId = parm.DeptId; model.LinkUrl = parm.Desc; model.Phone = parm.Desc; model.Contact = parm.Desc; model.Type = parm.Type; ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where s.Guid == model.Guid select s; db.T_SourceFile.RemoveRange(delSourceFile); #endregion db.Update<InfoManage>(model); db.SaveChanges(); db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 db.SaveChanges(); return Success("添加成功"); } }
public ActionResult PostEdit(CServiceCenterInfo parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_wsn = db.T_CServiceCenterInfo; CServiceCenterInfo model = t_wsn.Find(parm.ID); model.Sort = parm.Sort; model.Type = parm.Type; model.Title = parm.Title; model.Content = parm.Content; db.Update(model); db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(TeamProjectModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var am = db.T_TeamProject; var t_s = db.T_SourceFile; TeamProject model = am.Find(parm.ID); model.Name = parm.Name; model.Desc = parm.Desc; model.Type = parm.Type; //model.RecruitStartDate = parm.RecruitStartDate; //model.RecruitEndDate = parm.RecruitEndDate; model.ProjectStartDate = parm.ProjectStartDate; model.ProjectEndDate = parm.ProjectEndDate; model.ServiceDate = parm.ServiceDate; model.Address = parm.Address; model.ServiceObject = parm.ServiceObject; model.HtmlUrl = parm.HtmlUrl; model.LinkMan = parm.LinkMan; model.LinkPhone = parm.LinkPhone; model.Score = parm.Score; model.CommentSocre = parm.CommentSocre; model.GoodScore = parm.GoodScore; model.ShareScore = parm.ShareScore; db.Update<TeamProject>(model); db.SaveChanges(); ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where s.Guid == model.Guid select s; db.T_SourceFile.RemoveRange(delSourceFile); db.SaveChanges(); if (parm.SourceFileList!=null) { foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 db.SaveChanges(); } return Success("修改成功"); } }
public ActionResult PostEdit(UnitInfoAbout parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_wsn = db.T_UnitInfoAbout; UnitInfoAbout model= (from w in t_wsn where w.DeptId == AdminUser.DeptId select w).FirstOrDefault(); if (model==null) { parm.AddUserId = AdminUser.ID; parm.DeptId = AdminUser.DeptId; parm.AddTime = DateTime.Now; parm.State = RowState.有效; db.Add(parm); db.SaveChanges(); return Success("保存成功"); } //UnitInfoAbout model = t_wsn.Find(parm.ID); model.Sort = parm.Sort; model.Address = parm.Address; model.Title = parm.Title; model.Content = parm.Content; model.EMail = parm.EMail; model.Fax = parm.Fax; model.Type = parm.Type; model.UnitName = parm.UnitName; db.Update(model); db.SaveChanges(); return Success("保存成功"); } }
public ActionResult PostVolBindNFC(Vol model) { if (string.IsNullOrEmpty(model.NFC) || model.NFC.Length != 10) { return Error("卡号不对,请重新操作"); } using (LoveBankDBContext db = new LoveBankDBContext()) { var t_v = db.T_Vol; Vol vol = t_v.FirstOrDefault(x => x.ID == model.ID); if (vol == null) { return Error("用户不存在,请核实后从新操作"); } if (t_v.Count(x => x.NFC == model.NFC) > 0) { return Error("该NFC卡已经被绑定"); } vol.NFC = model.NFC; db.Update(vol); db.SaveChanges(); } return Success("绑定成功"); }
public ActionResult PostEdit(AdminUser model) { using (LoveBankDBContext db = new LoveBankDBContext()) { AdminUser user = db.T_AdminUser.First(x => x.ID == model.ID); if (user == null) return Error("用户不存在"); user.DeptId = model.DeptId; user.RealName = model.RealName; user.RoleID = model.RoleID; db.Update<AdminUser>(user); db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(WorkGuide entity) { using (LoveBankDBContext db = new LoveBankDBContext()) { WorkGuide work = db.T_WorkGuide.Find(entity.Id); work.AddTime = DateTime.Now; work.Des = entity.Des; work.AddUser = entity.AddUser; work.ImgUrl = entity.ImgUrl; work.Title = entity.Title; work.LinkSocSerUrl = entity.LinkSocSerUrl; work.UploadHtmlFile = entity.UploadHtmlFile; db.Update(work); db.SaveChanges(); } return Success("添加成功"); }
public ActionResult PostEdit(MachineModuleShowManageModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_m = db.T_Machine; var t_a = db.T_LoveBank_Ad; var t_s = db.T_SourceFile; var am = db.T_MachineModuleShowManage; #region 初始化参数 MachineModuleShowManage model = am.Find(parm.ID); model.AddTime = DateTime.Now; model.AddUserId = AdminUser.ID; model.State = RowState.有效; //model.Guid = Guid.NewGuid().ToString(); model.DeptId = parm.DeptId; model.IconUrl = parm.IconUrl; model.LinkUrl = parm.LinkUrl; model.ModuleKey = parm.ModuleKey; model.Name = parm.Name; model.Sort = parm.Sort; model.Type = parm.Type; model.Icon = parm.Icon; foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where s.Guid == model.Guid select s; db.T_SourceFile.RemoveRange(delSourceFile); db.SaveChanges(); #endregion db.Update<MachineModuleShowManage>(model); db.SaveChanges(); foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(TeamModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_a = db.T_LoveBank_Ad; var t_s = db.T_SourceFile; var am = db.T_Team; #region 初始化参数 Team model = am.Find(parm.Id); model.DeptId = parm.DeptId; model.Address = parm.Address; model.Desc = parm.Desc; model.EstabDate = parm.EstabDate; model.Level = parm.Level; model.LinkMan = parm.LinkMan; model.LinkPhone = parm.LinkPhone; model.Name = parm.Name; model.WebSite = parm.WebSite; foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where s.Guid == model.Guid select s; db.T_SourceFile.RemoveRange(delSourceFile); db.SaveChanges(); #endregion db.Update<Team>(model); db.SaveChanges(); foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 db.SaveChanges(); return Success("修改成功"); } }
public ActionResult App_UpdateUser(AppUser user) { JsonMessage returnJson = new JsonMessage(); using (LoveBankDBContext db = new LoveBankDBContext()) { var t_a = db.T_AppUser; AppUser entityAppUser = db.T_AppUser.Where(x=>x.ID==user.ID).FirstOrDefault(); entityAppUser.Age = user.Age; entityAppUser.Name = user.Name; entityAppUser.NickName = user.NickName; entityAppUser.Sex = user.Sex; db.Update(entityAppUser); db.SaveChanges(); returnJson.Status = true; returnJson.Info = "修改成功"; returnJson.Data = HttpContext.Error; return Json(returnJson); } returnJson.Status = false; returnJson.Info = "登录失败,系统异常"; returnJson.Data = HttpContext.Error; return Json(returnJson); }
public ActionResult PostEdit(ProductModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_m = db.T_Product; var t_a = db.T_LoveBank_Ad; var t_s = db.T_SourceFile; #region 初始化参数 Product model = t_m.Find(parm.Id); model.Name = parm.Name; model.Price = parm.Price; model.CostScore = parm.CostScore; model.Count = parm.Count; model.EndTime = parm.EndTime; model.StartTime = parm.StartTime; model.BarCode = parm.BarCode; model.Desc = parm.Desc; model.Type = parm.Type; model.Sponsors = parm.Sponsors; //foreach (var item in parm.SourceFileList) //{ // item.Guid = model.Guid; // item.AddTime = DateTime.Now; //} ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where (!string.IsNullOrEmpty(model.Guid) && s.Guid == model.Guid) || (!string.IsNullOrEmpty(model.LogoGuid) && s.Guid == model.LogoGuid) || (!string.IsNullOrEmpty(model.AdGuid) && s.Guid == model.AdGuid) select s; db.T_SourceFile.RemoveRange(delSourceFile); db.SaveChanges(); #endregion db.Update<Product>(model); db.SaveChanges(); foreach (var item in parm.SourceFileList) { if (string.IsNullOrEmpty(model.Guid)) { model.Guid = Guid.NewGuid().ToString(); } item.AddTime = DateTime.Now; item.Guid = model.Guid; } foreach (var item in parm.SourceFileListLogo) { if (string.IsNullOrEmpty(model.LogoGuid)) { model.LogoGuid = Guid.NewGuid().ToString(); } item.AddTime = DateTime.Now; item.Guid = model.LogoGuid; } foreach (var item in parm.SourceFileListAd) { if (string.IsNullOrEmpty(model.AdGuid)) { model.AdGuid = Guid.NewGuid().ToString(); } item.AddTime = DateTime.Now; item.Guid = model.AdGuid; } db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 if (parm.SourceFileListLogo != null &&parm.SourceFileListLogo.Count > 0) { db.T_SourceFile.AddRange(parm.SourceFileListLogo); } if (parm.SourceFileListAd!=null&&parm.SourceFileListAd.Count>0) { db.T_SourceFile.AddRange(parm.SourceFileListAd); } //db.T_SourceFile.AddRange(parm.SourceFileList); db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEditTeamProjectSummary(TeamProjectSummaryModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_s = db.T_SourceFile; var t_ps = db.T_TeamProjectSummary; TeamProjectSummary model = t_ps.Find(parm.Id); //model.AddTime = DateTime.Now; //model.AddUserId = AdminUser.ID; //model.State = RowState.有效; //model.Guid = Guid.NewGuid().ToString(); model.SubTitle = parm.SubTitle; //model.TeamProjectId = parm.TeamProjectId; model.Desc = parm.Desc; //foreach (var item in parm.SourceFileList) //{ // item.Guid = model.Guid; // item.AddTime = DateTime.Now; //} ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) //var delSourceFile = from s in t_s where s.Guid == model.Guid select s; //db.T_SourceFile.RemoveRange(delSourceFile); //db.SaveChanges(); //db.T_SourceFile.AddRange(parm.SourceFileList); //db.SaveChanges(); db.Update<TeamProjectSummary>(model); db.SaveChanges(); return Success("新增成功"); } }
public ActionResult PostEdit(Notice model) { using (LoveBankDBContext db = new LoveBankDBContext()) { Notice entity = db.T_Notice.Find(model.Id); entity.Des = model.Des; entity.ImgUrl = model.ImgUrl; entity.Title = model.Title; entity.State = model.State; entity.LinkSocSerUrl = model.LinkSocSerUrl; entity.UploadHtmlFile = model.UploadHtmlFile; // entity.AddTime = DateTime.Now; db.Update(entity); db.SaveChanges(); } return Success("添加成功"); }
/// <summary> /// 兑换产品: /// 参数:MacineCode机器Id /// LoveBankProductId:被兑换产品Id /// MacineCode:被兑换机器唯一码 /// Type: 账号登陆兑换 = 0, 二维码登陆兑换 = 1, NFC登陆兑换 = 2 /// ExChangeCount:兑换数量,默认值是:1 /// AddUserId:兑换人的用户ID /// Address(可选,兑换的地址) /// </summary> /// <param name="entity"></param> /// <returns></returns> public ActionResult App_ExchangeProduct(LoveBankProductExchangeLog entity) { entity.AddTime = DateTime.Now; entity.ExChangeCount = entity.ExChangeCount <= 0 ? 1 : entity.ExChangeCount; entity.Source = "爱心银行"; entity.State = 0; JsonMessage retJson = new JsonMessage(); using (LoveBankDBContext db = new LoveBankDBContext()) { var t_p = db.T_Product; var t_v = db.T_Vol; var t_d = db.T_Department; var t_m = db.T_Machine; Product productModel = t_p.Find(entity.LoveBankProductId); if (productModel == null) { retJson.Status = false; retJson.Info = "产品不存在"; return Json(retJson); } if (productModel.Count < entity.ExChangeCount) { retJson.Status = false; retJson.Info = "产品数量不足"; return Json(retJson); } Vol vol = t_v.Find(entity.AddUserId); if (vol == null) { retJson.Status = false; retJson.Info = "用户不存在"; return Json(retJson); } MachineModel mm = (from m in t_m where m.MachineCode == entity.MacineCode select new MachineModel { Address = m.Address, Lat = m.Lat, Lon = m.Lon, DeptId = m.DeptId }).FirstOrDefault(); if (vol.DepId.IndexOf(mm.DeptId) < 0)//判断该机器和用户是否是同一个社区 { var depName = (from d in t_d where d.Id == mm.DeptId select d.Name).FirstOrDefault(); retJson.Status = false; retJson.Info = string.Format("抱歉,该终端只服务于{0}用户", depName); retJson.Data = "-2"; return Json(retJson); } if (vol.DepId.IndexOf(productModel.DeptId) < 0)//判断是否属于该社区 { var depName = (from d in t_d where d.Id == productModel.DeptId select d.Name).FirstOrDefault(); retJson.Status = false; retJson.Info = string.Format("抱歉,该产品属于{0}", depName); retJson.Data = "-2"; return Json(retJson); } int totalCostScore = entity.CostScore * entity.ExChangeCount; if (!vol.LoveBankScore.HasValue || vol.LoveBankScore.Value < totalCostScore) { retJson.Status = false; retJson.Info = "积分不足,可用积分:" + vol.LoveBankScore + ".对应产品所需总积分:" + totalCostScore + ".兑换数量:" + entity.ExChangeCount; return Json(retJson); } productModel.Count = productModel.Count - entity.ExChangeCount;//减少兑换数量 db.Update<Product>(productModel); db.SaveChanges(); entity.Address = mm.Address; entity.Lat = mm.Lat; entity.Lon = mm.Lon; entity.CostScore = productModel.CostScore * entity.ExChangeCount; db.Add<LoveBankProductExchangeLog>(entity);//保存兑换记录 db.SaveChanges(); vol.LoveBankScore = vol.LoveBankScore - entity.CostScore * entity.ExChangeCount;//减少积分 db.Update<Vol>(vol); db.SaveChanges(); retJson.Status = true; retJson.Info = "兑换成功"; } return Json(retJson); }
/// <summary> /// App推送消息标识 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult PushMsg(int id) { using (LoveBankDBContext db = new LoveBankDBContext()) { Notice notice = db.T_Notice.Find(id); if (notice.State >= 1) { return Json("已经推送,不能再推送"); } notice.State = 1; db.Update<Notice>(notice); db.SaveChanges(); db.Dispose(); return Json("操作成功"); } }
public ActionResult PostEdit(LoveBank_AdModel parm) { using (LoveBankDBContext db = new LoveBankDBContext()) { var t_m = db.T_Machine; var t_a = db.T_LoveBank_Ad; var t_s = db.T_SourceFile; #region 初始化参数 LoveBank_Ad model = t_a.Find(parm.ID); model.MachineCode = parm.MachineCode; model.Title = parm.Title; model.Desc = parm.Desc; model.LinkUrl = parm.LinkUrl; ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现) var delSourceFile = from s in t_s where s.Guid == model.Guid select s; db.T_SourceFile.RemoveRange(delSourceFile); db.SaveChanges(); #endregion var mDeptId = from m in t_m where model.MachineCode == m.MachineCode select new { m.DeptId, m.ID }; var tmpObjMachine = mDeptId.SingleOrDefault(); if (tmpObjMachine == null) { return Error("机器唯未授权,请先授权"); } model.DeptId = tmpObjMachine.DeptId.ToString(); model.MachineId = tmpObjMachine.ID; db.Update<LoveBank_Ad>(model); db.SaveChanges(); foreach (var item in parm.SourceFileList) { item.Guid = model.Guid; item.AddTime = DateTime.Now; } db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定 db.SaveChanges(); return Success("修改成功"); } }
public ActionResult PostEdit(GridMemberModel entity) { using (LoveBankDBContext db = new LoveBankDBContext()) { GridMember model = db.T_GridMember.Find(entity.Id); model.Desc = entity.Desc; model.GridName = entity.GridName; model.GridNo = entity.GridNo; model.GridPhone = entity.GridPhone; model.VDeptId = entity.VDeptId; model.GridHeaderImg = entity.SourceFile.Domain + entity.SourceFile.Path; //grid.Desc = entity.Desc; //grid.GridHeaderImg = entity.GridHeaderImg; //grid.GridName = entity.GridName; //grid.GridNo = entity.GridNo; //grid.GridPhone = entity.GridPhone; //grid.VDeptId = entity.VDeptId; db.Update(model); db.SaveChanges(); } return Success("修改成功"); }