Esempio n. 1
0
        /// <summary>
        /// Gets and enums Key as string to be used in Product view
        /// </summary>
        /// <param name="type">Type of Enum</param>
        /// <param name="typeInt">A integer for identifying the type</param>
        /// <returns></returns>
        public static string GetEnumValue(string type, int typeInt)
        {
            string TypeString = "";

            switch (type)
            {
            case "Chair":
                ChairType ct = (ChairType)typeInt;
                TypeString = Enum.GetName(typeof(ChairType), ct);
                return(TypeString);

            case "Table":
                TableType tt = (TableType)typeInt;
                TypeString = Enum.GetName(typeof(TableType), tt);
                return(TypeString);

            case "Bed":
                BedType bt = (BedType)typeInt;
                TypeString = Enum.GetName(typeof(BedType), bt);
                return(TypeString);

            case "Color":
                Color cot = (Color)typeInt;
                TypeString = Enum.GetName(typeof(Color), cot);
                return(TypeString);

            case "Material":
                Material mt = (Material)typeInt;
                TypeString = Enum.GetName(typeof(Material), mt);
                return(TypeString);
            }
            return("Unkown");
        }
Esempio n. 2
0
        protected override void Seed(HotelsA.Data.HotelsContext _context)
        {
            UserRol usrr = new UserRol
            {
                UserType = "Administrator"
            };

            _context.UserRols.Add(usrr);

            User user = new User
            {
                FullName  = "Administrator",
                UserName  = "******",
                Password  = "******",
                UserRolId = 1
            };

            _context.Users.Add(user);

            BedType bdty1 = new BedType
            {
                TypeName = "Cüt"
            };

            _context.BedTypes.Add(bdty1);

            BedType bdty2 = new BedType
            {
                TypeName = "Tək"
            };

            _context.BedTypes.Add(bdty2);
            _context.SaveChanges();
        }
Esempio n. 3
0
        public List <BedType> GetAll()
        {
            BedTypeDAC     _bedTypeComponent = new BedTypeDAC();
            IDataReader    reader            = _bedTypeComponent.GetAllBedType().CreateDataReader();
            List <BedType> _bedTypeList      = new List <BedType>();

            while (reader.Read())
            {
                if (_bedTypeList == null)
                {
                    _bedTypeList = new List <BedType>();
                }
                BedType _bedType = new BedType();
                if (reader["BedTypeId"] != DBNull.Value)
                {
                    _bedType.BedTypeId = Convert.ToInt32(reader["BedTypeId"]);
                }
                if (reader["BedTypeName"] != DBNull.Value)
                {
                    _bedType.BedTypeName = Convert.ToString(reader["BedTypeName"]);
                }
                _bedType.NewRecord = false;
                _bedTypeList.Add(_bedType);
            }
            reader.Close();
            return(_bedTypeList);
        }
Esempio n. 4
0
        public ActionResult Create(BedType bedtype)
        {
            string cookie = Request.Cookies["cookie"].Value.ToString();
            User   user   = _context.Users.Include("UserRol").FirstOrDefault(u => u.token == cookie);

            if (user.UserRol.UserType == "Restorant")

            {
                return(RedirectToAction("index", "home"));
            }
            if (user.UserRol.UserType == "Qebul")

            {
                return(RedirectToAction("index", "home"));
            }
            if (_context.BedTypes.Any(c => c.TypeName == bedtype.TypeName))
            {
                ModelState.AddModelError("BedType", bedtype.TypeName + " artıq mövcuddur.");
                return(View(bedtype));
            }

            if (ModelState.IsValid)
            {
                _context.BedTypes.Add(bedtype);
                _context.SaveChanges();

                return(RedirectToAction("index"));
            }


            return(View(bedtype));
        }
Esempio n. 5
0
        public ActionResult Delete(int id)
        {
            string cookie = Request.Cookies["cookie"].Value.ToString();
            User   user   = _context.Users.Include("UserRol").FirstOrDefault(u => u.token == cookie);

            if (user.UserRol.UserType == "Restorant")

            {
                return(RedirectToAction("index", "home"));
            }
            if (user.UserRol.UserType == "Qebul")

            {
                return(RedirectToAction("index", "home"));
            }
            BedType BedType = _context.BedTypes.Find(id);

            if (BedType == null)
            {
                return(HttpNotFound());
            }

            _context.BedTypes.Remove(BedType);
            _context.SaveChanges();

            return(RedirectToAction("index"));
        }
Esempio n. 6
0
        private void SaveAssignment()
        {
            CheckInputIsValid();

            _apt.BeginUpdate();
            _apt.Location   = txtNote.Text;
            _apt.ResourceId = (chkResources.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.Booking.BookingResource).Id;

            _apt.Start = this.dtpIn.DateTime.Date;
            _apt.End   = this.dtpOut.DateTime.Date;


            BookingResource res = chkResources.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.Booking.BookingResource;
            BedType         bed = cboLetti.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.Booking.BedType;

            _apt.CustomFields["Resource"] = res;
            _apt.CustomFields["Booking"]  = _parentBooking;
            _apt.CustomFields["BedType"]  = bed;

            if (_isCreationOp)
            {
                _control.Storage.Appointments.Add(_apt);
            }
            _apt.EndUpdate();
        }
        public async Task <IActionResult> Edit(decimal id, [Bind("Id,Name")] BedType bedType)
        {
            if (id != bedType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bedType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BedTypeExists(bedType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bedType));
        }
Esempio n. 8
0
        public ActionResult BedType()
        {
            List <BedType> CategoryList = new List <BedType>();
            Property       p            = new Property();
            DataSet        ds           = new DataSet();

            p.OnTable = "FetchBedType";

            ds = dl.FetchBedType_sp(p);

            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    BedType m = new BedType();

                    m.TId      = item["TId"].ToString();
                    m.Purpose  = item["Purpose"].ToString();
                    m.AddedBy  = item["AddedBy"].ToString();
                    m.IsActive = item["IsActive"].ToString();
                    CategoryList.Add(m);
                }
                ViewBag.CategoryList = CategoryList;
            }
            catch (Exception e)
            {
            }
            return(View());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            BedType bedType = db.BedType.Find(id);

            db.BedType.Remove(bedType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        public async Task<IHttpActionResult> Post(int id, BedTypeInputModel model)
        {
            BedType bedType = new BedType() { Id = model.Id, Name = model.Name };
            CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment };
            var attachments = SetUpAttachmentsModels(model.Attachments);
            var changeRequestId = await _bedTypeApplicationService.DeleteAsync(bedType, id, CurrentUser.Email, comment, attachments);

            return Ok(changeRequestId);
        }
        public async Task <IActionResult> Create([FromBody] BedType bedType)
        {
            var bed = BedType.Create(bedType.Code, bedType.Description);

            _propertyContext.BedTypes.Add(bed);

            await _propertyContext.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetItemById), new { id = bed.Id }, null));
        }
Esempio n. 12
0
 public ActionResult Delete(int id)
 {
     using (HISDBEntities db = new HISDBEntities())
     {
         BedType bg = db.BedTypes.Where(x => x.BedTypeID == id).FirstOrDefault <BedType>();
         db.BedTypes.Remove(bg);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
     }
 }
        public override async Task <long> SubmitAddChangeRequestAsync(BedConfig entity, string requestedBy,
                                                                      List <ChangeRequestItemStaging> changeRequestItemStagings = null, CommentsStagingModel comment = null,
                                                                      List <AttachmentsModel> attachmentsStagingModels          = null, string changeContent = null)
        {
            if (entity.BedLengthId.Equals(default(int)) ||
                entity.BedTypeId.Equals(default(int)))
            {
                throw new ArgumentException(nameof(entity));
            }

            changeRequestItemStagings = new List <ChangeRequestItemStaging>();
            // Validation check for insert of new bed config

            await ValidateConfigurationDoesNotMatchWithExistingBedConfig(entity);
            await ValidateNoChangeRequestExistsWithSameConfiguration(entity);
            await ValidateBedConfigLookUpHasNoChangeRequest(entity);


            changeRequestItemStagings.Add(new ChangeRequestItemStaging()
            {
                ChangeType      = ChangeType.Add,
                EntityId        = entity.Id.ToString(),
                CreatedDateTime = DateTime.UtcNow,
                Entity          = typeof(BedConfig).Name,
                Payload         = base.Serializer.Serialize(entity)
            });

            var bedTypeRepositoryService   = Repositories.GetRepositoryService <BedType>() as IVcdbSqlServerEfRepositoryService <BedType>;
            var bedLengthRepositoryService = Repositories.GetRepositoryService <BedLength>() as IVcdbSqlServerEfRepositoryService <BedLength>;

            BedType   bedType   = null;
            BedLength bedLength = null;

            if (bedTypeRepositoryService != null && bedLengthRepositoryService != null)
            {
                var bedTypes = await bedTypeRepositoryService.GetAsync(m => m.Id == entity.BedTypeId && m.DeleteDate == null, 1);

                if (bedTypes != null && bedTypes.Any())
                {
                    bedType = bedTypes.First();
                }
                var bedLengths = await bedLengthRepositoryService.GetAsync(m => m.Id == entity.BedLengthId && m.DeleteDate == null, 1);

                if (bedLengths != null && bedLengths.Any())
                {
                    bedLength = bedLengths.First();
                }

                changeContent = string.Format("{0} / {1} / {2}", bedType.Name, bedLength.Length, bedLength.BedLengthMetric);
            }

            // NOTE: change-request-comments-staging perfomed on base

            return(await base.SubmitAddChangeRequestAsync(entity, requestedBy, changeRequestItemStagings, comment, attachmentsStagingModels, changeContent));
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] BedType bedType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bedType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bedType));
        }
