Example #1
0
 public void changeInfo(string _name, pony_type _race, user_type _uType, bool _isOnline, string _About, BitmapImage _ava)
 {
     this.currentBrony   = new Brony(_name, _About, _race, _uType, "", _isOnline, _ava);
     this.u_Ava.Source   = this.currentBrony.Avatar;
     this.u_About.Text   = this.currentBrony.AboutBrony;
     this.u_Nick.Content = this.currentBrony.Name;
 }
Example #2
0
 public void changeInfo(string _name, pony_type _race, user_type _uType, bool _isOnline, string _About, BitmapImage _ava)
 {
     this.currentBrony = new Brony(_name, _About, _race, _uType, "", _isOnline, _ava);
     this.u_Ava.Source = this.currentBrony.Avatar;
     this.u_About.Text = this.currentBrony.AboutBrony;
     this.u_Nick.Content = this.currentBrony.Name; 
 }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            user_type user_type = db.user_type.Find(id);

            db.user_type.Remove(user_type);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "type_id,type_name")] user_type user_type)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user_type).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user_type));
 }
Example #5
0
        public ActionResult Create([Bind(Include = "type_id,type_name")] user_type user_type)
        {
            if (ModelState.IsValid)
            {
                db.user_type.Add(user_type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user_type));
        }
Example #6
0
 public MyFriend(string _name, string _about, pony_type _ptype, user_type _utype, bool _isActive, BitmapImage _avatar)
 {
     this.Name        = _name;
     this.AboutBrony  = _about;
     this.pType       = _ptype;
     this.uType       = _utype;
     this.status      = "";
     this.isActive    = _isActive;
     this.statusColor = define_color(this.pType, this.isActive);
     this.Avatar      = _avatar;
 }
Example #7
0
 public Brony(string _name, string _about, pony_type _ptype, user_type _utype, string _status, bool _isActive, string _URL_avatar)
 {
     this.Name        = _name;
     this.AboutBrony  = _about;
     this.pType       = _ptype;
     this.uType       = _utype;
     this.status      = _status;
     this.isActive    = _isActive;
     this.statusColor = define_color(this.pType, this.isActive);
     this.Avatar      = new BitmapImage(new Uri(_URL_avatar, UriKind.Relative));
 }
        static public bool IsUSerTypeExist(user_type candidate, List <user_type> types)
        {
            List <user_type> existingOne = types.Where(o => o.type == candidate.type).ToList();

            if (existingOne.Count != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #9
0
        // GET: user_type/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            user_type user_type = db.user_type.Find(id);

            if (user_type == null)
            {
                return(HttpNotFound());
            }
            return(View(user_type));
        }
 static public bool IsValide(user_type candidate)
 {
     try
     {
         if (
             PropretyValidation.IsStringValide(candidate.type, user_type.typeMin, user_type.typeMax)
             )
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public bool DeleteUserType(int id)
 {
     try
     {
         if (db.user_type.Find(id) != null)
         {
             user_type type = db.user_type.Find(id);
             db.user_type.Remove(type);
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public bool PutUserType(user_type user_type)
 {
     try
     {
         if (ValidatorUserType.IsUSerTypeExist(user_type, GetAllUserType()))
         {
             db.Entry(user_type).State = EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         else if (!ValidatorUserType.IsUSerTypeExist(user_type, GetAllUserType()))
         {
             throw new ItemNotExistException("user_type");
         }
         else
         {
             throw new InvalidItemException("user_type");
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public bool PostUserType(user_type type)
 {
     try
     {
         if (type.type.Length > 0 && type.type.Length < 11)
         {
             db.user_type.Add(type);
             db.SaveChanges();
             return(true);
         }
         else if (ValidatorUserType.IsUSerTypeExist(type, GetAllUserType()))
         {
             throw new ExistingItemException("user_type");
         }
         else
         {
             throw new InvalidItemException("user_type");
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }