Example #1
0
        /// <summary>
        /// Sets chairtype based on Room
        /// Example: A livingroom chair has armchair as its type
        /// </summary>
        /// <param name="room">Prefered room of item</param>
        private void SetChairType(string room)
        {
            if (room.Equals("Bedroom"))
            {
                this.ChairType = ChairType.DeskChair;
                this.TagInt    = 11;
                return;
            }
            else if (room.Equals("Livingroom"))
            {
                this.ChairType = ChairType.ArmChair;
                this.TagInt    = 21;

                return;
            }
            else if (room.Equals("Outdoors"))
            {
                this.ChairType = ChairType.LawnChair;
                this.TagInt    = 41;
                return;
            }
            else if (room.Equals("Kitchen"))
            {
                this.ChairType = ChairType.KitchenChair;
                this.TagInt    = 31;

                return;
            }
        }
Example #2
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");
        }
Example #3
0
 public Chair(ChairType type, int chairId, int number, int row)
 {
     ChairType = type;
     ChairId   = chairId;
     Number    = number;
     Row       = row;
 }
Example #4
0
 /// <summary>
 /// initializes a new instance of the <see cref="Chair"/> class (constructer)
 /// </summary>
 /// <param name="type">Type of base Object, which is always Chair</param>
 /// <param name="prefab">Prefab of the Table</param>
 /// <param name="chairType">ChairType</param>
 /// <param name="defaultY">default Y coordinate of the object</param>
 public Chair(ObjType type, UnityEngine.Object prefab, float defaultY, bool connectsToNeighbors, ChairType chairType) : base(type, prefab, defaultY, connectsToNeighbors)
 {
     this.type                = chairType;
     this.prefab              = prefab;
     this.defaultY            = defaultY;
     this.connectsToNeighbors = connectsToNeighbors;
 }
Example #5
0
    /// <summary>
    /// does the same thing as the constructer, except will create instances of it's subclasses
    /// </summary>
    /// <returns>the created instance returned from the constructer</returns>
    /// <param name="type">ObjType, which is the type of the object used to define the subclass</param>
    /// <param name="prefab">Prefab of the Object</param>
    /// <param name="defaultY">default Y coordinate of the object</param>
    public static Object CreateInstance(ObjType type, UnityEngine.Object prefab, float defaultY, bool connectsToNeighbors, string subType = null)
    {
        Object obj;

        switch (type)
        {
        case ObjType.Wall:
            WallType edgeType = WallType.Default;
            foreach (WallType subEdgeType in Enum.GetValues(typeof(WallType)))
            {
                if (subType == subEdgeType.ToString())
                {
                    edgeType = subEdgeType;
                }
            }
            if (edgeType == WallType.Default)
            {
                Debug.Log("CreateInstance: There was a wall with WallType.Default, meaning it is probably an unadded or unrecognized wall. It will still be created, but probably need to be added to the rest of the system. It's type was " + subType + ".");
            }
            obj = new Wall(type, prefab, defaultY, connectsToNeighbors, edgeType);
            break;

        case ObjType.Table:
            TableType tableType = TableType.Default;
            foreach (TableType subTableType in Enum.GetValues(typeof(TableType)))
            {
                if (subType == subTableType.ToString())
                {
                    tableType = subTableType;
                }
            }
            if (tableType == TableType.Default)
            {
                Debug.Log("CreateInstance: There was an table with TableType.Default, meaning it is probably an unadded or unrecognized table. It will still be created, but probably need to be added to the rest of the system. It's type was " + subType + ".");
            }
            obj = new Table(type, prefab, defaultY, connectsToNeighbors, tableType);
            break;

        case ObjType.Chair:
            ChairType chairType = ChairType.Default;
            foreach (ChairType subChairType in Enum.GetValues(typeof(ChairType)))
            {
                if (subType == subChairType.ToString())
                {
                    chairType = subChairType;
                }
            }
            if (chairType == ChairType.Default)
            {
                Debug.Log("CreateInstance: There was an chair with ChairType.Default, meaning it is probably an unadded or unrecognized chair. It will still be created, but probably need to be added to the rest of the system. It's type was " + subType + ".");
            }
            obj = new Chair(type, prefab, defaultY, connectsToNeighbors, chairType);
            break;

        default:
            obj = new Object(type, prefab, defaultY, connectsToNeighbors);
            break;
        }
        return(obj);
    }
Example #6
0
 public static void AddChairData(int itemId, Direction direction, ChairType chairType)
 {
     if (_chairs.ContainsKey(itemId))
     {
         _chairs.Remove(itemId);
     }
     _chairs.Add(itemId, new ChairData(itemId, direction, chairType));
 }
Example #7
0
 public static void AddChairData(int itemID, Direction direction, ChairType chairType)
 {
     if (m_Chairs.ContainsKey(itemID))
     {
         m_Chairs.Remove(itemID);
     }
     m_Chairs.Add(itemID, new ChairData(itemID, direction, chairType));
 }
Example #8
0
 /// <summary>
 /// Creates a new chair data object.
 /// </summary>
 /// <param name="itemId">ItemID of the chair.</param>
 /// <param name="facing">The valid facing of the chair. Must be North, West, South, or East.</param>
 /// <param name="chairType">Whether the chair is a single facing (chair) reversible facing (bench) or any facing (stool) object.</param>
 public ChairData(int itemId, Direction facing, ChairType chairType)
 {
     ItemID             = itemId;
     Facing             = facing;
     ChairType          = chairType;
     SittingPixelOffset = TileData.ItemData[itemId].Unknown4;
     if (SittingPixelOffset > 32)
     {
         SittingPixelOffset -= 32;
     }
 }
Example #9
0
 public BoardParameters(
     ChairType chairType,
     MemberParameterCollection chair,
     List <MemberParameterCollection> technicals,
     List <MemberParameterCollection> legals)
 {
     ChairType  = chairType;
     Chair      = chair;
     Technicals = technicals;
     Legals     = legals;
 }
Example #10
0
        public bool UpdateChairTypes(IConnectionHandler connectionHandler, IConnectionHandler reservationConnection, Hall hall, List <Guid> userregistertype)
        {
            var userRegisterPaymentTypeBo    = new UserRegisterPaymentTypeBO();
            var chairTypeTransactionalFacade =
                ReservationComponent.Instance.ChairTypeTransactionalFacade(reservationConnection);
            var chairTypes = chairTypeTransactionalFacade.Where(x => x.HallId == hall.Id);
            var types      = userRegisterPaymentTypeBo.Where(connectionHandler, x => x.Id.In(userregistertype));

            foreach (var guid in userregistertype)
            {
                var paymentType = types.FirstOrDefault(x => x.Id == guid);
                if (paymentType == null)
                {
                    continue;
                }
                var byRefId = chairTypeTransactionalFacade.FirstOrDefault(x => x.HallId == hall.Id && x.RefId == paymentType.Id.ToString());
                if (byRefId == null)
                {
                    var chairType =
                        new ChairType {
                        RefId = paymentType.Id.ToString(), Title = paymentType.Title, HallId = hall.Id, CurrentUICultureName = hall.CurrentUICultureName
                    };
                    if (!chairTypeTransactionalFacade.Insert(chairType))
                    {
                        throw new Exception("خطایی در ذخیره سالن وجود دارد");
                    }
                }
                else
                {
                    byRefId.Title = paymentType.Title;
                    byRefId.CurrentUICultureName = hall.CurrentUICultureName;
                    if (!chairTypeTransactionalFacade.Update(byRefId))
                    {
                        throw new Exception("خطایی در ذخیره سالن وجود دارد");
                    }
                }
            }
            foreach (var chairType in chairTypes)
            {
                if (userregistertype.Any(x => x == chairType.RefId.ToGuid()))
                {
                    continue;
                }
                if (!chairTypeTransactionalFacade.Delete(chairType.Id))
                {
                    throw new Exception("خطایی در ذخیره سالن وجود دارد");
                }
            }
            return(true);
        }
