Beispiel #1
0
        private void PopulateObject(Role.RoleType roleType)
        {
            HeadWaiter headW;
            Waiter     waiter;
            Runner     runner;

            employee       = new Employee(roleType);
            employee.ID    = idTextBox.Text;
            employee.EmpID = empIDTextBox.Text;
            employee.Name  = nameTextBox.Text;
            employee.Phone = phoneTextBox.Text;

            switch (employee.role.RoleValue)
            {
            case Role.RoleType.Headwaiter:
                headW        = (HeadWaiter)(employee.role);
                headW.Salary = decimal.Parse(paymentTextBox.Text);
                break;

            case Role.RoleType.Waiter:
                //***waiter to be done later for HW
                waiter                = (Waiter)(employee.role);
                waiter.Rate           = decimal.Parse(paymentTextBox.Text);
                waiter.NumberOfShifts = int.Parse(hoursTextBox.Text);
                //  waiter.Tips = decimal.Parse(tipsTextBox.Text);
                break;

            case Role.RoleType.Runner:
                //***waiter to be done later for HW
                runner                = (Runner)(employee.role);
                runner.Rate           = decimal.Parse(paymentTextBox.Text);
                runner.NumberOfShifts = int.Parse(hoursTextBox.Text);
                break;
            }
        }
Beispiel #2
0
            private SimSelection(string title, string subTitle, SimDescription me, Role.RoleType type)
                : base(title, subTitle, me, true, false)
            {
                mRole = RoleData.GetDataForCurrentWorld(type, true);

                AddColumn(new TypeColumn());
            }
Beispiel #3
0
 private void ShowAll(bool value, Role.RoleType roleType)
 {
     idLabel.Visible        = value;
     empIDLabel.Visible     = value;
     nameLabel.Visible      = value;
     phoneLabel.Visible     = value;
     paymentLabel.Visible   = value;
     idTextBox.Visible      = value;
     empIDTextBox.Visible   = value;
     nameTextBox.Visible    = value;
     phoneTextBox.Visible   = value;
     paymentTextBox.Visible = value;
     submitButton.Visible   = value;
     cancelButton.Visible   = value;
     if (!(value))
     {
         headWaitronRadioButton.Checked = false;
         waitronRadioButton.Checked     = false;
         runnerRadioButton.Checked      = false;
     }
     if ((roleType == Role.RoleType.Waiter) || (roleType == Role.RoleType.Runner) && value)
     {
         tipsLabel.Visible    = value;
         tipsTextBox.Visible  = value;
         hoursLabel.Visible   = value;
         hoursTextBox.Visible = value;
     }
     else
     {
         tipsLabel.Visible    = false;
         tipsTextBox.Visible  = false;
         hoursLabel.Visible   = false;
         hoursTextBox.Visible = false;
     }
 }
Beispiel #4
0
        protected static void CloneResidentRole(Role.RoleType type, WorldName world)
        {
            RoleData data = RoleData.GetData(type, world, true);

            if (data == null)
            {
                return;
            }

            if (data.FillRoleFrom != Role.RoleFillFrom.Townies)
            {
                return;
            }

            RoleData r = CloneRole(data, world, Role.RoleFillFrom.Residents);

            if (r == null)
            {
                return;
            }

            Dictionary <Role.RoleType, RoleData> dictionary;

            if (!RoleData.sData.TryGetValue(r.World, out dictionary))
            {
                dictionary = new Dictionary <Role.RoleType, RoleData>();
                RoleData.sData.Add(r.World, dictionary);
            }

            dictionary.Remove(r.Type);
            dictionary.Add(r.Type, r);
        }
 private void ShowAll(bool value, Role.RoleType roleType)
 {
     idLabel.Visible        = value;
     empIDLabel.Visible     = value;
     nameLabel.Visible      = value;
     phoneLabel.Visible     = value;
     paymentLabel.Visible   = value;
     idTextBox.Visible      = value;
     empIDTextBox.Visible   = value;
     nameTextBox.Visible    = value;
     phoneTextBox.Visible   = value;
     paymentTextBox.Visible = value;
     if (state == FormStates.Delete)
     {
         cancelButton.Visible = !value;
         submitButton.Visible = !value;
     }
     else
     {
         cancelButton.Visible = value;
         submitButton.Visible = value;
     }
     deleteButton.Visible = value;
     editButton.Visible   = value;
     if ((roleType == Role.RoleType.Waiter) || (roleType == Role.RoleType.Runner) && value)
     {
         shiftsLabel.Visible   = value;
         shiftsTextBox.Visible = value;
     }
     else
     {
         shiftsLabel.Visible   = false;
         shiftsTextBox.Visible = false;
     }
 }
Beispiel #6
0
        public static string GetRoleName(Role.RoleType type)
        {
            string key = null;

            switch (type)
            {
            case Role.RoleType.Bouncer:
                key = "Gameplay/Objects/Miscellaneous/VelvetRopes:BouncerRoleName";
                break;

            case Role.RoleType.GenericMerchant:
                key = "Gameplay/Objects/Register/ShoppingRegister:ConsignmentRoleRegister";
                break;

            case Role.RoleType.PetStoreMerchant:
                key = "Gameplay/Objects/Register/ShoppingRegister:PetstoreRoleRegister";
                break;

            /* This has the same translation as the Consignment Role
             * case Role.RoleType.PotionShopMerchant:
             *  key = "Gameplay/Objects/Register/ShoppingRegister:PotionShopRoleRegister";
             *  break;
             */
            default:
                key = "Gameplay/Roles/Role" + type + ":" + type + "CareerTitle";
                break;
            }

            return(Common.LocalizeEAString(key));
        }
Beispiel #7
0
 private void waitronRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     this.Text         = "Add Waiter";
     roleValue         = Role.RoleType.Waiter;
     paymentLabel.Text = "Rate";
     ShowAll(true, roleValue);
     idTextBox.Focus();
 }
Beispiel #8
0
        public int GetPayPerRole(Role.RoleType type)
        {
            int value;

            if (!mPayPerRole.TryGetValue(type, out value))
            {
                return(0);
            }

            return(value);
        }
Beispiel #9
0
        public Collection <Employee> FindByRole(Role.RoleType aRole)
        {
            Collection <Employee> matches = new Collection <Employee>();

            foreach (Employee employee in employees)
            {
                if (employee.Role.roleDescription == aRole)
                {
                    matches.Add(employee);
                }
            }
            return(matches);
        }
        public Collection <Employee> FindByRole(Role.RoleType roleVal)
        {
            Collection <Employee> matches = new Collection <Employee>();

            foreach (Employee emp in employees)
            {
                if (emp.role.RoleValue == roleVal)
                {
                    matches.Add(emp);
                }
            }
            return(matches);
        }
Beispiel #11
0
        protected SimDescription PrivateRun(IActor actor, Role.RoleType type, GameObjectHit hit)
        {
            Sim actorSim = actor as Sim;

            sFailureConditions = null;

            SimSelection sims = SimSelection.Create(Register.GetRoleName(type), Name, actorSim.SimDescription, type);

            if (sims.IsEmpty)
            {
                if (!string.IsNullOrEmpty(sFailureConditions))
                {
                    Common.DebugNotify(sFailureConditions);

                    Common.DebugWriteLog(sFailureConditions);
                }

                SimpleMessageDialog.Show(Name, Register.Localize("Select:Error"));
                return(null);
            }

            SimDescription sim = sims.SelectSingle();

            if (sim != null)
            {
                if (sim.CreatedByService != null)
                {
                    sim.CreatedByService.EndService(sim);
                }

                if (sim.AssignedRole != null)
                {
                    sim.AssignedRole.RemoveSimFromRole();
                }

                if (CriteriaItem.HasRealJob(sim))
                {
                    if (AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":EmployedPrompt", sim.IsFemale, new object[] { sim })))
                    {
                        sim.Occupation.RetireNoConfirmation();
                    }
                }
            }

            return(sim);
        }
        //Employee will always be created in a specific role -- IF NO role is assigned
        //Role will just be a generic default where role type is 0 and description is: "No Role"
        public Employee(Role.RoleType roleValue)
        {
            switch (roleValue)
            {
            case Role.RoleType.NoRole:
                role = new Role();
                break;

            case Role.RoleType.Headwaiter:
                role = new HeadWaiter();
                break;

            case Role.RoleType.Waiter:
                role = new Waiter();
                break;

            case Role.RoleType.Runner:
                role = new Runner();
                break;
            }
        }