Esempio n. 15
0
        public ActionResult Edit(int id)
        {
            BedType BedType = _context.BedTypes.Find(id);

            if (BedType == null)
            {
                return(HttpNotFound());
            }

            ViewBag.BedTypes = _context.BedTypes.ToList();
            return(View(BedType));
        }
        public ActionResult Create(BedType bedType)
        {
            if (ModelState.IsValid)
            {
                _context.bedTypes.Add(bedType);
                _context.SaveChanges();

                return(RedirectToAction("index"));
            }

            return(View(bedType));
        }
Esempio n. 17
0
        public bool Insert(BedType bedtype)
        {
            int        autonumber       = 0;
            BedTypeDAC bedtypeComponent = new BedTypeDAC();
            bool       endedSuccessfuly = bedtypeComponent.InsertNewBedType(ref autonumber, bedtype.BedTypeName);

            if (endedSuccessfuly)
            {
                bedtype.BedTypeId = autonumber;
            }
            return(endedSuccessfuly);
        }
Esempio n. 18
0
 public ActionResult Create([Bind(Include = "Id,Description,PricerPerBed")] BedType bedType)
 {
     if (ModelState.IsValid)
     {
         db.BedType.Add(bedType);
         db.SaveChanges();
         Alert("La operacion fue exitosa", Utilities.NotificationType.error);
         return(View(bedType));
     }
     Alert("Algo fallo", Utilities.NotificationType.error);
     return(View(bedType));
 }
Esempio n. 19
0
 public ActionResult Edit([Bind(Include = "Id,Description,PricerPerBed")] BedType bedType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bedType).State = EntityState.Modified;
         db.SaveChanges();
         Alert("La operacion fue exitosa", Utilities.NotificationType.success);
         return(View(bedType));
     }
     Alert("Algo fallo", Utilities.NotificationType.error);
     return(View(bedType));
 }
Esempio n. 20
0
 public Room(
     Int32 _number
     , Int32 _bedNumber
     , BedType _typeOfBed
     , RoomType _typeOfRoom
     )
 {
     this.Number     = _number;
     this.BedNumber  = _bedNumber;
     this.Reserved   = false;
     this.TypeOfBeds = _typeOfBed;
     this.TypeOfRoom = _typeOfRoom;
 }
        public async Task <IActionResult> Update([FromBody] BedType bedType)
        {
            var tmp = await _propertyContext.BedTypes.SingleOrDefaultAsync(b => b.Id == bedType.Id);

            if (tmp == null)
            {
                return(NotFound(new { Message = $"Item with id {bedType.Id} not found." }));
            }
            _propertyContext.Update(bedType);
            await _propertyContext.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetItemById), new { id = bedType.Id }, null));
        }
Esempio n. 22
0
        public ActionResult Edit(BedType BedType)
        {
            if (ModelState.IsValid)
            {
                _context.Entry(BedType).State = System.Data.Entity.EntityState.Modified;
                _context.SaveChanges();

                return(RedirectToAction("index"));
            }

            ViewBag.BedTypes = _context.BedTypes.OrderBy(c => c.Name).ToList();

            return(View(BedType));
        }
Esempio n. 23
0
        // GET: BedTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BedType bedType = db.BedType.Find(id);

            if (bedType == null)
            {
                return(HttpNotFound());
            }
            return(View(bedType));
        }
        public ActionResult Delete(int id)
        {
            BedType BedType = _context.BedTypes.Find(id);

            if (BedType == null)
            {
                return(HttpNotFound());
            }

            _context.BedTypes.Remove(BedType);
            _context.SaveChanges();

            return(RedirectToAction("index"));
        }
