示例#1
0
        public async Task <ActionResult <VIP> > PostVIP(VIP vIP)
        {
            _context.Vip.Add(vIP);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVip", new { id = vIP.Id }, vIP));
        }
示例#2
0
        public void AddData(string name, object value)
        {
            switch (name)
            {
            case "Логин": Login.Add((string)value); break;

            case "Пароль": Password.Add((string)value); break;

            case "Email": Email.Add((string)value); break;

            case "Телефон": Phone.Add((string)value); break;

            case "VIP": VIP.Add((bool)value); break;

            case "Баланс": Balance.Add(double.Parse(value.ToString())); break;

            case "Фамилия": LastName.Add((string)value); break;

            case "Имя": FirstName.Add((string)value); break;

            case "Отчество": MiddleName.Add((string)value); break;

            default: MessageBox.Show($"Поле {name} отсутствует!"); break;
            }
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("VIPId,KorisnikId,ime,prezime,brojKartice,datumRodjenja,tipFizickogLica,stanjeRacuna,odgovornoLice,uplatioClanarinu,iznosClanarine,trajanjeClanarine,username,password,adresa,email")] VIP vIP)
        {
            if (id != vIP.VIPId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vIP);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VIPExists(vIP.VIPId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KorisnikId"] = new SelectList(_context.Korisnik, "KorisnikId", "KorisnikId", vIP.KorisnikId);
            return(View(vIP));
        }
示例#4
0
        public async Task <IActionResult> PutVIPByUserId(Guid id, VIP vIP)
        {
            if (!await _userManager.Users
                .AnyAsync(u => u.Id == id))
            {
                return(NotFound("Пользователя с таким Id  не существует"));
            }

            var user = await _userManager.Users
                       .Include(u => u.Vip)
                       .FirstOrDefaultAsync(u => u.Id == id);

            user.Vip.Begin    = vIP.Begin;
            user.Vip.Duration = vIP.Duration;

            _context.Entry(user.Vip).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                return(Ok(user.Vip));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VIPExists(user.Vip.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }
示例#5
0
        public void TestKortingVIP()
        {
            var target = new VIP(10M, 2.5M);

            Assert.IsTrue(target.Saldo == 10M);
            Assert.IsTrue(target.Korting == 2.5M);
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] VIP vIP)
        {
            if (id != vIP.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vIP);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VIPExists(vIP.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vIP));
        }
 public VIPForm(string cmd, VIP customer)
 {
     InitializeComponent();
     this.customer = customer;
     Load(cmd);
     DisplayVIPDataToScreen();
 }