Example #11
0
 public string ExecuteChairType(string data)
 {
     try
     {
         DataTable dt         = new DataTable();
         ChairType dataDetail = JsonConvert.DeserializeObject <ChairType>(data);
         using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
         {
             dt = connFunc.ExecuteDataTable("[YYY_sp_Cinema_ChairType_Update]", CommandType.StoredProcedure,
                                            "@Chair", SqlDbType.Int, dataDetail.IDChair,
                                            "@Type", SqlDbType.Int, dataDetail.Type
                                            );
         }
         return(JsonConvert.SerializeObject(dt));
     }
     catch (Exception ex)
     {
         return("0");
     }
 }
Example #12
0
        public ActionResult Create(FormCollection collection)
        {
            var chairType = new ChairType();

            try
            {
                this.RadynTryUpdateModel(chairType);
                chairType.CurrentUICultureName = collection["LanguageId"];
                if (ReservationComponent.Instance.ChairTypeFacade.Insert(chairType))
                {
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle,
                                messageIcon: MessageIcon.Succeed);
                    return(Redirect("~/Reservation/ChairType/Index"));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle,
                            messageIcon: MessageIcon.Error);
                return(Redirect("~/Reservation/ChairType/Index"));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                return(View(chairType));
            }
        }
Example #13
0
        /// <summary>
        /// Creating a Image link based on Color material and Type of furniture
        /// </summary>
        /// <param name="color">Color of furniture</param>
        /// <param name="material">Material of furniture</param>
        /// <param name="type">Type of furniture</param>
        /// <param name="typeInt">A integer for identifying the type</param>
        /// <returns></returns>
        public static string imageLink(Color color, Material material, string type, int typeInt)
        {
            string ColorString    = Enum.GetName(typeof(Color), color);
            string MaterialString = Enum.GetName(typeof(Material), material);
            string TypeString     = "";

            if (type.Equals("Chair"))
            {
                ChairType ct = (ChairType)typeInt;
                TypeString = Enum.GetName(typeof(ChairType), ct);
            }
            else if (type.Equals("Table"))
            {
                TableType tt = (TableType)typeInt;
                TypeString = Enum.GetName(typeof(TableType), tt);
            }
            else if (type.Equals("Bed"))
            {
                BedType bt = (BedType)typeInt;
                TypeString = Enum.GetName(typeof(BedType), bt);
            }

            return($"{ColorString}_{MaterialString}_{TypeString}.jpg");
        }
Example #14
0
            /// <summary>
            /// Creates a new chair data object.
            /// </summary>
            /// <param name="itemID">ItemID of the chair.</param>
            /// <param name="facing">The valid facing of the chair. Must be North, West, South, or East.</param>
            /// <param name="chairType">Whether the chair is a single facing (chair) reversible facing (bench) or any facing (stool) object.</param>
            public ChairData(int itemID, Direction facing, ChairType chairType)
            {
                ItemID = itemID;
                Facing = facing;
                ChairType = chairType;

                SittingPixelOffset = TileData.ItemData[itemID].Unknown4;
                if (SittingPixelOffset > 32)
                    SittingPixelOffset = SittingPixelOffset - 32;
            }
Example #15
0
 public static void AddChairData(int itemID, Direction direction, ChairType chairType)
 {
     if (m_Chairs.ContainsKey(itemID))
         m_Chairs.Remove(itemID);
     m_Chairs.Add(itemID, new ChairData(itemID, direction, chairType));
 }
 public Chair(string model, string material, decimal price, decimal height, int numberOfLegs)
     : base(model, material, price, height)
 {
     this.NumberOfLegs = numberOfLegs;
     this.type         = ChairType.Chair;
 }