public async Task <IActionResult> OnPostSave(string id) { try { InitializeAll(id); HttpContext.Session.SetString("recipeId", Recipe.Id.ToString()); HttpContext.Session.SetString("userId", Recipe.UserId.ToString()); string title = Request.Form["name"]; string ingredients = Request.Form["ing"]; string preparation = Request.Form["prep"]; string link = Request.Form["link"]; Recipe.ChangeTitle(title); Recipe.ChangeIngredients(ingredients); Recipe.ChangePreparationInstructions(preparation); Recipe.ChangeLink(link); Inf.EditRecipe(Recipe); if (Request.Form.TryGetValue("comments", out var commentsText)) { Inf.EditComments(Comments, commentsText); } return(RedirectToPage("RecipePage")); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה בעריכת המתכון"); return(RedirectToPage("ErrorPage")); } }
/// <summary> /// Add Log Information /// </summary> private void Ai(Cx CurrCodeType, string Comments = null, Mx CustomMethodContext = null) { if (C == null || C.L != true) { return; } Ce(CurrCodeType, CustomMethodContext); var r = new Inf() { C = Comments }; if (CurrCodeType != null) { r.X = CurrCodeType.CxId; } if (CustomMethodContext != null) { r.M = CustomMethodContext.CmId; } L.I.Add(r); Rn++; if (Rl > 1 && Rn > Rl) { Sv(); } }
private void InitializeAll(string recipeId) { Recipe = Inf.GetRecipe(recipeId); Comments = Inf.GetComments(recipeId); Ingredients = Recipe.Ingredients.Split(new[] { '\n' }); Preparation = Recipe.Preparation.Split(new[] { '\n' }); }
public Answer(string RawString) { if (RawString == "<DISCONNECTED>") { data = new string[] { RawString }; this.information = Inf.Error; return; } string[] strings = RawString.Split(new string[] { "\r\n" }, StringSplitOptions.None); if (strings.Length < 2) { this.information = Inf.WrongAnswer; this.data = strings; return; } string ans = strings[0]; switch (ans) { case "<OK>": this.information = Inf.OK; break; case "<ERROR>": this.information = Inf.Error; break; case "<PERMISSION DENIED>": this.information = Inf.PermissionDenied; break; case "<INFO>": this.information = Inf.Info; break; } this.data = strings.Skip(1).ToArray(); }
public static unsafe void Entry() { char *[] cc = null; int *[] ii = null; short *[] ss = null; var cls = new Sub2(); cls.Foo(cc, ii); cls.Foo(cc, ss); Inf <int *[]> inf = cls; inf.Foo(cc, ii); Inf2 <short *[]> inf2 = cls; inf2.Foo(cc, ss); var cls2 = new Cls <long *[]>(); Sub1 <int *[]> s1 = cls; s1.Foo(cc, ii); s1.Foo(cc, ss); new Cls <int *[]>(); }
public async Task <IActionResult> OnPostSave(string id) { try { User = new User(id); string title = Request.Form["name"]; string ingredients = Request.Form["ing"]; string preparation = Request.Form["prep"]; string link = Request.Form["link"]; string tags = Request.Form["tags"]; int rating = Int32.Parse(Request.Form["rating"]); string commentText = Request.Form["comments"]; List <string> tagsList = null; if (!tags.Equals("")) { tagsList = tags.Split(", ").ToList(); } Recipe = new Recipe(title, ingredients, preparation, rating, tagsList, link, User.Id); Inf.AddRecipe(Recipe, User); if (!String.IsNullOrEmpty(commentText)) { Comment = new Comment(commentText, Recipe.Id); Inf.AddComment(Comment); } HttpContext.Session.SetString("recipeId", Recipe.Id.ToString()); HttpContext.Session.SetString("userId", id); return(RedirectToPage("RecipePage")); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה בהוספת המתכון"); return(RedirectToPage("ErrorPage")); } }
internal SignalWonderware(string signalInf, string code, DataType dataType, IProvider provider, int idInClone) : base(signalInf, code, dataType, provider, idInClone) { TagName = Inf["TagName"]; Bit = Inf.GetInt("Bit", -1); Value = new SingleValue(SingleType.List); }
public static void Entry() { var c = new Cls <int, int>(); Inf <int, int> i = c; i.Foo(c); }
public static void Entry() { var cls = new Sub(); Inf inf = cls; inf.foo(); }
public static void Entry() { var cls = new Derived <long>(); Inf <int, long> inf = cls; inf.Foo(123); inf.Foo(123, 456L); }
internal SignalOvation(string signalInf, string code, DataType dataType, IProvider provider, int idInClone) : base(signalInf, code, dataType, provider, idInClone) { Id = Inf.GetInt("Id"); Bit = Inf.GetInt("Bit", -1); IsState = Inf["Prop"] == "STAT"; Value = new SingleValue(SingleType.List); }
public ProviderSignal(string signalInf, string code, DataType dataType, IProvider provider, int idInClone = 0) { Code = code; DataType = dataType; Inf = signalInf.ToPropertyDicS(); _averageTime = Inf.Get("AverageTime", "0").ToDouble(); Provider = provider; IdInClone = idInClone; }
public static void Entry() { Inf <long> i = new Cls(); i.Foo(1.2f, (long)999999); Inf <char> i2 = null; i2.Foo(1234, 'a'); }
public static int Entry() { char *[] cc = new char *[1]; int *[] ii = new int *[1]; short *[] ss = new short *[1]; var cls = new Sub2(); cls.Foo(cc, ii); if (path != 1) { return(1); } cls.Foo(cc, ss); if (path != 2) { return(2); } Inf <int *[]> inf = cls; inf.Foo(cc, ii); if (path != 1) { return(3); } Inf2 <short *[]> inf2 = cls; inf2.Foo(cc, ss); if (path != 2) { return(4); } var cls2 = new Cls <long *[]>(); Sub1 <int *[]> s1 = cls; s1.Foo(cc, ii); if (path != 1) { return(5); } s1.Foo(cc, ss); if (path != 2) { return(6); } new Cls <int *[]>(); return(0); }
private void WriteDbSets() { foreach (var table in Db.Schemas.SelectMany <Schema, Table>(s => s.Tables).OrderBy <Table, string>(t => t.Name)) { var className = table.Metadata["Class"]; var plural = Inf.Pluralise(className); table.Metadata["DbSet"] = plural; W($"public virtual DbSet<{className}> {plural} {{ get; set; }}"); } }
private static T EntryT <T>(T bla) { var cls = new Derived <T, ushort>(); Inf <int, T> inf = cls; T t = bla; inf.Foo(123); inf.Foo(123, t, ""); return(bla); }
private string GetFkName(IReadOnlyList <Column> fromColumns) { var sb = new StringBuilder(); foreach (var fromCol in fromColumns) { sb.Append(Inf.Pascalise(Inf.Singularise(RemoveSuffix(fromCol.Name)))); } return(sb.ToString()); }
public async Task <IActionResult> OnPostDeleteRecipe(string id) { try { InitializeAll(id); HttpContext.Session.SetString("userId", Recipe.UserId.ToString()); Inf.DeleteRecipe(Recipe); return(RedirectToPage("RecentRecipes")); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה במחיקת המתכון"); return(RedirectToPage("ErrorPage")); } }
public async Task <IActionResult> OnPostAddTag(string newTag, string id) { try { InitializeAll(id); Inf.AddTag(Recipe, newTag); Recipe.AddTag(newTag); return(Page()); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה בהוספת הטאג"); return(RedirectToPage("ErrorPage")); } }
public async Task <IActionResult> OnPostChangeRating(int rating, string id) { try { InitializeAll(id); Inf.EditRating(Recipe, rating); Recipe.ChangeRating(rating); return(Page()); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה בעריכת הדירוג"); return(RedirectToPage("ErrorPage")); } }
public static void Entry() { var cls = new Sub3(); Inf inf = cls; int a = inf.getWidth(); a = inf.getHeight(); Sub1 t2d = cls; a = t2d.getWidth(); a = t2d.getHeight(); }
public async Task <IActionResult> OnPostAddComment(string newComment, string id) { try { InitializeAll(id); Comment newCom = new Comment(newComment, new ObjectId(id)); Inf.AddComment(newCom); Comments.Add(newCom); return(Page()); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה בהוספת התגובה"); return(RedirectToPage("ErrorPage")); } }
public async Task OnGet(string id) { if (id == null) { id = HttpContext.Session.GetString("userId"); } else { HttpContext.Session.SetString("userId", id); } User = new User(id); Recipes = Inf.GetRecentUserRecipes(User, numOfRecent); }
// Override fill() method to provide an extra "dummy" byte // at the end of the input stream. This is required when // using the "nowrap" Inflater option. //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void fill() throws java.io.IOException protected internal override void Fill() { if (Eof) { throw new EOFException("Unexpected end of ZLIB input stream"); } Len = @in.Read(Buf, 0, Buf.Length); if (Len == -1) { Buf[0] = 0; Len = 1; Eof = true; } Inf.SetInput(Buf, 0, Len); }
public async Task OnGet(string str) { try { if (str == null) { str = HttpContext.Session.GetString("searchStr"); } searchStr = str; string userId = HttpContext.Session.GetString("userId"); User = new User(userId); Recipes = Inf.GetRecipeByPartialTitle(searchStr, User); } catch (Exception) { RedirectToPage("ErrorPage"); } }
public async Task <IActionResult> OnPostDeleteTag(string id) { try { InitializeAll(id); bool res = Request.Form.TryGetValue("tag", out var tagsToDelete); if (res) { Inf.DeleteTag(Recipe, tagsToDelete); } return(Page()); } catch (Exception) { HttpContext.Session.SetString("errorMsg", "שגיאה במחיקת הטאג"); return(RedirectToPage("ErrorPage")); } }
private void WriteEntityFiles() { using (BeginFile($"{options.ContextName ?? Inf.Pascalise(Db.Name)}Entities.cs", options.OneFilePerEntity == false)) using (WriteHeader(options.OneFilePerEntity == false)) foreach (var table in Db.Schemas.SelectMany(s => s.Tables).OrderBy(t => t.Name)) { var className = Inf.Pascalise(Inf.Singularise(table.Name)); table.Metadata["Class"] = className; using (BeginFile($"{className}.cs", options.OneFilePerEntity)) using (WriteHeader(options.OneFilePerEntity)) { WriteEntity(table); } } }
//删除订单 public void deleteOrder(Order delOrder) { foreach (Order order in Inf) { if (order.order == delOrder.order && order.goods == delOrder.goods && order.cl == delOrder.cl) { Inf.Remove(order); Console.WriteLine("已删除订单" + delOrder.order + delOrder.goods + delOrder.cl); break; } else { Console.WriteLine("订单删除失败"); } } }
public async Task OnGet(string id) { try { if (id == null) { id = HttpContext.Session.GetString("userId"); } else { HttpContext.Session.SetString("userId", id); } User = new User(id); TagsList = Inf.GetAllUserTags(User); } catch (Exception) { RedirectToPage("ErrorPage"); } }
public async Task OnGet(string id) { try { if (id == null) { TagName = HttpContext.Session.GetString("tagName"); } else { TagName = id; HttpContext.Session.SetString("tagName", id); } User = new User(HttpContext.Session.GetString("userId")); Recipes = Inf.GetTagsRecipes(TagName, User); } catch (Exception) { RedirectToPage("ErrorPage"); } }