private void Update(GratsDBContext db) { var oldCategoryContacts = (from categoryContact in db.CategoryContacts.Include(cc => cc.Contact) where categoryContact.CategoryID == Category.ID select categoryContact).ToList(); var removed = oldCategoryContacts .Where(oldCC => !Category.CategoryContacts.Any(newCC => newCC.Contact.VKID == oldCC.Contact.VKID)); db.CategoryContacts.RemoveRange(removed); var result = Category; if (IsBirthday && Category is GeneralCategory) { result = new BirthdayCategory(Category); db.GeneralCategories.Remove(Category as GeneralCategory); db.BirthdayCategories.Add(result as BirthdayCategory); } else if (IsGeneral && Category is BirthdayCategory) { result = new GeneralCategory(Category, Date.Value.DateTime); db.BirthdayCategories.Remove(Category as BirthdayCategory); db.GeneralCategories.Add(result as GeneralCategory); } else if (IsGeneral) { (Category as GeneralCategory).Date = Date.Value.DateTime; } db.SaveChanges(); (result as ITaskGenerator).Regenerate(db); }
public ActionResult Edit(GeneralCategory generalCategory) { if (ModelState.IsValid) { //ModelState.Clear(); try { if (_generalCategoryManager.Update(generalCategory)) { ViewBag.Msg = "Updated successfully!"; return(View()); } } catch (Exception exception) { int NameExist = _generalCategoryManager.GetAll(c => c.Name == generalCategory.Name).Count(); if (NameExist > 0) { ModelState.AddModelError("Name", "Name already exists in the system"); } int ShortNameExist = _generalCategoryManager.GetAll(c => c.ShortName == generalCategory.ShortName).Count(); if (ShortNameExist > 0) { ModelState.AddModelError("ShortName", "Short name already exists in the system"); } } } return(View(generalCategory)); }
// Edit GeneralCategory public ActionResult Edit(int?id) { if (Session["username"] == null) { return(RedirectToAction("HomePage", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GeneralCategory generalCategory = generalCategoryManager.GetById(id); if (generalCategory == null) { return(HttpNotFound()); } bool s = Request.QueryString["Update"] == "true"; if (s) { ViewData["Update"] = "Update Successfully"; } return(View(generalCategory)); }
public bool Update(GeneralCategory generalCategory) { int rowAffected = generalCategoryRepository.Edit(generalCategory); bool isSaved = rowAffected > 0; return(isSaved); }
internal bool Add(GeneralCategory generalCategory) { _context.GeneralCategories.Add(generalCategory); var rowAffected = _context.SaveChanges(); return(rowAffected > 0); }
public int Save(GeneralCategory obj) { db.GeneralCategories.Add(obj); int rowAffected = db.SaveChanges(); return(rowAffected); }
public int Update(GeneralCategory obj) { db.GeneralCategories.Attach(obj); db.Entry(obj).State = EntityState.Modified; return(db.SaveChanges()); }
public List <GeneralCategory> GetBySearchItem(GeneralCategory obj) { var dbobj = db.GeneralCategories.AsQueryable(); if (!string.IsNullOrEmpty(obj.Name)) { dbobj = dbobj.Where( c => c.IsDeleted == false && (c.Name.ToLower().Contains(obj.Name.ToLower()))); } else { dbobj = dbobj.Where(c => c.IsDeleted == false); return(dbobj.OrderBy(o => o.Name).ToList()); } return(dbobj.OrderBy(o => o.Name).ToList()); }
public bool Update(GeneralCategory obj) { int rowAffected = _Repository.Update(obj); bool isUpdated = rowAffected > 0; return(isUpdated); }
public ActionResult DeleteConfirmed(int id) { GeneralCategory generalcategory = db.GeneralCategories.Find(id); db.GeneralCategories.Remove(generalcategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public int Edit(GeneralCategory generalCategory) { db.GeneralCategories.Attach(generalCategory); db.Entry(generalCategory).State = EntityState.Modified; int rowAffected = db.SaveChanges(); return(rowAffected); }
public bool Update(GeneralCategory generalCategory) { bool isUpdated = repository.Update(generalCategory); return(isUpdated); ; }
public bool Save(GeneralCategory obj) { // save code ... int rowAffected = _Repository.Save(obj); bool isSaved = rowAffected > 0; return(isSaved); }
public bool Add(GeneralCategory generalCategory) { if (generalCategory == null) { return(false); } return(_repository.Add(generalCategory)); }
public bool Add(GeneralCategory generalCategory) { AssetDBContext db = new AssetDBContext(); db.GeneralCategories.Add(generalCategory); int rowAffected = db.SaveChanges(); return(rowAffected > 0); }
public ActionResult Edit([Bind(Include = "Id,Name,Code")] GeneralCategory generalcategory) { if (ModelState.IsValid) { db.Entry(generalcategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(generalcategory)); }
public int Delete(GeneralCategory generalCategory) { var singleGeneralCategory = db.GeneralCategories.FirstOrDefault(x => x.id == generalCategory.id); db.GeneralCategories.Remove(singleGeneralCategory); db.Entry(singleGeneralCategory).State = EntityState.Deleted; int rowAffected = db.SaveChanges(); return(rowAffected); }
public bool Update(GeneralCategory generalCategory) { AssetDBContext db = new AssetDBContext(); db.GeneralCategories.Attach(generalCategory); db.Entry(generalCategory).State = EntityState.Modified; int rowAffected = db.SaveChanges(); return(rowAffected > 0); }
public JsonResult GetgeneralCategoryById(int?id) { GeneralCategory generalCategory = null; if (id != null) { generalCategory = _generalCategoryManager.GetById((int)id); } return(Json(generalCategory, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(GeneralCategory generalCategory) { bool isSaved = generalCategoryManager.Delete(generalCategory); if (isSaved) { ViewBag.Message = "Deleted Successfully!"; } return(RedirectToAction("Create")); }
public ActionResult Create([Bind(Include = "Id,Name,Code")] GeneralCategory generalcategory) { if (ModelState.IsValid) { db.GeneralCategories.Add(generalcategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(generalcategory)); }
public void CanDeleteCascade() { var db = (App.Current as App).dbContext; try { var category = new GeneralCategory() { Name = "Simple", Date = new DateTime(2016, 05, 14) }; category.CategoryContacts = new List <CategoryContact> { new CategoryContact() { Category = category, Contact = new Contact() { ScreenName = "Foobaar" } } }; category.Tasks = new List <MessageTask> { new MessageTask() { DispatchDate = DateTime.Now, Contact = category.CategoryContacts.First().Contact } }; db.Categories.Add(category); db.SaveChanges(); Assert.NotEmpty(db.Contacts); Assert.NotEmpty(db.CategoryContacts); Assert.NotEmpty(db.MessageTasks); db.Categories.Remove(db.Categories.First()); db.SaveChanges(); Assert.NotEmpty(db.Contacts); Assert.Empty(db.CategoryContacts); Assert.Empty(db.MessageTasks); } finally { db.Database.ExecuteSqlCommand("delete from [categories]"); db.Database.ExecuteSqlCommand("delete from [contacts]"); db.Database.ExecuteSqlCommand("delete from [categorycontacts]"); } }
public ActionResult Edit([Bind(Include = "GeneralCategoryID,GeneralCategoryName,GeneralCategoryCode")] GeneralCategory generalcategory) { if (ModelState.IsValid) { //db.Entry(generalcategory).State = EntityState.Modified; //db.SaveChanges(); _generalCategoryManager.Update(generalcategory); return(RedirectToAction("Index")); } return(View(generalcategory)); }
public bool Add(GeneralCategory generalCategory) { if (generalCategory.Name == null) { return(false); } if (generalCategory.Code.Length != 2) { return(false); } return(repository.Add(generalCategory)); }
public int Delete(int?id) { int?ID = id; GeneralCategory obj = db.GeneralCategories.Where(c => c.Id == ID).First(); obj.IsDeleted = true; int rowAffected = db.SaveChanges(); return(rowAffected); }
public ActionResult Create([Bind(Include = "GeneralCategoryID,GeneralCategoryName,GeneralCategoryCode")] GeneralCategory generalcategory) { if (ModelState.IsValid) { //db.GeneralCategories.Add(generalcategory); //db.SaveChanges(); _generalCategoryManager.Add(generalcategory); return(RedirectToAction("Index")); } return(View(generalcategory)); }
public ActionResult Edit([Bind(Include = "Id,Name,ShortName,Description")] GeneralCategory generalCategory) { if (ModelState.IsValid) { if (_generalCategoryManager.IsShortNameUnique(generalCategory.ShortName)) { _generalCategoryManager.Update(generalCategory); return(RedirectToAction("Index")); } ModelState.AddModelError("ShortName", "ShortName Is Not Unique!"); } return(View(generalCategory)); }
// GET: GeneralCategory/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GeneralCategory generalCategory = _generalCategoryManager.GetById((long)id); if (generalCategory == null) { return(HttpNotFound()); } return(View(generalCategory)); }
private CodePoint(uint value, string name, GeneralCategory generalCategory, byte canonicalCombiningClass, BidiClass bidiClass, bool bidiMirrored, string unicode1Name, string isoComment, uint?simpleUppercaseMappingValue, uint?simpleLowercaseMappingValue, uint?simpleTitlecasemappingValue) { this._value = value; this._name = name; this._generalCategory = generalCategory; this._canonicalCombiningClass = canonicalCombiningClass; this._bidiClass = bidiClass; this._bidiMirrored = bidiMirrored; this._unicode1Name = unicode1Name; this._isoComment = isoComment; this._simpleUppercaseMappingValue = simpleUppercaseMappingValue; this._simpleLowercaseMappingValue = simpleLowercaseMappingValue; this._simpleTitlecaseMappingValue = simpleTitlecasemappingValue; }
public void CanCreateGeneralCategoryFromBirthday() { var db = (App.Current as App).dbContext; try { var category = new BirthdayCategory() { Name = "Simple" }; category.CategoryContacts = new List <CategoryContact> { new CategoryContact() { Category = category, Contact = new Contact() { ScreenName = "Foobaar" } } }; db.Categories.Add(category); db.SaveChanges(); category = db.BirthdayCategories .Include(c => c.CategoryContacts) .ThenInclude(cc => cc.Category) .First(); var generalCategory = new GeneralCategory(category, DateTime.Now); db.BirthdayCategories.Remove(category); db.GeneralCategories.Add(generalCategory); db.SaveChanges(); generalCategory = db.GeneralCategories .Include(c => c.CategoryContacts) .ThenInclude(cc => cc.Category) .First(); Assert.NotEmpty(generalCategory.CategoryContacts); Assert.Equal(db.CategoryContacts.Count(), 1); Assert.Equal(db.Contacts.Count(), 1); } finally { db.Database.ExecuteSqlCommand("delete from [categories]"); db.Database.ExecuteSqlCommand("delete from [contacts]"); db.Database.ExecuteSqlCommand("delete from [categorycontacts]"); } }
internal void AppendGeneralCategory(GeneralCategory category, bool negative) { AppendBackslash(negative ? 'P' : 'p'); AppendDirect('{'); AppendDirect(RegexUtility.CategoryDesignations[(int)category]); AppendDirect('}'); if (_comment && _charGroupLevel == 0) { _lines.Add(negative ? SyntaxKind.NotGeneralCategory : SyntaxKind.GeneralCategory); } }
internal static CharGrouping Character(GeneralCategory category, bool negative) { return new CharGrouping.GeneralCategoryCharGrouping(category, negative); }
/// <summary> /// Returns a pattern that matches a character from the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public static CharGrouping Character(GeneralCategory category) { return Character(category, false); }
/// <summary> /// Returns a pattern that matches a character that is not from the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public static CharGrouping Not(GeneralCategory category) { return Character(category, true); }
/// <summary> /// Returns a pattern that matches a character from the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public static CharGrouping GeneralCategory(GeneralCategory category) { return Character(category); }
/// <summary> /// Gets a designation of the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public static string GetCategoryDesignation(GeneralCategory category) => CategoryDesignations[(int)category];
internal void AppendGeneralCategory(GeneralCategory category, bool negative) { AppendBackslash(negative ? 'P' : 'p'); AppendDirect('{'); AppendDirect(RegexUtility.CategoryDesignations[(int)category]); AppendDirect('}'); if (_fBuilder && _charGroupLevel == 0) _builder.AddInfo(category, negative); }
public GeneralCategoryCharGrouping(GeneralCategory category, bool negative) { _category = category; _negative = negative; }
/// <summary> /// Appends a pattern that matches a character that is not from a specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> public void AppendNegativeCharGroup(GeneralCategory category) { AppendCharGroup(category, true); }
/// <summary> /// Appends a pattern that matches a character from the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public CharGrouping Character(GeneralCategory category) { return Append(Chars.Character(category)); }
internal void AppendCharGroup(GeneralCategory category, bool negative) { AppendCharGroupStart(); AppendGeneralCategory(category, negative); AppendCharGroupEnd(); }
/// <summary> /// Appends a pattern that matches a character from a specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> public void AppendGeneralCategory(GeneralCategory category) { AppendGeneralCategory(category, false); }
/// <summary> /// Appends a pattern that matches a character from a specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> public void AppendCharGroup(GeneralCategory category) { AppendCharGroup(category, false); }
public void AddInfo(GeneralCategory category, bool negative) { Lines.Add(new GeneralCategoryLineInfo(negative ? SyntaxKind.NotGeneralCategory : SyntaxKind.GeneralCategory, category, CurrentOptions)); }
/// <summary> /// Appends a pattern that matches a character that is not from the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public CharGrouping Not(GeneralCategory category) => Append(Chars.Not(category));
internal GeneralCategoryCharPattern(GeneralCategory category, bool negative) { _category = category; _negative = negative; }
/// <summary> /// Appends a pattern that matches a character from the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public CharGrouping Append(GeneralCategory category) => Append(Chars.Character(category));
/// <summary> /// Gets a description of the specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> /// <returns></returns> public static string GetCategoryDescription(GeneralCategory category) { switch (category) { case GeneralCategory.AllControlCharacters: return "All control characters. This includes the Cc, Cf, Cs, Co, and Cn categories."; case GeneralCategory.AllDiacriticMarks: return "All diacritic marks. This includes the Mn, Mc, and Me categories."; case GeneralCategory.AllLetterCharacters: return "All letter characters. This includes the Lu, Ll, Lt, Lm, and Lo characters."; case GeneralCategory.AllNumbers: return "All numbers. This includes the Nd, Nl, and No categories."; case GeneralCategory.AllPunctuationCharacters: return "All punctuation characters. This includes the Pc, Pd, Ps, Pe, Pi, Pf, and Po categories."; case GeneralCategory.AllSeparatorCharacters: return "All separator characters. This includes the Zs, Zl, and Zp categories."; case GeneralCategory.AllSymbols: return "All symbols. This includes the Sm, Sc, Sk, and So categories."; case GeneralCategory.LetterLowercase: return "Letter, Lowercase"; case GeneralCategory.LetterModifier: return "Letter, Modifier"; case GeneralCategory.LetterOther: return "Letter, Other"; case GeneralCategory.LetterTitlecase: return "Letter, Titlecase"; case GeneralCategory.LetterUppercase: return "Letter, Uppercase"; case GeneralCategory.MarkEnclosing: return "Mark, Enclosing"; case GeneralCategory.MarkNonspacing: return "Mark, Nonspacing"; case GeneralCategory.MarkSpacingCombining: return "Mark, Spacing Combining"; case GeneralCategory.NumberDecimalDigit: return "Number, Decimal Digit"; case GeneralCategory.NumberLetter: return "Number, Letter"; case GeneralCategory.NumberOther: return "Number, Other"; case GeneralCategory.OtherControl: return "Other, Control"; case GeneralCategory.OtherFormat: return "Other, Format"; case GeneralCategory.OtherNotAssigned: return "Other, Not Assigned (no characters have this property)"; case GeneralCategory.OtherPrivateUse: return "Other, Private Use"; case GeneralCategory.OtherSurrogate: return "Other, Surrogate"; case GeneralCategory.PunctuationClose: return "Punctuation, Close"; case GeneralCategory.PunctuationConnector: return "Punctuation, Connector"; case GeneralCategory.PunctuationDash: return "Punctuation, Dash"; case GeneralCategory.PunctuationFinalQuote: return "Punctuation, Final quote (may behave like Ps or Pe depending on usage)"; case GeneralCategory.PunctuationInitialQuote: return "Punctuation, Initial quote (may behave like Ps or Pe depending on usage)"; case GeneralCategory.PunctuationOpen: return "Punctuation, Open"; case GeneralCategory.PunctuationOther: return "Punctuation, Other"; case GeneralCategory.SeparatorLine: return "Separator, Line"; case GeneralCategory.SeparatorParagraph: return "Separator, Paragraph"; case GeneralCategory.SeparatorSpace: return "Separator, Space"; case GeneralCategory.SymbolCurrency: return "Symbol, Currency"; case GeneralCategory.SymbolMath: return "Symbol, Math"; case GeneralCategory.SymbolModifier: return "Symbol, Modifier"; case GeneralCategory.SymbolOther: return "Symbol, Other"; default: Debug.Assert(false, category.ToString()); return ""; } }
/// <summary> /// Appends a pattern that matches a character that is not from a specified Unicode category. /// </summary> /// <param name="category">An enumerated constant that identifies Unicode category.</param> public void AppendNotGeneralCategory(GeneralCategory category) { AppendGeneralCategory(category, true); }
public GeneralCategoryLineInfo(SyntaxKind kind, GeneralCategory category, RegexOptions options) : base(kind, options) { Category = category; }