Beispiel #13
0
 protected static void CleanupBadRole(Role.RoleType type)
 {
     try
     {
         List <Role> roles = RoleManager.GetRolesOfType(type);
         if (roles != null)
         {
             for (int i = roles.Count - 1; i >= 0; i--)
             {
                 if (roles[i] == null)
                 {
                     roles.RemoveAt(i);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Common.Exception(type.ToString(), e);
     }
 }
Beispiel #14
0
        private void headWaitronRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            // Get the sender and cast as Type RadioButton
            RadioButton HeadWaitronRb = sender as RadioButton;

            // Check to see if the UI call was initiated by the radio button and not another event
            // In this instance the InitializeComponent() triggers the the checked change event
            if (HeadWaitronRb != null)
            {
                /* If the call has been triggered by the radio button (i.e sender) ,
                 * then check if the radio button is checked and execute the appropriate code */
                if (HeadWaitronRb.Checked)
                {
                    this.Text         = "Add Head Waiter";
                    roleValue         = Role.RoleType.Headwaiter;
                    paymentLabel.Text = "Salary";
                    ShowAll(true, roleValue);
                    idTextBox.Focus();
                }
            }
        }
Beispiel #15
0
        public static bool AssignRole(SimDescription sim, Role.RoleType type, IRoleGiver target)
        {
            try
            {
                RoleData data = RoleData.GetDataForCurrentWorld(type, true);
                if (data == null)
                {
                    return(false);
                }

                Role role = Role.CreateRole(data, sim, target);
                if (role == null)
                {
                    return(false);
                }

                if ((role.Data.StartTime == role.Data.EndTime) || (data.IsValidTimeForRole()))
                {
                    role.StartRoleAlarmHandler();
                }

                RoleManager.sRoleManager.AddRole(role);

                if (target != null)
                {
                    target.CurrentRole = role;
                }

                ShowNotice(role);
            }
            catch (Exception e)
            {
                Exception(sim, e);
            }

            return(true);
        }
Beispiel #16
0
 public RoleTypeSetting(Role.RoleType type)
 {
     mType = type;
 }
        private void Add2Collection(string table)
        {
            //Declare references to a myRow object and an Employee object
            DataRow    myRow = null;
            Employee   anEmp;
            HeadWaiter headw;
            Waiter     waiter;
            Runner     runner;

            Role.RoleType roleValue = Role.RoleType.NoRole;  //Declare roleValue and initialise
            switch (table)
            {
            case "HeadWaiter":
                roleValue = Role.RoleType.Headwaiter;
                break;

            case "Waiter":
                roleValue = Role.RoleType.Waiter;
                break;

            case "Runner":
                roleValue = Role.RoleType.Runner;
                break;
            }
            //READ from the table
            foreach (DataRow myRow_loopVariable in dsMain.Tables[table].Rows)
            {
                myRow = myRow_loopVariable;
                if (!(myRow.RowState == DataRowState.Deleted))
                {
                    //Instantiate a new Employee object
                    anEmp = new Employee(roleValue);
                    //Obtain each employee attribute from the specific field in the row in the table
                    anEmp.ID = Convert.ToString(myRow["ID"]).TrimEnd();
                    //Do the same for all other attributes
                    anEmp.EmpID = Convert.ToString(myRow["EmpID"]).TrimEnd();
                    //***The code below shows thee test for database Null values
                    if (myRow["Name"] == System.DBNull.Value)
                    {
                        anEmp.Name = "";
                    }
                    else
                    {
                        anEmp.Name = Convert.ToString(myRow["Name"]).TrimEnd();
                    }
                    anEmp.Phone          = Convert.ToString(myRow["Phone"]).TrimEnd();
                    anEmp.role.RoleValue = (Role.RoleType)Convert.ToByte(myRow["Role"]);
                    //Depending on Role read more Values
                    switch (anEmp.role.RoleValue)
                    {
                    case Role.RoleType.Headwaiter:
                        headw        = (HeadWaiter)anEmp.role;
                        headw.Salary = Convert.ToDecimal(myRow["Salary"]);
                        break;

                    case Role.RoleType.Waiter:
                        waiter                = (Waiter)anEmp.role;
                        waiter.Rate           = Convert.ToDecimal(myRow["DayRate"]);
                        waiter.NumberOfShifts = Convert.ToInt32(myRow["NoOfShifts"]);
                        break;

                    case Role.RoleType.Runner:
                        runner                = (Runner)anEmp.role;
                        runner.Rate           = Convert.ToDecimal(myRow["DayRate"]);
                        runner.NumberOfShifts = Convert.ToInt32(myRow["NoOfShifts"]);
                        break;
                    }
                    employees.Add(anEmp);
                }
            }
        }
Beispiel #18
0
 public PayPerRole(Role.RoleType type)
 {
     mType = type;
 }
Beispiel #19
0
            public static SimSelection Create(string title, string subTitle, SimDescription me, Role.RoleType type)
            {
                SimSelection selection = new SimSelection(title, subTitle, me, type);

                List <ICriteria> criteria = new List <ICriteria>();

                foreach (IRoleCriteria crit in Common.DerivativeSearch.Find <IRoleCriteria>())
                {
                    criteria.Add(crit);
                }

                bool canceled;

                selection.FilterSims(criteria, null, false, out canceled);
                return(selection);
            }
Beispiel #20
0
 public void SetPayPerRole(Role.RoleType type, int value)
 {
     mPayPerRole[type] = value;
 }
Beispiel #21
0
        public static string GetRoleName(Role.RoleType type)
        {
            string key = null;

            switch (type)
            {
            case Role.RoleType.Bartender:
                key = "Gameplay/Roles/RoleBartender:BartenderCareerTitle";
                break;

            case Role.RoleType.Bouncer:
                key = "Gameplay/Objects/Miscellaneous/VelvetRopes:BouncerRoleName";
                break;

            case Role.RoleType.Explorer:
                key = "Gameplay/Roles/RoleExplorer:Explorer";
                break;

            case Role.RoleType.GenericMerchant:
                key = "Gameplay/Objects/Register/ShoppingRegister:ConsignmentRoleRegister";
                break;

            case Role.RoleType.LocationMerchant:
                key = "Gameplay/Roles/RoleLocationMerchant:LocationMerchantCareerTitle";
                break;

            case Role.RoleType.Paparazzi:
                key = "Gameplay/Roles/RolePaparazzi:PaparazziCareerTitle";
                break;

            case Role.RoleType.Pianist:
                key = "Gameplay/Roles/RolePianist:PianistCareerTitle";
                break;

            case Role.RoleType.SpecialMerchant:
                key = "Gameplay/Roles/RoleSpecialMerchant:SpecialMerchantCareerTitle";
                break;

            case Role.RoleType.Stylist:
                key = "Gameplay/Roles/RoleStylist:StylistCareerTitle";
                break;

            case Role.RoleType.TattooArtist:
                key = "Gameplay/Roles/RoleTattooArtist:TattooArtistCareerTitle";
                break;

            case Role.RoleType.Tourist:
                key = "Gameplay/Roles/RoleTourist:Tourist";
                break;
            }

            if (key == null)
            {
                return(null);
            }

            string title;

            if (!Localization.GetLocalizedString(key, out title))
            {
                title = key;
            }

            return(title);
        }
Beispiel #22
0
        public static bool IsSimValidForAnyRole(IMiniSimDescription iSim, Role.RoleType role, out string reason)
        {
            SimDescription sim = iSim as SimDescription;

            if (sim != null)
            {
                if (!sim.IsValidDescription)
                {
                    reason = "IsValidDescription Fail";
                    return(false);
                }

                if (SimTypes.InCarPool(sim))
                {
                    reason = "InCarPool";
                    return(false);
                }

                if (SimTypes.InServicePool(sim))
                {
                    reason = "InServicePool";
                    return(false);
                }

                if (SimTypes.IsServiceAlien(sim))
                {
                    reason = "IsServiceAlien";
                    return(false);
                }

                if (SimTypes.IsDead(sim))
                {
                    reason = "Dead";
                    return(false);
                }

                if (sim.Household != null)
                {
                    if (sim.Household.IsPreviousTravelerHousehold)
                    {
                        reason = "PreviousTravelerHousehold";
                        return(false);
                    }

                    if ((role != Role.RoleType.Tourist) && (role != Role.RoleType.Explorer))
                    {
                        if (sim.Household.IsTouristHousehold)
                        {
                            reason = "Tourist";
                            return(false);
                        }
                    }
                }
            }
            else
            {
                MiniSimDescription miniSim = iSim as MiniSimDescription;
                if (miniSim != null)
                {
                    if (!Role.IsSimValidForAnyRole(miniSim))
                    {
                        reason = "IsSimValidForAnyRole Fail";
                        return(false);
                    }
                }
                else
                {
                    reason = "MiniSim Fail";
                    return(false);
                }
            }

            reason = "Success";
            return(true);
        }
Beispiel #23
0
        public static bool IsSimValidForAnyRole(IMiniSimDescription iSim, Role.RoleType role)
        {
            string reason = null;

            return(IsSimValidForAnyRole(iSim, role, out reason));
        }