Esempio n. 25
0
        public async Task<IHttpActionResult> Put(int id, BedTypeInputModel bedTypeInputModel)
        {
            BedType bedType = new BedType()
            {
                Id = bedTypeInputModel.Id,
                Name = bedTypeInputModel.Name,
                BedConfigCount = bedTypeInputModel.BedConfigCount,
                VehicleToBedConfigCount = bedTypeInputModel.VehicleToBedConfigCount
            };
            CommentsStagingModel comment = new CommentsStagingModel() { Comment = bedTypeInputModel.Comment };
            var attachments = SetUpAttachmentsModels(bedTypeInputModel.Attachments);
            var changeRequestId = await _bedTypeApplicationService.UpdateAsync(bedType, bedType.Id, CurrentUser.Email, comment, attachments);

            return Ok(changeRequestId);
        }
        public Room(BedType bedSize, double DailyRate, int capacity)
        {
            this.BedSize   = bedSize;
            this.Capacity  = capacity;
            this.DailyRate = DailyRate;

            /*
             * switch(this.BedSize)
             * {
             *  default:  case BedType.KB: this.Name = "Single King Bed"; break;
             *  case BedType.QB: this.Name = "Single Queen Bed"; break;
             *  case BedType.DB: this.Name = "Two Double Beds"; break;
             *  case BedType.BS: this.Name = "One Bedroom Suite"; break;
             * }
             */
        }
        public ActionResult Edit(int id)
        {
            string cookie = Request.Cookies["cookie"].Value.ToString();
            User   user   = _context.Users.Include("Group").FirstOrDefault(u => u.token == cookie);

            ViewBag.User = user;
            BedType BedType = _context.BedTypes.Find(id);

            if (BedType == null)
            {
                return(HttpNotFound());
            }

            ViewBag.BedTypes = _context.BedTypes.ToList();
            return(View(BedType));
        }
Esempio n. 28
0
 /// <summary>
 /// Default constructor of a store item
 /// </summary>
 /// <param name="name">name of item</param>
 /// <param name="id">id of item</param>
 /// <param name="price">price of item</param>
 /// <param name="room">room of item</param>
 /// <param name="colors">Color or colors of item</param>
 /// <param name="material">material or materials of item</param>
 /// <param name="bedWidth">Bed Width</param>
 /// <param name="bedLength">Bed length</param>
 /// <param name="bedType">Type of Bed</param>
 /// <param name="tp">Total Purchases</param>
 public Bed(string name, uint id, uint price, string room, Color colors, Material material, uint bedWidth, uint bedLength, BedType bedType, uint tp) : base(name, id, price, room, colors, material)
 {
     this.BedWidth        = bedWidth;
     this.BedLength       = bedLength;
     this.BedType         = bedType;
     this.TypeOfFurniture = "Bed";
     this.SetTotalPurchases(true, tp);
     if (this.BedType == BedType.Studicouch)
     {
         this.TagInt = 23;
     }
     else
     {
         this.TagInt = 13;
     }
     this.ImageLink = StoreItem.EnumMethods.imageLink(this.Colors, this.Material, "Bed", (int)this.BedType);
 }
Esempio n. 29
0
        public Room(BedType bedSize = BedType.KING, int DailyRate = 0, int capacity = 2)
        {
            this.BedSize   = bedSize;
            this.DailyRate = DailyRate;
            this.Capacity  = capacity;

            switch (this.BedSize)
            {
            default:
            case BedType.KING: this.Name = "Single King Bed"; break;

            case BedType.QUEEN: this.Name = "Single Queen Bed"; break;

            case BedType.DOUBLE: this.Name = "Two Double Beds"; break;

            case BedType.SUITE: this.Name = "One Bedroom Suite"; break;
            }
        }
        public ActionResult Create(BedType bedType)
        {
            string cookie = Request.Cookies["cookie"].Value.ToString();

            ApplicationUser user = _context.ApplicationUsers.Include("Role").FirstOrDefault(u => u.token == cookie);

            ViewBag.User = user;

            if (ModelState.IsValid)
            {
                _context.bedTypes.Add(bedType);
                _context.SaveChanges();

                return(RedirectToAction("index"));
            }

            return(View(bedType));
        }
Esempio n. 31
0
 public SweetRoom(BedType bedType,int rating, Direction direction, int numberOfBeds, string name, double area, string phone, int numberRoom)
     : base(bedType,direction, numberOfBeds, name, area, phone, numberRoom)
 {
     Rating = rating;
 }
Esempio n. 32
0
 public RegularRoom( BedType bedType,Direction direction, int numberOfBeds, string name, double area, string phone, int numberRoom)
     : base(name, area, phone, numberRoom)
 {
     Direction = direction;
     BedType = bedType;
     NumberOfBeds = numberOfBeds;
 }