public IHttpActionResult Put(int id, Gifts gift) { try { if (id != gift.Id) { return(BadRequest()); } service.Update(gift); } catch (DbUpdateConcurrencyException) { if (service.GetBuyId(id) == null) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public GiftsDto(Gifts entity) { this.Cost = entity.Cost; this.Id = entity.Id; this.Name = entity.Name; this.OrdersId = (entity.Orders == null) ? null : entity.Orders.Select(x => x.Id).ToList(); }
//Function 2)AddItem public void addItem(Item item) { Gifts.Add(new WishlistItem(item.ItemId, this.WishlistId, item, this)); //item.List = this.WishlistId; Items.Add(item); //Gifts.Add(item); }
// beginning of program private void Generator() { printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage); btnMutate.Enabled = true; ClearForm(); // refreshes lists Animal.NewAnimals(); Powers.NewPowers(); Paths.NewPaths(); Gifts.NewGifts(); Background.NewBackgrounds(); Skills.NewSkills(); Story.NewStories(); // creates new blank character _character = Character.CreateDefaultCharacter(); // roll stats, background, skills and story _character.IsPhysical = Dice.FlipCoin(); _character.Stats = Dice.RollStats(_character.IsPhysical, _character.Stats); _character.Sanity = _character.Stats["Intelligence"] + _character.Stats["Willpower"]; _character.Background = Background.ChooseBackground(_character.IsPhysical, _character.Background); _character.Skills = Skills.AssignSkills(_character.Background.Skills, _character.Skills, _character.Background.SkillsLimit); _character.Story = Story.ChooseStory(_character.Background.ID); DisplayHuman(); }
public TalentTrackLevel(string Type, int Level, string DataActions, string DataGifts) { this.Type = Type; this.Level = Level; foreach (var Str in DataActions.Split('|')) { if (Actions == null) { Actions = new List <string>(); } Actions.Add(Str); } foreach (var Str in DataGifts.Split('|')) { if (Gifts == null) { Gifts = new List <string>(); } Gifts.Add(Str); } _subLevels = new Dictionary <int, TalentTrackSubLevel>(); Init(); }
void GenerateGift() { //TODO CAMBIAR //numeroAleatorio = Random.Range(0, 4); //numeroAleatorio = Random.Range(3, 4); //numeroAleatorio = Random.Range(1, 2); if (numeroAleatorio == 0) { gm.UpdateDebug("Mario gain coin"); SoundSystem.ss.PlayCoin(); gm.UpdatePoints(200); gm.UpdateCoins(); } else if (numeroAleatorio == 3 && statusMario == 0) { gm.UpdateDebug("Mario is small generating Mushroom"); numeroAleatorio = 1; } if (numeroAleatorio != 0) { SoundSystem.ss.PlayMushroom(); } if (haveGift) { Gift = (GameObject)Instantiate(GiftInstance, new Vector3(transform.position.x, transform.position.y + 0.5f, 0), Quaternion.identity); hit = true; animator.SetBool("hit", hit); giftCode = Gift.GetComponent <Gifts> (); giftCode.gift = numeroAleatorio; } }
public void TestRandom() { var test = new Gifts(); Random Random = new Random(); test.randGen = Random.Next(1, 7); Assert.IsTrue(test.randGen >= 1 & test.randGen < 7); }
public void GiftWin() { var test = new Gifts(); test.count = 2; int expectedCount = 2; Assert.AreEqual(expectedCount, test.count); }
void GenerateCoin() { SoundSystem.ss.PlayCoin(); gm.UpdatePoints(200); gm.UpdateCoins(); gm.UpdateDebug("Mario gain coin"); Gift = (GameObject)Instantiate(GiftInstance, new Vector3(transform.position.x, transform.position.y + 0.5f, 0), Quaternion.identity); giftCode = Gift.GetComponent <Gifts>(); giftCode.gift = 0; }
public IHttpActionResult Post(Gifts gift) { try { service.Save(gift); return(CreatedAtRoute("DefaultApi", new { id = gift.Id }, new GiftsDto(gift))); } catch (Exception ex) { throw ex; } }
public bool UpdateGift(String TZ, Gifts gift) { try { Functions.ExNONQuery(string.Format(UPDATEGIFT, TZ, gift.Gift), CONNTION_STRING_NAME); return(true); } catch { return(false); } }
/// <summary> /// Valida el monto maximo de regalos /// </summary> /// <returns></returns> /// <history> /// [vipacheco] 26/Mayo/2016 Created /// </history> private bool ValidateMaxAuthGifts() { // si se debe validar el monto maximo de regalos if (_ValidateMaxAuthGifts) { // Validamos el monto maximo de regalos if (!Gifts.ValidateMaxAuthGifts(txtTotalCost.Text, txtMaxAuthGifts.Text)) { return(false); } } return(true); }
public IHttpActionResult Get(int id) { try { Gifts gift = service.GetBuyId(id); if (gift == null) { return(NotFound()); } return(Ok(new GiftsDto(gift))); } catch (Exception ex) { throw ex; } }
/// <summary> /// Configura los elementos de la forma /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void frmGuest_Loaded(object sender, RoutedEventArgs e) { //Iniciamos el BusyIndicator _busyIndicator.IsBusy = true; _busyIndicator.BusyContent = "Please wait, we are preparing the Guest form..."; _catObj = new GuestInvitationRules(_module, _user, _guestId); await _catObj.LoadAll(); ConfigurationControls(); LoadControls(); UIHelper.SetUpControls(new Guest(), this); DataContext = _catObj; Gifts.CalculateTotalGifts(dtgGifts, EnumGiftsType.InvitsGifts, "igQty", "iggi", "igPriceM", "igPriceMinor", "igPriceAdult", "igPriceA", "igPriceExtraAdult", txtGiftTotalCost, txtGiftTotalPrice); UpdateLayout(); //Detenemos el BusyIndicator _busyIndicator.IsBusy = false; }
private void Mutate() { btnMutate.Enabled = false; _character.Mutated = true; // roll path, animal, powers and gifts _character.Paths = Paths.ChoosePath(_character.Story.ID); _character.Stats[_character.Paths.Modifier]++; _character.Sanity = _character.Stats["Intelligence"] + _character.Stats["Willpower"] - 1; _character.Luck++; _character.Animal = Animal.ChooseAnimal(_character.Paths.ID); _character.Powers = Powers.AssignPowers(_character.Animal.Powers, _character.Powers); _character.Gifts = Gifts.AssignGifts(_character.Paths.Name); if (_character.Powers.Exists(a => a.ID == 28 || a.ID == 38 || a.ID == 47 || a.ID == 48)) { _character.Injuries++; } DisplayMutant(); }
public void ParseGifts() { if (Strgifts == "") { return; } foreach (var datas in Strgifts.Split('+')) { var giftDatas = datas.Split('~'); var gift = new GiftModel(); gift.ID = int.Parse(giftDatas[0]); gift.Title = giftDatas[1]; gift.Message = giftDatas[2]; gift.ItemID = int.Parse(giftDatas[3]); gift.Image = giftDatas[4]; Gifts.Add(gift); } }
public GiftDbContext(DbContextOptions <GiftDbContext> options) : base(options) { Database.EnsureCreated(); if (Gifts.CountAsync().Result == 0) { var item = new Gift() { Title = "LG fjernsyn", Description = "55 tommer" }; Gifts.Add(item); SaveChanges(); item = new Gift() { Title = "Samsung Galaxy", Description = "Smartphone" }; Gifts.Add(item); SaveChanges(); } }
private void Initialization() { Account = new Account(); Ads = new Ads(); Apps = new Apps(); AppWidgets = new AppWidgets(); Audio = new Audio(); Auth = new Auth(); Board = new Board(); Database = new Database(); Docs = new Docs(); Fave = new Fave(); Friends = new Friends(); Gifts = new Gifts(); Groups = new Groups(); Likes = new Likes(); Market = new Market(); Messages = new Messages(); Newsfeed = new Newsfeed(); Notes = new Notes(); Notifications = new Notifications(); Other = new Other(); Pages = new Pages(); Photos = new Photos(); Places = new Places(); Polls = new Polls(); Search = new Search(); Stats = new Stats(); Status = new Status(); Storage = new Storage(); Stories = new Stories(); Streaming = new Streaming(); Users = new Users(); Utils = new Utils(); Video = new Video(); Wall = new Wall(); Widgets = new Widgets(); }
public static List <int> getPresentsFromString(String s) { String[] presents = s.Split(','); List <int> presentIds = new List <int>(); foreach (String s_present in presents) { String tmp = s_present.Trim(); using (var context = new GifterDBEntities()) { Gifts gift = context.Gifts.FirstOrDefault(x => x.GiftName.Equals(tmp)); if (gift == null) { gift = new Gifts(); gift.GiftName = tmp; context.Gifts.Add(gift); context.SaveChanges(); } presentIds.Add(gift.GiftId); } } return(presentIds); }
public void ShowGifts() { lblgift.Text = ""; if (MyStudent.Payments == null) { return; } double Sum = MyStudent.Payments.Sum(f => f.Sum); for (int i = 0; i < Cache.Instance.Gifts.Count; i++) { if ((Sum < Cache.Instance.Gifts[i].Money && !MyStudent.ISSister) || (Sum < Cache.Instance.Gifts[i].MoneySister && MyStudent.ISSister)) { return; } if (MyStudent.GIFT.Count <= i) { Gifts giftnew = new Gifts() { Gift = Cache.Instance.Gifts[i].Type, IsGift = false }; bool isSucssedAdd = new ManagerSaleSine().AddGift(MyStudent.TZ, giftnew); if (!isSucssedAdd) { MessageBox.Show("לא הצליח להוסיף מתנה יש לפנות לממונה"); return; } MyStudent.GIFT.Add(giftnew); } ///אם לא קבל את המתנה if (!MyStudent.GIFT[i].IsGift) { lblgift.Text += Cache.Instance.Gifts[i].Gift + " , "; FlowGift.Visible = true; } } }
public void BuildRelationship() { foreach (var rg in RoomGroups) { rg.SubRoomGroups = new List <RoomGroup>(); rg.SubRoomGroups.AddRange(RoomGroups.Where(g => g.ParentGroup_Id.HasValue && g.ParentGroup_Id.Value == rg.Id)); rg.Rooms = Rooms.Where(r => r.RoomGroup_Id == rg.Id).ToList(); } GiftGroups.ForEach(giftGroup => { giftGroup.Gifts = Gifts.Where(g => g.GiftGroup_Id == giftGroup.Id).ToList(); }); foreach (var room in Rooms) { room.RoomRoles = new List <RoomRole>(); var rrs = RoomRoles.Where(r => r.Room_Id == room.Id); if (rrs != null) { room.RoomRoles.AddRange(rrs); } } foreach (var role in Roles) { if (role.Application_Id == applicationId || role.Application_Id == BuiltIns.AllApplication.Id) { role.RoleCommands = new List <RoleCommandView>(); var rcs = RoleCommands.Where(rc => (rc.SourceRole_Id == role.Id || rc.SourceRole_Id == BuiltIns.AllRole.Id) && (rc.Application_Id == applicationId || rc.Application_Id == BuiltIns.AllApplication.Id)); if (rcs != null) { role.RoleCommands.AddRange(rcs); } } } }
private IEnumerator AnimateToEnd() { ambient.mute = true; finished.transform.DOScale(new Vector3(1f, 1f, 1f), 0.6f); yield return(new WaitForSeconds(2f)); finished.transform.DOScale(new Vector3(0f, 0f, 0f), 0.6f); Unpack.transform.DOScale(new Vector3(1f, 1f, 1f), 0.6f); drumroll.Play(); yield return(new WaitForSeconds(2f)); Unpack.transform.DOScale(new Vector3(0f, 0f, 0f), 0.6f); Color c = filter.color; while (c.a > 0) { c.a -= 0.01f; filter.color = c; c = filter.color; yield return(new WaitForSeconds(0.01f)); } while (GameController.activeGC.giftsToGive.Count > 0) { Gifts toGive = GameController.activeGC.giftsToGive[0]; GameController.activeGC.discoveredGifts.Add(toGive.nam); GameObject gift = Instantiate(giftPrefab); gift.transform.position = startPoint.transform.position; gift.transform.DOMove(middlePoint.transform.position, 1f); yield return(new WaitForSeconds(1.8f)); gift.GetComponent <Animator>().SetTrigger("Open"); gift.GetComponentInChildren <BowBoom>().GoAway(); GameObject renderer = Instantiate(basicRenderer); renderer.transform.position = middlePoint.transform.position; renderer.GetComponent <SpriteRenderer>().sprite = toGive.image; itemName.text = toGive.nam; itemDescr.text = toGive.tagline; renderer.transform.DOMove(itemCenter.position, 1f); renderer.transform.DOScale(new Vector3(1.7f, 1.7f, 1.7f), 1f); yield return(new WaitForSeconds(1f)); drumroll.Stop(); ohhh.Play(); itemName.transform.DOScale(new Vector3(1, 1, 1), 1f); itemDescr.transform.DOScale(new Vector3(1, 1, 1), 1f); yield return(new WaitForSeconds(4f)); renderer.transform.DOMove(middlePoint.position, 0.6f); renderer.transform.DOScale(new Vector3(0, 0, 0), 0.6f); itemName.transform.DOScale(new Vector3(0, 0, 0), 0.4f); itemDescr.transform.DOScale(new Vector3(0, 0, 0), 0.4f); ohhh.Stop(); drumroll.Play(); yield return(new WaitForSeconds(0.6f)); Destroy(renderer); gift.transform.DOMove(endPoint.transform.position, 0.5f); yield return(new WaitForSeconds(0.5f)); Destroy(gift); GameController.activeGC.giftsToGive.RemoveAt(0); } drumroll.Stop(); ambient.mute = false; endPanel.GetComponent <EndPanel>().SetUp(); endPanel.transform.DOScale(new Vector3(1f, 1f, 1f), 1f); }
public void PrtinGiftsList(string earrings, string boxofchocolates, string carrots, string sleigh, string suncreen) { Gifts newGifts = new Gifts(earrings, boxofchocolates, carrots, sleigh, suncreen); gifts.Add(newGifts); }
/* Gets profile with user data, wishlist and gifts */ public async Task <BLLAppDTO.ProfileBLL> GetFullByUserAsync(Guid userId, Guid accessingUserId, Guid?profileId = null, bool noTracking = true) { var fullProfile = Mapper.Map(await UOW.Profiles.GetFullByUserAsync(userId, profileId, noTracking)); // Return profile as usual when there are no gifts or only Active ones var hasOnlyActiveGifts = fullProfile?.Wishlist?.Gifts != null && fullProfile !.Wishlist !.Gifts.All(g => g.StatusId.ToString().Equals(_activeId)); if (fullProfile?.Wishlist?.Gifts == null || hasOnlyActiveGifts) { return(fullProfile !); // ignore null error } // If there are any Archived gifts, remove them before returning profile var hasAnyArchivedGifts = fullProfile.Wishlist.Gifts.Any(g => g.StatusId.ToString().Equals(_archivedId)); if (hasAnyArchivedGifts) { var archivedGifts = fullProfile.Wishlist.Gifts .Where(g => g.StatusId.ToString().Equals(_archivedId)) .ToList(); foreach (var gift in archivedGifts) { fullProfile.Wishlist.Gifts.Remove(gift); } } // If there are any Reserved gifts, include additional info before returning profile var hasAnyReservedGifts = fullProfile.Wishlist.Gifts.Any(g => g.StatusId.ToString().Equals(_reservedId)); if (hasAnyReservedGifts) { // Get ReservedGifts data var reservedGifts = (await UOW.ReservedGifts.GetAllAsync(userId)) .Where(rg => fullProfile.Wishlist.Gifts .Select(g => g.Id) .Contains(rg.GiftId)) .ToList(); // Get gifts in Reserved status var giftsInReservedStatus = fullProfile.Wishlist.Gifts .Where(g => g.StatusId.ToString().Equals(_reservedId)) .ToList(); // For each Gift in Reserved status, include some data from corresponding ReservedGift foreach (var gift in giftsInReservedStatus) { var reservedGift = reservedGifts .Where(rg => rg.GiftId == gift.Id) .Select(rg => Mapper.MapReservedGiftToBLL(rg)) .First(); // Include reserving date - everyone can see when the gift was reserved gift.ReservedFrom = reservedGift.ReservedFrom; // Include reserver user's id for logged in user - reserver can see which gifts are theirs, but not who reserved other gifts if (reservedGift.UserGiverId == accessingUserId) { gift.UserGiverId = reservedGift.UserGiverId; } } } return(fullProfile !); // ignore null error }
// POST: AjaxRedeemGift public IActionResult AjaxRedeemGift(string id) { try { string jsonString = "["; using (var context = new SiteDbContext()) { var now = DateTime.Now; Gifts gift = context.Gifts .Where(r => r.Code.Replace("-", "") == id && r.Active == true) .Select(r => r).SingleOrDefault(); if (gift == null) { throw new InvalidCastException("Your code is incorrect or has already been used."); } if (!(now >= gift.Start && now <= gift.End)) { throw new InvalidCastException("Your code has expired or is not active yet."); } if (!gift.SinglePerAccount) { gift.Active = false; } // SinglePerAccount if (gift.SinglePerAccount) { var AccountAlreadyUseIt = context.Deals_statistics .Where(r => r.UserId == User.FindFirstValue(ClaimTypes.NameIdentifier) && r.Code.Replace("-", "") == id) .Count(); if (AccountAlreadyUseIt > 0) { throw new InvalidCastException("The code already used by your account."); } } Deals_statistics stats = new Deals_statistics() { UserId = User.FindFirstValue(ClaimTypes.NameIdentifier), Date = DateTime.Now, Code = gift.Code, Price = 0, Nb_Artifacts = (int)gift.Artifacts, PaymentType = "Gift Code", }; context.Deals_statistics.Add(stats); if (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fr") { jsonString += "{ \"Success\" : \"true\",\"Title\" : \"Bravo\",\"Msg\" : \"Vous venez de valider votre code cadeau, les bonus ont été ajoutés à votre compte !\" }"; } else { jsonString += "{ \"Success\" : \"true\",\"Title\" : \"Bravo\",\"Msg\" : \"You just validate your gift code, the bonuses have been added to your account !\" }"; } // Artifacts if (gift.Artifacts != null) { if (gift.Artifacts > 0) { Artifacts artifact = context.Artifacts .Where(r => r.UserId == User.FindFirstValue(ClaimTypes.NameIdentifier)) .Select(r => r).FirstOrDefault(); artifact.Number += (int)gift.Artifacts; context.Update(artifact); if (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fr") { jsonString += ",{\"Title\":\"Artefacts\", \"Text\":\"Vous obtenez " + gift.Artifacts + " artefats.\", \"Img\":\"/images/Game/artifact.svg\"}"; } else { jsonString += ",{\"Title\":\"Artifacts\", \"Text\":\"You obtain " + gift.Artifacts + " artifacts.\", \"Img\":\"/images/Game/artifact.svg\"}"; } } } // Xp if (gift.Experiences != null) { if (gift.Experiences > 0) { Characters player = context.Characters .Where(r => r.UserId == User.FindFirstValue(ClaimTypes.NameIdentifier)) .Select(r => r).FirstOrDefault(); player.Xp += (int)gift.Experiences; context.Update(player); if (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fr") { jsonString += ",{\"Title\":\"Expérience\", \"Text\":\"Vous obtenez " + gift.Experiences + " d'expériences\", \"Img\":\"/images/Game/gold.svg\"}"; } else { jsonString += ",{\"Title\":\"Experience\", \"Text\":\"You obtain " + gift.Experiences + " experiences.\", \"Img\":\"/images/Game/gold.svg\"}"; } } } // Items if (gift.Items != null) { IList <string> items = gift.Items.Split(',').ToList(); foreach (string item in items) { var itemExist = context.Items .Where(r => r.Id == Int32.Parse(item)) .Select(r => r).FirstOrDefault(); if (itemExist != null) { Inventory inventory = new Inventory() { UserId = User.FindFirstValue(ClaimTypes.NameIdentifier), ItemId = Int32.Parse(item) }; if (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fr") { jsonString += ",{\"Title\":\"" + itemExist.TitleFr + "\", \"Text\":\"Vous trouverez l'objet dans votre inventaire.\", \"Img\":\"/uploads/game/cards/items/" + itemExist.Id + ".fr.svg\"}"; } else { jsonString += ",{\"Title\":\"" + itemExist.TitleEn + "\", \"Text\":\"You will find the item in your inventory.\", \"Img\":\"/uploads/game/cards/items/" + itemExist.Id + ".en.svg\"}"; } context.Add(inventory); } } } context.Update(gift); context.SaveChanges(); } jsonString += "]"; return(Json(JsonConvert.DeserializeObject(jsonString))); } catch (InvalidCastException e) { string jsonString = "[{ \"Success\" : \"false\",\"Title\" : \"Error\",\"Msg\" : \"" + e.Message + "\" }]"; if (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fr") { if (e.Message == "Your code has expired or is not active yet.") { jsonString = "[{ \"Success\" : \"false\",\"Title\" : \"Erreur\",\"Msg\" : \"Votre code a expiré ou n'est pas encore actif.\" }]"; } else if (e.Message == "Your code is incorrect or has already been used.") { jsonString = "[{ \"Success\" : \"false\",\"Title\" : \"Erreur\",\"Msg\" : \"Votre code est incorrect ou a déjà été utilisé.\" }]"; } else if (e.Message == "The code already used by your account.") { jsonString = "[{ \"Success\" : \"false\",\"Title\" : \"Erreur\",\"Msg\" : \"Le code à déjà utilisé par votre compte.\" }]"; } } return(Json(JsonConvert.DeserializeObject(jsonString))); } }
/// <summary> /// Serialises all body properties. The output will be a dictionary containing the /// body of the request in a form that can easily be converted to Json. Will return /// an empty dictionary if there is no body. /// </summary> /// /// <returns>The body Json in dictionary form.</returns> public IDictionary <string, object> SerialiseBody() { var dictionary = new Dictionary <string, object>(); // To dictionary.Add("To", To); // From if (From != null) { dictionary.Add("From", From); } // Title if (Title != null) { dictionary.Add("Title", Title); } // Text if (Text != null) { dictionary.Add("Text", Text); } // Data if (Data != null) { dictionary.Add("Data", Data.Serialise()); } // Tags if (Tags != null) { var serialisedTags = JsonSerialisation.Serialise(Tags, (string element) => { return(element); }); dictionary.Add("Tags", serialisedTags); } // Expiry if (Expiry != null) { dictionary.Add("Expiry", Expiry); } // Gifts if (Gifts != null) { dictionary.Add("Gifts", Gifts.Serialise()); } // Transfer if (Transfer != null) { dictionary.Add("Transfer", Transfer.Serialise()); } return(dictionary); }
public static Message SendMessage(string message, string toUser, string giftIds) { DB_Helper db = new DB_Helper(); var fromUser = MyUtils.ID_USER; message = MyUtils.StripHTML(message); giftIds = MyUtils.StripHTML(giftIds); int id_user_to = Convert.ToInt32(toUser); int id_offer = db.ExecuteScalarInt("exec CAN_MESSAGE_WITH " + Convert.ToInt32(fromUser) + "," + id_user_to, 0); if (id_offer == 0) { Message mm = new Message(); mm.Text = "You don't have permission to send messages to this user."; return(mm); } if (message.Trim() == "") { return(null); } if (!string.IsNullOrEmpty(giftIds)) { Gifts g = new Gifts(giftIds); string err = g.AddGifts2User(MyUtils.ID_USER, id_user_to); if (err != "") { Message mmm = new Message(); mmm.Text = err; return(mmm); } } var table = SaveMessage2DBAndSelect(fromUser, id_user_to, message, giftIds, id_offer); //make sure we don't send too many notification emails int unread_messages_in_10_mins = db.ExecuteScalarInt("select count(*) from Messages where id_user_from=" + fromUser + " and id_user_to=" + id_user_to + " and is_new = 1 and [time] > DATEADD(minute, -10, GETDATE())"); if (unread_messages_in_10_mins < 2) { RWorker.AddToEmailQueue("EMAIL_NEWMESSAGE", id_user_to, MyUtils.ID_USER); } DB_Helper.InvalidateCache("TOPCOUNTS_" + MyUtils.ID_USER); DB_Helper.InvalidateCache("TOPCOUNTS_" + id_user_to); var query = from p in table.AsEnumerable() select new Message { Id = p.Field <int>("id_message"), Text = p.Field <string>("text"), From = new User { Name = "You", Id = p.Field <int>("id_user_from") }, To = new User { Name = "Female123", //TODO Id = p.Field <int>("id_user_from") }, DateTime = p.Field <DateTime>("time"), IsFromMe = true }; Message m = query.First(); if (!string.IsNullOrEmpty(giftIds)) { m.Credits = Convert.ToInt32(MyUtils.GetUserField("credits")); } return(m); }
public void AddGift() { Gifts.Add(new GiftModel()); }
public void RemoveGift(int index) { Gifts.RemoveAt(index); }
/// <summary> /// Calcula el total de regalos /// </summary> /// <param name="OnlyCancellled"></param> /// <history> /// [vipacheco] 24/Mayo/2016 Created /// </history> public static void CalculateTotalGifts(DataGrid Grid, ref TextBox txtTotalCost, bool OnlyCancellled = false, string CancelField = "") { GiftsReceiptDetailCancel row = Grid.SelectedItem as GiftsReceiptDetailCancel; Gifts.CalculateTotalGifts(Grid, EnumGiftsType.ReceiptGifts, nameof(row.geQty), nameof(row.gegi), nameof(row.gePriceM), nameof(row.gePriceMinor), nameof(row.gePriceAdult), nameof(row.gePriceA), nameof(row.gePriceExtraAdult), txtTotalCost, OnlyCancellled: OnlyCancellled, CancelField: CancelField); }