public JsonResult IsActive(int id) { var vCategory = _categoryServices.GetById(id); if (vCategory == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { vCategory.Active = !vCategory.Active; _categoryServices.Update(vCategory); // var vm = _mapper.Map<VideoCategoryVM>(vCategory); AR.Data = RenderPartialViewToString("_CategoryItem", vCategory); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.VideoCategory)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public async Task <IActionResult> Create(TeamIM team) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR)); } try { var model = _mapper.Map <Team>(team); model.CreatedBy = User.Identity.Name; model.CreatedDate = DateTime.Now; _context.Add(model); await _context.SaveChangesAsync(); AR.SetSuccess(string.Format(Messages.AlertCreateSuccess, EntityNames.Team)); return(Json(AR)); } catch (Exception er) { AR.Setfailure(er.Message); return(Json(AR)); } }
public async Task <JsonResult> Recommend(int id) { Product vProduct = await _db.Products.FindAsync(id); if (vProduct == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { vProduct.Recommend = !vProduct.Recommend; _db.Entry(vProduct).State = EntityState.Modified; await _db.SaveChangesAsync(); var vm = _mapper.Map <ProductVM>(vProduct); AR.Data = RenderPartialViewToString("_ProductItem", vm); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Product)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
// GET: Admin/Laboratories/Edit/5 public async Task <ActionResult> Edit(int?id) { var vm = new LaboratoryIM { Active = true, Importance = 0 }; if (id > 0) { var vAchi = await _db.Laboratories.FindAsync(id); if (vAchi == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.AllowGet)); } vm = _mapper.Map <Laboratory, LaboratoryIM>(vAchi); } var institutes = await _db.Institutes.OrderByDescending(m => m.Importance).ToListAsync(); ViewBag.Institutes = new SelectList(institutes, "Id", "Title"); return(View(vm)); }
public async Task <IActionResult> Create(PostIM post) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR)); } try { var model = _mapper.Map <Post>(post); model.CreatedBy = User.Identity.Name; model.CreatedDate = DateTime.Now; //model.Body = WebUtility.HtmlEncode(page.Body); _context.Add(model); await _context.SaveChangesAsync(); AR.SetSuccess(string.Format(Messages.AlertCreateSuccess, EntityNames.Post)); return(Json(AR)); } catch (Exception er) { AR.Setfailure(er.Message); return(Json(AR)); } }
public JsonResult EditSite(SiteInfoIM vm) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { var xmlFile = Server.MapPath("~/Config/GlobalSettings.config"); XDocument doc = XDocument.Load(xmlFile); var item = doc.Descendants("Settings").FirstOrDefault(); item.Element("SiteName").SetValue(vm.SiteName ?? ""); item.Element("SiteDomainName").SetValue(vm.SiteDomainName ?? ""); item.Element("WebNumber").SetValue(vm.WebNumber ?? ""); item.Element("BaiduSiteID").SetValue(vm.BaiduSiteID ?? ""); item.Element("GoogleAnalyticsID").SetValue(vm.GoogleAnalyticsID ?? ""); item.Element("DashboardLogo").SetValue(vm.DashboardLogo ?? ""); item.Element("LoginLogo").SetValue(vm.LoginLogo ?? ""); item.Element("MailTo").SetValue(vm.MailTo ?? ""); doc.Save(xmlFile); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public async Task <ActionResult> Edit(int?id) { if (id > 0) { var vCase = await _db.AchievementCategories.FindAsync(id); if (vCase == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.AllowGet)); } var editCase = _mapper.Map <AchievementCategory, AchievementCategoryIM>(vCase); var pageMeta = await _db.PageMetas.FirstOrDefaultAsync(d => d.ModelType == (short)ModelType.ACHIEVEMENTCATEGORY && d.ObjectId == editCase.Id.ToString()); if (pageMeta != null) { editCase.SEOTitle = pageMeta.Title; editCase.Keywords = pageMeta.Keyword; editCase.SEODescription = pageMeta.Description; } return(View(editCase)); } else { var vm = new AchievementCategoryIM { Active = true, Importance = 0 }; return(View(vm)); } }
public async Task <IActionResult> Copy(int id) { var article = await _context.Products.AsNoTracking().FirstOrDefaultAsync(d => d.Id == id); if (article == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR)); } article.Id = 0; if (User.Identity != null) { article.CreatedBy = User.Identity.Name; } article.CreatedDate = DateTime.Now; article.Active = false; //article.Recommend = false; article.Title = $"{article.Title}【拷贝】"; _context.Products.Add(article); await _context.SaveChangesAsync(); return(Json(AR)); }
public JsonResult Edit(PositionIM vm) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR, JsonRequestBehavior.DenyGet)); } var newPosition = _positionService.GetById(vm.Id); newPosition.Title = vm.Title; newPosition.Code = vm.Code; newPosition.Importance = vm.Importance; newPosition.Sketch = vm.Sketch; newPosition.ImageWidth = vm.ImageWidth; newPosition.ImageHeight = vm.ImageHeight; newPosition.Active = vm.Active; newPosition.UpdatedBy = Site.CurrentUserName; newPosition.UpdatedDate = DateTime.Now; //var newPosition = _mapper.Map<PositionIM, Position>(vm); _positionService.Update(newPosition); // var position = _mapper.Map<PositionVM>(newPosition); AR.Id = newPosition.Id; AR.Data = RenderPartialViewToString("_PositionItem", newPosition); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Position)); return(Json(AR, JsonRequestBehavior.DenyGet)); }
public JsonResult WeiXinSet(WeiXinSetIM im) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { var xmlFile = Server.MapPath("~/Config/WeiXinSettings.config"); var doc = XDocument.Load(xmlFile); var item = doc.Descendants("Settings").FirstOrDefault(); if (item != null) { item.Element("Token")?.SetValue(im.Token); item.Element("AppId")?.SetValue(im.AppId); item.Element("AppSecret")?.SetValue(im.AppSecret); item.Element("EncodingAESKey")?.SetValue(im.EncodingAESKey); } doc.Save(xmlFile); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public IActionResult EditSMTPServer(SMTPServerIM vm) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR)); } try { var xmlFile = PlatformServices.Default.MapPath("/Config/SMTPSettings.config"); XDocument doc = XDocument.Load(xmlFile); var item = doc.Descendants("Settings").FirstOrDefault(); item.Element("From").SetValue(vm.From ?? ""); item.Element("SmtpServer").SetValue(vm.SmtpServer ?? ""); item.Element("Port").SetValue(vm.Port); item.Element("UserName").SetValue(vm.UserName ?? ""); item.Element("Password").SetValue(vm.Password ?? ""); item.Element("EnableSsl").SetValue(vm.EnableSsl); doc.Save(xmlFile); return(Json(AR)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR)); } }
public JsonResult Add(FilterTemplateIM filterTemplate) { if (!ModelState.IsValid) { AR.SetSuccess(GetModelErrorMessage()); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { var newFilterTemplate = _mapper.Map <FilterTemplateIM, FilterTemplate>(filterTemplate); newFilterTemplate.CreatedBy = Site.CurrentUserName; newFilterTemplate.CreatedDate = DateTime.Now; //FilterTemplate. //newFilterTemplate.CreatedDate. _filterTemplateService.Create(newFilterTemplate); //int count; //int filterTemplateSize = SettingsManager.FilterTemplate.PageSize; //var list = _filterTemplateService.GetPagedElements(0, filterTemplateSize, string.Empty, out count); //List<FilterTemplateVM> filterTemplateList = _mapper.Map<List<FilterTemplate>, List<FilterTemplateVM>>(list); //AR.Data = RenderPartialViewToString("_FilterTemplateList", filterTemplateList); AR.SetSuccess(String.Format(Messages.AlertCreateSuccess, EntityNames.FilterTemplate)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception er) { AR.Setfailure(er.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
//[ValidateAntiForgeryToken] public IActionResult UpDownMove(int id, bool isUp, int categoryId) { if (isUp) { var result = _menuService.UpMoveMenu(id); if (result == 0) { AR.SetInfo("已经在第一位!"); return(Json(AR)); } } else { var result = _menuService.DownMoveMenu(id); if (result == 0) { AR.SetInfo("已经在末位!"); return(Json(AR)); } } // var menus = _menuService.GetLevelMenusByCategoryId(categoryId); AR.Id = categoryId; // AR.Data = await _viewRenderService.RenderAsync("_MenuList", menus); AR.SetSuccess("菜单排位成功!"); return(Json(AR)); //AR.Setfailure("菜单排位失败!"); //return Json(AR); }
public async Task <ActionResult> SetRoleMenus(int id, int[] menuId) { if (id > 0) { //_roleServices.SetRoleMenus(id, menuId); var rolemenus = _context.RoleMenus.Where(d => d.RoleId == id).ToList(); _context.RemoveRange(rolemenus); if (menuId != null) { foreach (var mid in menuId) { _context.RoleMenus.Add(new RoleMenu { RoleId = id, MenuId = mid }); } } await _context.SaveChangesAsync(); //var cacheKey = "MENU"; //_cache.Invalidate(cacheKey); return(Json(AR)); } AR.Setfailure("编辑角色权限失败"); return(Json(AR)); }
public JsonResult IsActive(int id) { var page = _db.Photos.Find(id); if (page == null) { AR.Setfailure(String.Format(Messages.AlertUpdateSuccess, EntityNames.Photo)); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { page.Active = !page.Active; _db.Entry(page).State = EntityState.Modified; _db.SaveChanges(); AR.Data = RenderPartialViewToString("_PhotoItem", page); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Photo)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public async Task <JsonResult> IsActive(int id) { var page = await _db.Jobs.FindAsync(id); if (page == null) { AR.Setfailure(String.Format(Messages.AlertUpdateSuccess, EntityNames.Job)); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { page.Active = !page.Active; _db.Entry(page).State = EntityState.Modified; await _db.SaveChangesAsync(); // _jobServices.Update(page); AR.Data = RenderPartialViewToString("_JobItem", page); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Job)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public async Task <ActionResult> EditRole(RoleIM role) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR)); } if (role.Id > 0) { Role vRole = await _context.Roles.FindAsync(role.Id); if (!vRole.IsSys) { vRole.RoleName = role.RoleName; vRole.Description = role.Description; _context.Entry(vRole).State = EntityState.Modified; } else { AR.SetWarning("系统角色不可编辑"); return(Json(AR)); } } else { var vm = _mapper.Map <Role>(role); _context.Add(vm); } await _context.SaveChangesAsync(); AR.SetSuccess(String.Format(Messages.AlertCreateSuccess, EntityNames.Role)); return(Json(AR)); }
public JsonResult Reply(EmailIM vm) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR, JsonRequestBehavior.DenyGet)); } var smtp = _emailAccountServices.GetElements().Where(m => m.IsDefault).FirstOrDefault(); if (smtp == null) { AR.SetWarning(Messages.SetDefaultEmailAccount); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { _emailingService.SendMail(SettingsManager.Site.SiteName, SettingsManager.Site.MailTo, vm.MailTo, string.Empty, vm.Subject, vm.Body, smtp.Smtpserver, smtp.Email, SettingsManager.Site.SiteName, smtp.UserName, EncryptionHelper.Decrypt(smtp.Password), smtp.Port, smtp.EnableSsl); AR.SetSuccess(String.Format(Messages.AlertSendSuccess, EntityNames.Email)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception er) { AR.Setfailure(er.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } //var result = _emailService.SendMail(SettingsManager.Site.SiteName, vm.MailTo, vm.Subject, vm.Body); }
public IActionResult EditSite(SiteInfoIM vm) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR)); } try { var xmlFile = PlatformServices.Default.MapPath("/Config/GlobalSettings.config"); XDocument doc = XDocument.Load(xmlFile); var item = doc.Descendants("Settings").FirstOrDefault(); item.Element("SiteName").SetValue(vm.SiteName ?? ""); item.Element("SiteDomainName").SetValue(vm.SiteDomainName ?? ""); item.Element("WebNumber").SetValue(vm.WebNumber ?? ""); item.Element("BaiduSiteID").SetValue(vm.BaiduSiteID ?? ""); item.Element("EmailHr").SetValue(vm.EmailHr ?? ""); item.Element("IsClose").SetValue(vm.IsClose); item.Element("CloseInfo").SetValue(vm.CloseInfo ?? ""); item.Element("DashboardLogo").SetValue(vm.DashboardLogo ?? ""); item.Element("MailTo").SetValue(vm.MailTo ?? ""); doc.Save(xmlFile); return(Json(AR)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR)); } }
public IActionResult EditCompany(CompanyIM vm) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR)); } try { var configFile = PlatformServices.Default.MapPath("/Config/CompanyConfig.json"); string json = System.IO.File.ReadAllText(configFile, Encoding.UTF8); var ci = Newtonsoft.Json.JsonConvert.DeserializeObject <CompanyConfig>(json); ci.Name = vm.Name; ci.Address = vm.Address; ci.Email = vm.Email; ci.Phone = vm.Phone; ci.Fax = vm.Fax; string output = Newtonsoft.Json.JsonConvert.SerializeObject(ci, Newtonsoft.Json.Formatting.Indented); System.IO.File.WriteAllText(configFile, output); return(Json(AR)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR)); } }
public JsonResult IsActive(int id) { var vPosition = _positionService.GetById(id); if (vPosition == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { vPosition.Active = !vPosition.Active; _positionService.Update(vPosition); //var vm = _mapper.Map<PositionVM>(vPosition); AR.Data = RenderPartialViewToString("_PositionItem", vPosition); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Position)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public JsonResult Delete(string id) { try { if (id == "all") { _logServices.RemoveAll(); AR.SetSuccess("已清空所有日志"); return(Json(AR)); } else { int logId; Int32.TryParse(id, out logId); _logServices.Delete(logId); AR.SetSuccess("已成功删除日志"); return(Json(AR)); } } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR)); } }
public async Task <ActionResult> Edit([Bind(Include = "Id,AlbumId,FullImageUrl,Importance,Active,Title")] PhotoIM photo) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR, JsonRequestBehavior.DenyGet)); } if (photo.Id > 0) { var model = await _db.Photos.FindAsync(photo.Id); model = _mapper.Map(photo, model); model.UpdatedBy = Site.CurrentUserName; model.UpdatedDate = DateTime.Now; model.Thumbnail = CreateThumbnail(model.FullImageUrl); _db.Entry(model).State = EntityState.Modified; AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Photo)); } else { var vm = _mapper.Map <PhotoIM, Photo>(photo); vm.CreatedBy = Site.CurrentUserName; vm.CreatedDate = DateTime.Now; vm.Thumbnail = CreateThumbnail(vm.FullImageUrl); _db.Photos.Add(vm); AR.SetSuccess(String.Format(Messages.AlertCreateSuccess, EntityNames.Photo)); } await _db.SaveChangesAsync(); return(Json(AR, JsonRequestBehavior.DenyGet)); }
public async Task <IActionResult> Edit([Bind("Id,Title,Description,WebLink,ImageUrl,ImageUrlMobile,Importance,Active,SpaceId")] AdvertisementIM advertisement) { if (!ModelState.IsValid) { AR.Setfailure(GetModelErrorMessage()); return(Json(AR)); } try { if (advertisement.Id > 0) { var model = await _context.Advertisements.FirstOrDefaultAsync(d => d.Id == advertisement.Id); if (model == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR)); } model = _mapper.Map(advertisement, model); model.UpdatedBy = User.Identity.Name; model.UpdatedDate = DateTime.Now; _context.Update(model); await _context.SaveChangesAsync(); AR.SetSuccess(string.Format(Messages.AlertUpdateSuccess, EntityNames.Carousel)); } else { var model = _mapper.Map <Advertisement>(advertisement); model.CreatedBy = User.Identity.Name; model.CreatedDate = DateTime.Now; _context.Add(model); await _context.SaveChangesAsync(); AR.SetSuccess(string.Format(Messages.AlertCreateSuccess, EntityNames.Carousel)); } _cacheService.Invalidate("ADVERTISEMENT"); return(Json(AR)); } catch (DbUpdateConcurrencyException) { if (!AdvertisementExists(advertisement.Id)) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR)); } else { throw; } } }
public async Task <JsonResult> IsActive(int id) { var model = await _db.Outlets.FindAsync(id); if (model == null) { AR.Setfailure(String.Format(Messages.AlertUpdateSuccess, EntityNames.Outlet)); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { model.Active = !model.Active; _db.Entry(model).State = EntityState.Modified; await _db.SaveChangesAsync(); // _teamServices.Update(model); AR.Data = RenderPartialViewToString("_OutletItem", model); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Outlet)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public JsonResult CacheSet(SiteCacheIM vm) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { var xmlFile = Server.MapPath("~/Config/GlobalSettings.config"); XDocument doc = XDocument.Load(xmlFile); var item = doc.Descendants("Settings").FirstOrDefault(); item.Element("EnableCaching").SetValue(vm.EnableCaching); item.Element("CacheDuration").SetValue(vm.CacheDuration); doc.Save(xmlFile); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public JsonResult IsActive(int id) { FilterTemplate filterTemplate = _filterTemplateService.GetById(id); if (filterTemplate == null) { AR.Setfailure(String.Format(Messages.AlertUpdateSuccess, EntityNames.FilterTemplate)); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { filterTemplate.Active = !filterTemplate.Active; _filterTemplateService.Update(filterTemplate); var vm = _mapper.Map <FilterTemplateVM>(filterTemplate); AR.Data = RenderPartialViewToString("_FilterTemplateItem", vm); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.FilterTemplate)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public async System.Threading.Tasks.Task <ActionResult> Edit(int?id) { if (id > 0) { var vCase = await _db.Cases.FindAsync(id); if (vCase == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.AllowGet)); } var editCase = _mapper.Map <Case, CaseIM>(vCase); var pageMeta = await _db.PageMetas.FirstOrDefaultAsync(d => d.ModelType == ModelType.CASE && d.ObjectId == editCase.Id.ToString()); if (pageMeta != null) { editCase.SEOTitle = pageMeta.Title; editCase.Keywords = pageMeta.Keyword; editCase.SEODescription = pageMeta.Description; } return(View(editCase)); } else { var vm = new CaseIM { Active = true, Pubdate = DateTime.Now }; return(View(vm)); } }
public JsonResult ProductSet(ProductSetIM im) { if (!ModelState.IsValid) { var errorMessage = GetModelErrorMessage(); AR.Setfailure(errorMessage); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { var xmlFile = Server.MapPath("~/Config/ProductSettings.config"); XDocument doc = XDocument.Load(xmlFile); var item = doc.Descendants("Settings").FirstOrDefault(); item.Element("FrontPageSize").SetValue(im.FrontPageSize); item.Element("EnableCaching").SetValue(im.EnableCaching); item.Element("CacheDuration").SetValue(im.CacheDuration); item.Element("ThumbHeight").SetValue(im.ThumbHeight); item.Element("ThumbWidth").SetValue(im.ThumbWidth); item.Element("ImageHeight").SetValue(im.ImageHeight); item.Element("ImageWidth").SetValue(im.ImageWidth); item.Element("CategoryImageWidth").SetValue(im.CategoryImageWidth); item.Element("CategoryImageHeight").SetValue(im.CategoryImageHeight); doc.Save(xmlFile); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public JsonResult IsActive(int id) { var vCategory = _db.AchievementCategories.Find(id); //_categoryServices.GetById(id); if (vCategory == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.DenyGet)); } try { vCategory.Active = !vCategory.Active; _db.Entry(vCategory).State = EntityState.Modified; _db.SaveChanges(); // _categoryServices.Update(vCategory); // var vm = _mapper.Map<AchievementCategoryVM>(vCategory); AR.Data = RenderPartialViewToString("_CategoryItem", vCategory); AR.SetSuccess(String.Format(Messages.AlertUpdateSuccess, EntityNames.Category)); return(Json(AR, JsonRequestBehavior.DenyGet)); } catch (Exception ex) { AR.Setfailure(ex.Message); return(Json(AR, JsonRequestBehavior.DenyGet)); } }
public CashFlowForecast2 Copy(DateTime startDate, AR.ARPayment src) { this.BAccountID = src.CustomerID; this.CashAccountID = src.CashAccountID; this.TranDate = src.AdjDate >= startDate? src.AdjDate: startDate; this.CuryID = src.CuryID; this.AcctCuryID = src.CuryID; this.RecordType = (int)CashFlowForecastRecordType.RecordType.CashIn; return this; }
/// <summary> /// Switchs the drone camera. /// </summary> /// <param name="Type">Video channel type.</param> private void switchDroneCamera(AR.Drone.Client.Configuration.VideoChannelType Type) { var configuration = new AR.Drone.Client.Configuration.Settings(); configuration.Video.Channel = Type; droneClient.Send(configuration); }
public CashFlowForecast2 Copy(DateTime startDate, AR.ARInvoice src) { this.BAccountID = src.CustomerID; this.CashAccountID = src.CashAccountID; this.TranDate = src.DueDate >= startDate ? src.DueDate : startDate; this.RecordType = (int)CashFlowForecastRecordType.RecordType.CashIn; return this; }
public virtual void Copy(AR.ARPayment payment) { this.OrigRefNbr = payment.RefNbr; this.OrigDocType = payment.DocType; this.OrigModule = GL.BatchModule.AR; }