示例#8
0
        public async Task <IHttpActionResult> PutVIP(int id, VIP vIP)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vIP.UserID)
            {
                return(BadRequest());
            }

            db.Entry(vIP).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VIPExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public JsonResult Create01(string para01, string para02, string para03, string para04, string para05, string para06)
        {
            string VIP_ID       = para01;
            string VIP_NAME     = para02;
            string SEX          = para03;
            string PHONE_NUMBER = para04;
            short  CREDITS;
            string EMPLOYEE_ID = para06;


            short.TryParse(para05, out CREDITS);
            VIP newVIP = new VIP();

            newVIP.VIP_ID       = VIP_ID;
            newVIP.VIP_NAME     = VIP_NAME;
            newVIP.SEX          = SEX;
            newVIP.PHONE_NUMBER = PHONE_NUMBER;
            newVIP.CREDITS      = CREDITS;
            newVIP.EMPLOYEE_ID  = EMPLOYEE_ID;

            //缺少误填判断
            db.VIP.Add(newVIP);
            db.SaveChanges();

            var list = db.VIP.Select(n => new { VIP_ID = n.VIP_ID, VIP_NAME = n.VIP_NAME, SEX = n.SEX, PHONE_NUMBER = n.PHONE_NUMBER, CREDITS = n.CREDITS, EMPLOYEE_ID = n.EMPLOYEE_ID }).ToList();

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        public async Task <ActionResult <VIP> > PostVIPToUser(Guid userId, VIP vIP)
        {
            if (!await _userManager.Users.AnyAsync(u => u.Id == userId))
            {
                return(NotFound("Пользователя с таким ID не существует"));
            }

            var user = await _userManager.FindByIdAsync(userId.ToString());

            if (await _context.Vip.AnyAsync(v => v.UserId == userId))
            {
                var vip = await _context.Vip.FirstOrDefaultAsync(v => v.UserId == userId);

                vip.Begin    = vIP.Begin;
                vip.Duration = vIP.Duration;

                user.IsVip = true;
                await _userManager.UpdateAsync(user);

                _context.Entry(vip).State = EntityState.Modified;
                vip.User = null;
                return(Ok(vip));
            }

            vIP.UserId = userId;
            _context.Vip.Add(vIP);
            user.IsVip = true;
            await _userManager.UpdateAsync(user);

            await _context.SaveChangesAsync();

            vIP.User = null;

            return(StatusCode(201, vIP));
        }
示例#11
0
        public void TestNegatiefSaldoVIP()
        {
            var target = new VIP(10M, 10M);

            target.Betaal(20M);
            Assert.IsTrue(target.Saldo == -10M);
            Assert.IsTrue(target.Korting == 10M);
        }
 public override void Death()
 {
     StopMoving();
     UpdateHealthText();
     audio.Stop();
     state = VIP.Death;
     GameController.isGameOver = true;
 }
示例#13
0
    void SetFlashers(VIP carVIP)
    {
        Vector3    lightPosition = carVIP.transform.GetChild(0).transform.GetChild(0).position + new Vector3(0, 3, 0);
        GameObject flashers      = Instantiate(prefabOfLight, lightPosition, Quaternion.identity, carVIP.transform.GetChild(0).transform.GetChild(0));

        flashers.GetComponent <Light>().type  = LightType.Point;
        flashers.GetComponent <Light>().color = Color.red;
        flashers.GetComponent <Light>().range = 10;
    }
示例#14
0
        public ActionResult Create(FormCollection collection, VIP vip)
        {
            decimal gia = Convert.ToDecimal(collection["GiaQuangCao"]);

            vip.SoTienCanTra = gia;
            data.VIPs.InsertOnSubmit(vip);
            data.SubmitChanges();
            return(RedirectToAction("Index", "AdminVIP"));
        }
示例#15
0
        // GET: AdminVIP/Edit/5
        public ActionResult Edit(int id)
        {
            if (Session["TenTK_Admin"] == null)
            {
                return(RedirectToAction("DangNhap", "AdminTaiKhoan"));
            }
            VIP ctv = data.VIPs.SingleOrDefault(i => i.LevelVip == id);

            return(View(ctv));
        }
        public bool test(string id)
        {
            VIP vIP = db.VIP.Find(id);

            if (vIP != null)
            {
                return(true);
            }
            return(false);
        }
示例#17
0
        public async Task <IActionResult> Create([Bind("Id,Name")] VIP vIP)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vIP);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vIP));
        }
示例#18
0
        public async Task <IHttpActionResult> GetVIP(int id)
        {
            VIP vIP = await db.VIPs.FindAsync(id);

            if (vIP == null)
            {
                return(NotFound());
            }

            return(Ok(vIP));
        }
 /// <summary>
 /// Updates a specific VIP based on it's ID
 /// </summary>
 /// <returns>VIP</returns>
 public VIP Put([FromBody] VIP vip)
 {
     if (String.IsNullOrEmpty(vip.VIPId))
     {
         vip.VIPId = Guid.NewGuid().ToString();
     }
     this.OnBeforePut(vip);
     this.SDM.Upsert(vip);
     this.OnAfterPut(vip);
     return(vip);
 }
示例#20
0
 // Token: 0x06001A16 RID: 6678 RVA: 0x000D50B0 File Offset: 0x000D32B0
 private bool TargetIsResearcher(AIEntity aie)
 {
     if (aie != null)
     {
         VIP component = aie.GetComponent <VIP>();
         if (component != null)
         {
             return(VIP.IsResearcher(aie));
         }
     }
     return(false);
 }
示例#21
0
        public void KaartKortingVIPTest()
        {
            //arrange
            Kaart kaart = new VIP(50.0M, 10);

            //act
            kaart.Betaal(10M);
            decimal result = kaart.getSaldo();

            //Assert
            Assert.Equal(41.0M, result);
        }
