public ActionResultVM SaveRun(Domain.Run mo) { var vm = new ActionResultVM(); var uinfo = new Func.UserAuthAid(HttpContext).Get(); using (var db = new ContextBase()) { //add if (string.IsNullOrWhiteSpace(mo.RunCode)) { mo.RunId = Guid.NewGuid().ToString(); mo.RunCreateTime = DateTime.Now; mo.RunStatus = 1; mo.RunOpen = 1; mo.Uid = uinfo.UserId; mo.RunCode = Core.UniqueTo.LongId().ToString(); db.Run.Add(mo); int num = db.SaveChanges(); vm.data = mo.RunCode; vm.Set(num > 0); } else { var oldmo = db.Run.Where(x => x.RunCode == mo.RunCode).FirstOrDefault(); if (oldmo != null) { if (oldmo.Uid == uinfo.UserId) { oldmo.RunContent1 = mo.RunContent1; oldmo.RunContent2 = mo.RunContent2; oldmo.RunContent3 = mo.RunContent3; oldmo.RunRemark = mo.RunRemark; oldmo.RunTheme = mo.RunTheme; db.Run.Update(oldmo); int num = db.SaveChanges(); vm.data = mo.RunCode; vm.Set(num > 0); } else { vm.Set(ARTag.refuse); } } else { vm.Set(ARTag.invalid); } } } return(vm); }
public SharedResultVM SaveRun(Domain.Run mo) { var vm = Apps.LoginService.CompleteInfoValid(HttpContext); if (vm.Code == 200) { var uinfo = Apps.LoginService.Get(HttpContext); //add if (string.IsNullOrWhiteSpace(mo.RunCode)) { mo.RunId = Guid.NewGuid().ToString(); mo.RunCreateTime = DateTime.Now; mo.RunStatus = 1; mo.RunOpen = 1; mo.Uid = uinfo.UserId; mo.RunCode = Core.UniqueTo.LongId().ToString(); db.Run.Add(mo); int num = db.SaveChanges(); vm.Data = mo.RunCode; vm.Set(num > 0); } else { var oldmo = db.Run.FirstOrDefault(x => x.RunCode == mo.RunCode); if (oldmo?.Uid == uinfo.UserId) { oldmo.RunContent1 = mo.RunContent1; oldmo.RunContent2 = mo.RunContent2; oldmo.RunContent3 = mo.RunContent3; oldmo.RunRemark = mo.RunRemark; oldmo.RunTheme = mo.RunTheme; db.Run.Update(oldmo); int num = db.SaveChanges(); vm.Data = mo.RunCode; vm.Set(num > 0); } else { vm.Set(SharedEnum.RTag.fail); } } } return(vm); }
public static Xaml.Run Control(this Domain.Run item, bool isThumbnail = false) { var control = new Xaml.Run { Text = item.Value }; if (isThumbnail) { control.FontSize = ThumbnailFontSize; } if (item.CharacterSpacing > 0) { control.CharacterSpacing = item.CharacterSpacing; } if (item.FontSize > 0 && !isThumbnail) { control.FontSize = item.FontSize; } if (!string.IsNullOrEmpty(item.FontStretch)) { control.FontStretch = Helpers.ParseEnum <FontStretch>(item.FontStretch); } if (!string.IsNullOrEmpty(item.FontStyle)) { control.FontStyle = Helpers.ParseEnum <FontStyle>(item.FontStyle); } if (!string.IsNullOrEmpty(item.FontWeight)) { control.FontWeight = Helpers.ParseEnum <FontWeight>(item.FontWeight); } if (!string.IsNullOrEmpty(item.Foreground)) { control.Foreground = new SolidColorBrush(item.Foreground.GetColor()); } return(control); }
public IActionResult SaveRun(Domain.Run mo) { string result = "fail"; var uinfo = new Func.UserAuthAid(HttpContext).Get(); using (var db = new ContextBase()) { //add if (string.IsNullOrWhiteSpace(mo.RunCode)) { mo.RunId = Guid.NewGuid().ToString(); mo.RunCreateTime = DateTime.Now; mo.RunStatus = 1; mo.RunOpen = 1; mo.Uid = uinfo.UserId; mo.RunCode = Core.UniqueTo.LongId().ToString(); db.Run.Add(mo); db.SaveChanges(); result = new { code = mo.RunCode, message = "success" }.ToJson(); } else { var oldmo = db.Run.Where(x => x.RunCode == mo.RunCode).FirstOrDefault(); if (oldmo != null) { if (oldmo.Uid == uinfo.UserId) { oldmo.RunContent1 = mo.RunContent1; oldmo.RunContent2 = mo.RunContent2; oldmo.RunContent3 = mo.RunContent3; oldmo.RunRemark = mo.RunRemark; oldmo.RunTheme = mo.RunTheme; db.Run.Update(oldmo); db.SaveChanges(); result = new { code = mo.RunCode, message = "success" }.ToJson(); } else { result = new { message = "refuse" }.ToJson(); } } else { result = new { message = "undefined" }.ToJson(); } } } return(Content(result)); }