示例#22
0
        public async Task <IActionResult> Create([Bind("VIPId,KorisnikId,ime,prezime,brojKartice,datumRodjenja,tipFizickogLica,stanjeRacuna,odgovornoLice,uplatioClanarinu,iznosClanarine,trajanjeClanarine,username,password,adresa,email")] VIP vIP)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vIP);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KorisnikId"] = new SelectList(_context.Korisnik, "KorisnikId", "KorisnikId", vIP.KorisnikId);
            return(View(vIP));
        }
示例#23
0
        public static void deleteGoodsOrder(ulong orderId)
        {
            DBHelper dbHelper = new DBHelper();

            try
            {
                string            queryInfo         = "SELECT * FROM GOODS_ORDER WHERE ID =:orderId";
                string            delete            = "DELETE FROM GOODS_ORDER WHERE ID =:orderId";
                string            updateGoods       = "UPDATE SELLER_GOODS SET AVAILABLE = AVAILABLE+1 WHERE SELLER_ID =:sellerId AND GOODS_ID =:goodsId";
                string            updateEarning     = "UPDATE SELLER SET EARNING=EARNING-:money WHERE ID=:sellerId";
                OracleParameter[] parameterForOrder = { new OracleParameter(":orderId", OracleDbType.Long, 20) };
                parameterForOrder[0].Value = orderId;
                // 保存订单信息
                DataTable dt = dbHelper.ExecuteTable(queryInfo, parameterForOrder);

                // 删除订单
                dbHelper.ExecuteNonQuery(delete, parameterForOrder);

                // 存货更新
                OracleParameter[] parametersForGoods =
                {
                    new OracleParameter(":sellerId", OracleDbType.Long, 10),
                    new OracleParameter(":goodsId",  OracleDbType.Long, 10)
                };
                parametersForGoods[0].Value = long.Parse(dt.Rows[0]["SELLER_ID"].ToString());
                parametersForGoods[1].Value = long.Parse(dt.Rows[0]["GOODS_ID"].ToString());
                dbHelper.ExecuteNonQuery(updateGoods, parametersForGoods);

                // 收入更新
                OracleParameter[] parametersForEarning =
                {
                    new OracleParameter(":money",    OracleDbType.Double),
                    new OracleParameter(":sellerId", OracleDbType.Long, 10)
                };
                double money = double.Parse(dt.Rows[0]["PRICE"].ToString());
                parametersForEarning[0].Value = money;
                parametersForEarning[1].Value = long.Parse(dt.Rows[0]["SELLER_ID"].ToString());
                dbHelper.ExecuteNonQuery(updateEarning, parametersForEarning);

                // 积分更新
                long customerId = long.Parse(dt.Rows[0]["CUSTOMER_ID"].ToString());
                VIP  check      = VipController.checkVip(customerId);
                if (check != null)
                {
                    VipController.updateVip(customerId, -money);
                }
                return;
            }
            catch (OracleException)
            {
                throw;
            }
        }
        private void bunifuTileButton_Execute_Click(object sender, EventArgs e)
        {
            if (mode == "view")
            {
                this.Close();
                return;
            }

            ThreadManager.DisplayLoadingScreen();
            VIP newVIP = new VIP();

            try
            {
                Random rnd = new Random();
                newVIP.VipID         = rnd.Next().ToString(); // Dummy init
                newVIP.FullName      = bunifuCustomTextbox_FullName.Text;
                newVIP.DateOfBirth   = Convert.ToDateTime(bunifuCustomTextbox_DoB.Text).Date;
                newVIP.Gender        = bunifuCustomTextbox_Gender.Text;
                newVIP.CivilianID    = bunifuCustomTextbox_CivilianID.Text;
                newVIP.Occupation    = bunifuCustomTextbox_Occupation.Text;
                newVIP.ContactNumber = bunifuCustomTextbox_PhoneNumber.Text;
                newVIP.Address       = bunifuCustomTextbox_Address.Text;
            }
            catch (Exception ex)
            {
                ThreadManager.CloseLoadingScreen();
                ErrorManager.MessageDisplay(ex.Message, "", "Error: Can't get data from fields");
                return;
            }

            string err = "";

            if (mode != "delete")
            {
                err = newVIP.ValidateField();
            }
            if (err != "")
            {
                ThreadManager.CloseLoadingScreen();
                ErrorManager.MessageDisplay(err, "", "Incorrect values");
                return;
            }

            err = manager.AddOrUpdateAVIP(newVIP);
            ThreadManager.CloseLoadingScreen();
            ErrorManager.MessageDisplay(err, "Add/Update a VIP successfully", "Failed to add/update a VIP");

            if (err == "")
            {
                this.Close();
            }
        }
        public string AddOrUpdateAVIP(VIP newVIP)
        {
            string err = AddOrUpdatePersonDetails(newVIP.FullName, newVIP.DateOfBirth, newVIP.Gender, newVIP.ContactNumber, newVIP.CivilianID, newVIP.Address);

            if (err != "")
            {
                return(err);
            }

            int             personalDetailsID = GetPersonalDetailsID(newVIP.CivilianID);
            Table <DAL.VIP> vipTable          = GetVipTable();
            var             matchedVIP        = (from vip in vipTable
                                                 where vip.personalDetailsID == personalDetailsID
                                                 select vip).FirstOrDefault();

            if (matchedVIP == null)
            {
                DAL.VIP newData = new DAL.VIP();
                try
                {
                    newData.vipID             = newVIP.VipID;
                    newData.personalDetailsID = personalDetailsID;
                    newData.occupationCode    = GetOccupationCode(newVIP.Occupation);
                    newData.registerDate      = DateTime.Now.Date;
                    newData.endDate           = DateTime.Now.AddDays(ParameterManager.GetVIPMembershipIncreasementDaysNumber()).Date;
                    newData.vipStatusCode     = 1;

                    vipTable.InsertOnSubmit(newData);
                    vipTable.Context.SubmitChanges();
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
            else if (matchedVIP != null)
            {
                try
                {
                    matchedVIP.personalDetailsID = personalDetailsID;
                    matchedVIP.occupationCode    = GetOccupationCode(newVIP.Occupation);

                    db.SubmitChanges();
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }

            return("");
        }
示例#26
0
        public ActionResult Edit(VIP vip, FormCollection collection)
        {
            VIP ctv = data.VIPs.SingleOrDefault(i => i.LevelVip == vip.LevelVip);
            var gia = Convert.ToDecimal(collection["GiaQuangCao"]);

            ctv.SoTienCanTra = gia;
            if (ModelState.IsValid)
            {
                UpdateModel(ctv);
                data.SubmitChanges();
            }
            return(RedirectToAction("Index"));
        }
 void Start()
 {
     currentHealth = health;
     rb            = GetComponent <Rigidbody2D>();
     animator      = GetComponent <Animator>();
     audio         = GetComponent <AudioSource>();
     healthText    = GetComponentInChildren <TextMesh>();
     movingTimer   = movingTime;
     standingTimer = standingTime;
     StartMoving();
     audio.Play();
     state = VIP.Moving;
     //state = VIP.Standing;
 }
示例#28
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="src">The DeepBot instance this user belongs to.</param>
 /// <param name="firstseen">First seen date of user</param>
 /// <param name="lastseen">Last seen date of user</param>
 /// <param name="minutes">Watch minutes of user</param>
 /// <param name="name">Name of user</param>
 /// <param name="points">Number of points</param>
 /// <param name="userlevel">User level</param>
 /// <param name="vipexpiry">VIP expiry time</param>
 /// <param name="viplevel">VIP level of user</param>
 public User(DeepBot src, string name = "", int points          = 0, int minutes = 0, VIP viplevel = VIP.Regular, Level userlevel = Level.User,
             DateTime?firstseen       = null, DateTime?lastseen = null, DateTime?vipexpiry = null)
 {
     source       = src;
     Name         = name;
     this.points  = points;
     this.minutes = minutes;
     vipLevel     = ((int)viplevel == 10 ? VIP.Regular : viplevel);
     userLevel    = userlevel;
     firstSeen    = (firstseen == null ? DateTime.Now : (DateTime)firstseen);
     lastSeen     = (lastseen == null ? DateTime.Now : (DateTime)lastseen);
     vipExpiry    = (vipexpiry == null ? DateTime.Now : (DateTime)vipexpiry);
     LastUpdate   = DateTime.Now;
 }
示例#29
0
        /// <summary>
        /// Set the user's VIP level and number of days to add.
        /// </summary>
        /// <exception cref="InvalidOperationException">Thrown if not connected to the bot and AutoConnect == false, or if the bot did not respond within ResponseWait milliseconds</exception>
        /// <exception cref="DeepBotException">Thrown if the VIP level or expiry could not be set, or if invalid parameters were supplied.</exception>
        /// <param name="username">The username to set VIP on</param>
        /// <param name="level">Desired VIP level</param>
        /// <param name="daysToAdd">Number of days to add. If the current expiry is in the past, sets the expiry to the specified number of days from now.</param>
        public void SetVIPLevel(string username, VIP level, int daysToAdd = 0)
        {
            if ((int)level == 10)
            {
                level = VIP.Regular;
            }

            blockingCall("api|set_vip|" + username + "|" + (int)level + "|" + daysToAdd);

            if (response != "success")
            {
                throw new DeepBotException(response);
            }
        }
示例#30
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VIP vIP = db.VIPs.Find(id);

            if (vIP == null)
            {
                return(HttpNotFound());
            }
            return(View(vIP));
        }
示例#31
0
文件: DeepBot.cs 项目: djkaty/DeepBot
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="src">The DeepBot instance this user belongs to.</param>
 /// <param name="firstseen">First seen date of user</param>
 /// <param name="lastseen">Last seen date of user</param>
 /// <param name="minutes">Watch minutes of user</param>
 /// <param name="name">Name of user</param>
 /// <param name="points">Number of points</param>
 /// <param name="userlevel">User level</param>
 /// <param name="vipexpiry">VIP expiry time</param>
 /// <param name="viplevel">VIP level of user</param>
 public User(DeepBot src, string name = "", int points = 0, int minutes = 0, VIP viplevel = VIP.Regular, Level userlevel = Level.User,
     DateTime? firstseen = null, DateTime? lastseen = null, DateTime? vipexpiry = null)
 {
     source = src;
     Name = name;
     this.points = points;
     this.minutes = minutes;
     vipLevel = ((int)viplevel == 10 ? VIP.Regular : viplevel);
     userLevel = userlevel;
     firstSeen = (firstseen == null ? DateTime.Now : (DateTime) firstseen);
     lastSeen = (lastseen == null ? DateTime.Now : (DateTime) lastseen);
     vipExpiry = (vipexpiry == null ? DateTime.Now : (DateTime)vipexpiry);
     LastUpdate = DateTime.Now;
 }
示例#32
0
文件: DeepBot.cs 项目: djkaty/DeepBot
        /// <summary>
        /// Update from server if necessary
        /// </summary>
        private void update()
        {
            if (!source.AutoCache)
                return;

            User u = source.GetUser(Name);

            points = u.points;
            minutes = u.minutes;
            vipLevel = u.vipLevel;
            userLevel = u.userLevel;
            firstSeen = u.firstSeen;
            lastSeen = u.lastSeen;
            vipExpiry = u.vipExpiry;
            LastUpdate = DateTime.Now;
        }
        public override void LoadContent()
        {
            ranks.LoadContent(game.Content);
            spriteBatch = new SpriteBatch(service.GraphicsDevice);
            // Create a new SpriteBatch, which can be used to draw textures.
            h1.LoadContent(game.Content);
            crosshair.LoadContent(game.Content);
            d1.LoadContent(game.Content);

            b1.initImage(game.Content);
            font = game.Content.Load<SpriteFont>("Font");
            crosshair.Position = new Vector2((service.GraphicsDevice.PresentationParameters.BackBufferWidth / 2)+ 400, service.GraphicsDevice.PresentationParameters.BackBufferHeight / 2);
            vip = new VIP(crosshair.Position);
            vip.LoadContent(game.Content);
            sprite = new PlayerAnimation();
            chopperAnimation = new AnimatedSprite(game.Content.Load<Texture2D>("Sprites/frontreel"), .15f, true);
            chopperAnimation.FrameDivisions = 3;
            chopperSound = game.Content.Load<SoundEffect>("Sounds\\Chopper").CreateInstance();

            wm = new WaveManager();
            wm.LoadContent(game.Content, crosshair, vip, service.GraphicsDevice.Viewport);
            // TODO: use this.Content to load your game content here
        }