public MainMenuScreen(Game Game)
            : base(Game, GeneralManager.ScreenX, GeneralManager.ScreenY)
        {
            NewGameButton            = new Button(GeneralManager.GetPartialRect(0, 0.4f, 0.2f, 0.1f), " New Game ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]);
            NewGameButton.Action     = NewGameButtonClick;
            NewGameButton.TextOffset = new Vector2(0, 10);

            LoadGameButton            = new Button(GeneralManager.GetPartialRect(0, 0.5f, 0.2f, 0.1f), " Load Game ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]);
            LoadGameButton.Action     = NewGameButtonClick;
            LoadGameButton.TextOffset = new Vector2(0, 10);

            OptionsButton            = new Button(GeneralManager.GetPartialRect(0, 0.6f, 0.2f, 0.1f), "  Options  ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]);
            OptionsButton.Action     = NewGameButtonClick;
            OptionsButton.TextOffset = new Vector2(0, 10);

            CreditsButton            = new Button(GeneralManager.GetPartialRect(0, 0.7f, 0.2f, 0.1f), "  Credits  ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]);
            CreditsButton.Action     = NewGameButtonClick;
            CreditsButton.TextOffset = new Vector2(0, 10);

            ExitButton            = new Button(GeneralManager.GetPartialRect(0, 0.8f, 0.2f, 0.1f), "    Exit    ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]);
            ExitButton.Action     = ExitGameButtonClick;
            ExitButton.TextOffset = new Vector2(0, 10);

            this.AddGUI(NewGameButton);
            this.AddGUI(LoadGameButton);
            this.AddGUI(OptionsButton);
            this.AddGUI(CreditsButton);
            this.AddGUI(ExitButton);

            BSS             = new BlackScreenSwitch();
            BSS.SwitchState = SceneSwitchEffect.State.SwitchOn;

            Renderer.AddPostProcess(BSS, "Switch");
            m = SoundEngine.PlayLooped("Content/Sounds/Ambient/menu_theme.mp3");
        }
Example #2
0
 void HandleRunEvent(RunPhase phase, float time)
 {
     if (phase == RunPhase.Start)
     {
         startTime = time;
     }
     else if (phase == RunPhase.Goal)
     {
         endTime = time;
         float score = this.score;
         if (GeneralManager.HasBirdRunRecord())
         {
             uiRecords.ShowBirdRunnerResult(score, GeneralManager.GetBirdRunRecord());
         }
         else
         {
             uiRecords.ShowBirdRunnerResult(score);
         }
         if (GeneralManager.IsPersonalBirdRunRecord(score))
         {
             GeneralManager.SetBirdRunRecord(score);
         }
         GeneralManager.RecentRunBirdingXRunning = score;
     }
 }
Example #3
0
 new void Awake()
 {
     generalManager     = GeneralManager.GetInstance();
     workspaceEditor    = WorkspaceEditor.GetInstance();
     canvasManager      = CanvasManager.GetInstance();
     contextMenuManager = ContextMenuManager.GetInstance();
 }
Example #4
0
        public Chest(Rectangle r, Map m)
            : base(m)
        {
            Body BodyDec = new Body(m.PhysicalWorld);

            BodyDec.BodyType = BodyType.Static;

            PolygonShape S = new PolygonShape(1f);

            S.SetAsBox(r.Width / 2, r.Height / 2);

            Fixture             = BodyDec.CreateFixture(S);
            Fixture.Restitution = 1f;
            Fixture.Friction    = 10f;

            Position = r;

            SetName("Chest");

            items = new List <Item>();

            ChestWindow       = new Window(GeneralManager.GetPartialRect(0.4f, 0.2f, 0.2f, 0.6f));
            ChestWindow.BgTex = GeneralManager.Textures["GUI/InGameGUI/ChestMenuBg"];

            ChestWindow.Visible = false;

            CloseButton        = new Button(new Rectangle(ChestWindow.Position.Width - 32, 8, 24, 24), "", GeneralManager.Textures["GUI/InGameGUI/CloseButton"], Color.Gray, Color.White, null);
            CloseButton.Action = CloseChestWindow;
            ChestWindow.AddGUI(CloseButton);

            list = new ListBox(new Rectangle(16, 16, ChestWindow.Position.Width - 24, ChestWindow.Position.Height - 32));
            ChestWindow.AddGUI(list);

            Map.Parent.AddGUI(ChestWindow);
        }
        public async Task <IActionResult> TransferHost(
            [FromBody] TransferHost.Request req, [FromServices] GeneralManager gm)
        {
            var res = new TransferHost.Response();

            await gm.EnqueueJob(async() =>
            {
                var group = gm.PremadeGroupManager.GetBelongs(req.playerIdSrc.Value);
                if (group == null)
                {
                    res.resultCode = ProtocolModels.PremadeGroup.TransferHost.Response.ResultCode.NotGroup;
                    return;
                }
                if (group.LeaderPlayerId != req.playerIdSrc)
                {
                    res.resultCode = ProtocolModels.PremadeGroup.TransferHost.Response.ResultCode.NotLeader;
                    return;
                }

                var members = gm.PremadeGroupManager.TransferLeader(req.playerIdSrc.Value, req.playerIdDst.Value);
                for (int i = 0; i < members.Count; i++)
                {
                    var player = members[i];
                    await new ConnectionQueue(player.SessionId).EnqueueAsync(
                        gm.CreatePremadeGroupQueueData(player.PlayerId)
                        );
                }

                res.resultCode = ProtocolModels.PremadeGroup.TransferHost.Response.ResultCode.Ok;
            });

            return(Ok(res));
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtDuedate.Text))
            {
                jobSample.date_admin_sent_to_cus = null;
            }
            else
            {
                jobSample.date_admin_sent_to_cus = CustomUtils.converFromDDMMYYYY(txtDuedate.Text);
            }
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Report Date"),
                //job_remark = txtRemark.Text,
                is_active = "0",
                date      = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
        private async void DeletePaper(PaperDataListItem paperListItem)
        {
            if (Messages.ShowQuestion("Are you sure you want to delete this Paper?", "Hold On", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
            {
                return;
            }

            bool isDeleted = await GeneralManager.RemovePaper(paperListItem.PaperCode);

            try
            {
                if (isDeleted)
                {
                    containerFlowPanel.Controls.Remove(paperListItem);

                    if (GeneralManager.GetExamPapers.GetPapers.Count == 0)
                    {
                        if (!containerFlowPanel.Controls.Contains(emptyListLabel))
                        {
                            containerFlowPanel.Controls.Add(emptyListLabel);
                        }

                        emptyListLabel.Visible = true;
                    }

                    await LSTM.SavePapers(GeneralManager.GetExamPapers);
                }
            }
            catch (Exception ex)
            {
                Messages.ShowError(ex.Message);
            }
        }
Example #8
0
        static void Main()
        {
            var headChef       = new HeadChef("Thiago");
            var kitchenManager = new KitchenManager("Jonathan");
            var generalManager = new GeneralManager("Yuliya");
            var restaurant     = new CORPizzaRestaurant.PizzaRestaurant(headChef, kitchenManager, generalManager);

            Console.WriteLine("===========================");
            Console.WriteLine("==      WELCOME TO       ==");
            Console.WriteLine("== Buona Sera Restaurant ==");
            Console.WriteLine("== Order Approval System ==");
            Console.WriteLine("===========================\n\n");

            Console.WriteLine("== Current hierarchy ==\n");
            foreach (var employee in restaurant.GetHierarchy())
            {
                Console.WriteLine($"{employee.Item1} as {employee.Item2.Name}");
            }

            Console.WriteLine("\n");

            Console.WriteLine("== Order Approvals ==\n");
            var ordersToApprove = new[] { 1000, 150, 250, 10, 5000, 450, 600, 75, 50 };
            var approvals       = restaurant.ProcessOrders(ordersToApprove);

            for (var orderNumber = 1; orderNumber <= ordersToApprove.Length; orderNumber++)
            {
                Console.WriteLine($"Order no {orderNumber}\nTotal cost: {ordersToApprove[orderNumber-1]}\n{approvals[orderNumber-1]}\n");
            }

            Console.ReadKey();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Remove Delete
            switch (CommandName)
            {
            case CommandNameEnum.Add:
                objJobInfo.Insert();
                break;

            case CommandNameEnum.Edit:
                foreach (job_sample s in this.listSample)
                {
                    s.job_status    = Convert.ToInt16(ddlStatus.SelectedValue);
                    s.sample_prefix = ddlJobNumber.SelectedItem.Text;
                    s.update_by     = userLogin.id;
                    s.update_date   = DateTime.Now;
                }

                objJobInfo.Update();
                break;
            }
            //Commit
            GeneralManager.Commit();
            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
Example #10
0
        static void Main(string[] args)
        {
            //Create the chain links

            Approver jennifer = new HeadChef();
            Approver mitchell = new PurchasingManager();
            Approver olivia   = new GeneralManager();

            //Create the chain
            jennifer.SetSupervisor(mitchell);
            mitchell.SetSupervisor(olivia);

            // Generate and process purchase requests
            PurchaseOrder p = new PurchaseOrder(1, 20, 69, "Spices");

            jennifer.ProcessRequest(p);

            p = new PurchaseOrder(2, 300, 1389, "Fresh Veggies");
            jennifer.ProcessRequest(p);

            p = new PurchaseOrder(3, 500, 4823.99, "Beef");
            jennifer.ProcessRequest(p);

            p = new PurchaseOrder(4, 4, 12099, "Ovens");
            jennifer.ProcessRequest(p);

            // Wait for user
            Console.ReadKey();
        }
        protected void gvResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            CommandNameEnum cmd = (CommandNameEnum)Enum.Parse(typeof(CommandNameEnum), e.CommandName, true);

            this.CommandName = cmd;
            switch (cmd)
            {
            case CommandNameEnum.Edit:
            case CommandNameEnum.View:
                this.PKID = int.Parse(e.CommandArgument.ToString().Split(Constants.CHAR_COMMA)[0]);
                Server.Transfer(Constants.LINK_TEMPLATE);
                break;

            case CommandNameEnum.Inactive:
                this.PKID = int.Parse(e.CommandArgument.ToString().Split(Constants.CHAR_COMMA)[0]);
                m_template template = new m_template().SelectByID(this.PKID);
                if (template != null)
                {
                    template.status = "I";
                    template.Update();
                    GeneralManager.Commit();

                    bindingData();
                }
                break;
            }
        }
//請假2天內 經理批准
//請假5天內 協理批准
//請假7天內 總經理批准
//7天以上   不批准
    void Start()
    {
        Manager        a1 = new Manager("阿福");        // 經理
        Director       a2 = new Director("技安");       // 協理
        GeneralManager a3 = new GeneralManager("宜靜"); // 總經理

        a1.SetUpManager(a2);                          // 設定經理的上級為協理
        a2.SetUpManager(a3);                          // 設定協理的上級為總經理

        // 假單初始化
        LeaveRequest leaveRequest = new LeaveRequest(); // 假單

        leaveRequest.Name = "大雄";                       // 員工姓名

        leaveRequest.DayNum = 1;                        // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出1天的假單

        leaveRequest.DayNum = 3;                        // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出3天的假單

        leaveRequest.DayNum = 7;                        // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出7天的假單

        leaveRequest.DayNum = 10;                       // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出10天的假單
    }
Example #13
0
        public static void ChainOfResponsibility()
        {
            //Create the chain links
            Approver jennifer = new HeadChef();
            Approver mitchell = new PurchasingManager();
            Approver olivia   = new GeneralManager();

            //Create the chain
            jennifer.SetSupervisor(mitchell);
            mitchell.SetSupervisor(olivia);

            // Generate and process purchase requests
            PurchaseOrder p = new PurchaseOrder(1, 20, 69, "Spices");

            jennifer.ProcessRequest(p);

            p = new PurchaseOrder(2, 300, 1389, "Fresh Veggies");
            jennifer.ProcessRequest(p);

            p = new PurchaseOrder(3, 500, 4823.99, "Beef");
            jennifer.ProcessRequest(p);

            p = new PurchaseOrder(4, 4, 12099, "Ovens");
            jennifer.ProcessRequest(p);
        }
Example #14
0
        public async Task <IActionResult> ReportAcceptPlayer(
            [FromBody] ReportAcceptPlayer.Request req, [FromServices] GeneralManager gm)
        {
            var res = new ReportAcceptPlayer.Response
            {
                allowed  = false,
                playerId = -1,
                rating   = 0,
                side     = Battle.Side.Other,
            };

            await gm.EnqueueJob(() =>
            {
                var player = gm.MatchManager.AcceptPlayer(req.battleServerSessionId, req.joinPassword);
                if (player != null)
                {
                    res.allowed  = true;
                    res.playerId = player.PlayerId;
                    res.rating   = player.Rating;
                    res.side     = player.Side;
                }
            });

            return(Ok(res));
        }
Example #15
0
        public void Insert()
        {
            _repository.Add(this);
            GeneralManager.Commit();

            job_running.IncrementRunning(this.job_prefix);

            foreach (job_sample sample in this.jobSample)
            {
                sample.job_id = this.ID;

                switch (sample.RowState)
                {
                case CommandNameEnum.Add:
                    sample.Insert();
                    break;

                case CommandNameEnum.Edit:
                    sample.Update();
                    break;

                case CommandNameEnum.Delete:
                    sample.Delete();
                    break;
                }
            }
        }
Example #16
0
 new void Awake()
 {
     gm         = GeneralManager.GetInstance();
     bb         = BreadBoard.GetInstance();
     cp         = CircuitPool.GetInstance();
     fabricator = Fabricator.GetInstance();
 }
 void HandleRunEvent(RunPhase phase, float time)
 {
     if (phase == RunPhase.Start)
     {
         startTime = time;
     }
     else if (phase == RunPhase.Goal)
     {
         endTime = time;
         float runTime = endTime - startTime;
         if (GeneralManager.HasRunRecord())
         {
             uiRecords.ShowRunnerResult(runTime, GeneralManager.GetRunTimeRecord());
         }
         else
         {
             uiRecords.ShowRunnerResult(runTime);
         }
         if (GeneralManager.IsPersonalRunRecord(runTime))
         {
             GeneralManager.SetRunRecord(runTime);
         }
         GeneralManager.RecentRunTime = runTime;
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.jobSample.other_ref_no = txtOtherRefNo.Text;
            if (Constants.OTHER_REF_NOS.Contains(this.jobSample.other_ref_no.Trim()))
            {
                this.jobSample.due_date_lab = new DateTime(1, 1, 1);
            }
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Other Ref no."),
                //job_remark = txtRemark.Text,
                is_active = "0",
                date      = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            switch (CommandName)
            {
            case CommandNameEnum.ChangeStatus:

                this.jobSample.job_status = String.IsNullOrEmpty(ddlStatus.SelectedValue) ? 0 : int.Parse(ddlStatus.SelectedValue);
                if (this.jobSample.job_status == 10)
                {    //if change status to convert template
                    this.jobSample.template_id = -1;
                    this.jobSample.path_word   = String.Empty;
                    this.jobSample.path_pdf    = String.Empty;
                }
                if (this.jobSample.job_status == 13)
                {    //if change status to convert word
                    this.jobSample.path_word = String.Empty;
                    this.jobSample.path_pdf  = String.Empty;
                }
                this.jobSample.Update();
                break;
            }
            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
Example #20
0
        static void Main()
        {
            GeneralManager o = new GeneralManager("abc", "CEO", "dhanashri", 40000, 01);

            Console.WriteLine(o.CalcNetSalary());
            Console.ReadLine();
        }
Example #21
0
        bool OnSensorCollide(Fixture fixtureA, Fixture fixtureB, Contact contact)
        {
            if (Vector2.Distance(PlayerSensor.Body.Position, Fixture.Body.Position) <= 60)
            {
                if (fixtureA == PlayerSensor)
                {
                    if (fixtureB.UserData != null)
                    {
                        (fixtureB.UserData as Entity).Sensor(this);
                    }
                }

                if (GeneralManager.CheckKeyEdge(Keys.E))
                {
                    if (fixtureA == PlayerSensor)
                    {
                        if (fixtureB.UserData != null)
                        {
                            (fixtureB.UserData as Entity).PlayerUse(this);
                        }
                    }
                    else
                    {
                        if (fixtureA.UserData != null)
                        {
                            (fixtureA.UserData as Entity).PlayerUse(this);
                        }
                    }
                }
            }

            return(false);
        }
Example #22
0
        protected void Page_Fill()
        {
            RolesTable.DataSource = SystemLists.User.Roles.Where(x => x != Role.AllRoles && x != Role.Unknown).ToList();
            var departments = new GeneralManager().GetDepartments(Settings.GetCompanyName());

            selectDepartment.DataSource = departments;
            selectDepartment.DataBind();

            if (EdittedUser.Department == null)
            {
                EdittedUser.Department = departments.First();
            }

            selectDepartment.SelectItem(EdittedUser.Department.ID.ToString());

            if ((EdittedUser.Photo?.ID ?? 0) != 0)
            {
                if (!string.IsNullOrWhiteSpace(EdittedUser.Photo.FileName))
                {
                    UserPhoto.ImageUrl = EdittedUser.Photo.FileName;
                }
            }

            DataBind();
        }
 private void HandleRunEvent(RunPhase phase, float time)
 {
     if (phase == RunPhase.Start)
     {
         currentStartTime = time;
         bool             show  = GeneralManager.HasRun();
         SpriteRenderer[] rends = GetComponentsInChildren <SpriteRenderer>();
         for (int i = 0; i < rends.Length; i++)
         {
             rends[i].enabled = show;
         }
     }
     else if (phase == RunPhase.Goal)
     {
         currentGoalTime = time;
         float currentTime = currentGoalTime - currentStartTime;
         if (GeneralManager.IsPersonalRunRecord(currentTime))
         {
             GeneralManager.SetRunRecording(currentRun);
         }
         currentRun.Clear();
         SpriteRenderer[] rends = GetComponentsInChildren <SpriteRenderer>();
         for (int i = 0; i < rends.Length; i++)
         {
             rends[i].enabled = false;
         }
     }
 }
Example #24
0
    static void Main(string[] args)
    {
        // 管理者初始化
        Manager        a1 = new Manager("阿福");        // 經理
        Director       a2 = new Director("技安");       // 協理
        GeneralManager a3 = new GeneralManager("宜靜"); // 總經理

        a1.SetUpManager(a2);                          // 設定經理的上級為協理
        a2.SetUpManager(a3);                          // 設定協理的上級為總經理

        // 假單初始化
        LeaveRequest leaveRequest = new LeaveRequest(); // 假單

        leaveRequest.Name = "大雄";                       // 員工姓名

        leaveRequest.DayNum = 1;                        // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出1天的假單

        leaveRequest.DayNum = 3;                        // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出3天的假單

        leaveRequest.DayNum = 7;                        // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出7天的假單

        leaveRequest.DayNum = 10;                       // 請假天數
        a1.RequestPersonalLeave(leaveRequest);          // 送出10天的假單

        Console.Read();
    }
    public void StartNextTurn()
    {
        if (isSingleplayer)
        {
            team = !team;
        }

        currentMana = GeneralManager.MAX_MANA;

        GeneralManager.GamePiece p1 = GeneralManager.gameBoard.GetPieceAtPosition(new Vector2Int(GeneralManager.MANA_BOOST_X1, GeneralManager.MANA_BOOST_Y1));
        GeneralManager.GamePiece p2 = GeneralManager.gameBoard.GetPieceAtPosition(new Vector2Int(GeneralManager.MANA_BOOST_X2, GeneralManager.MANA_BOOST_Y2));

        if (p1 != null && p1.team == team)
        {
            currentMana += 2;
        }

        if (p2 != null && p2.team == team)
        {
            currentMana += 2;
        }

        GeneralManager.NextTurn(team);
        UpdateBoardVisuals();
    }
Example #26
0
        /// Method for loading all textures in Content folder
        private static void LoadTextures()
        {
            DirectoryInfo dir = new DirectoryInfo(GeneralManager.Content.RootDirectory + "/Textures");

            Logger.Write("Root : " + dir.Name);
            if (!dir.Exists)
            {
                throw new DirectoryNotFoundException();
            }

            List <DirectoryInfo> dirs = dir.GetDirectories().ToList();

            bool NothingAdded = false;

            while (!NothingAdded)
            {
                List <DirectoryInfo> NewDirs = new List <DirectoryInfo>();

                foreach (DirectoryInfo DInf in dirs)
                {
                    foreach (DirectoryInfo D in DInf.GetDirectories())
                    {
                        bool WasAdded = false;
                        foreach (DirectoryInfo Check in dirs)
                        {
                            if (Check.FullName == D.FullName)
                            {
                                WasAdded = true;
                                break;
                            }
                        }

                        if (!WasAdded)
                        {
                            NewDirs.Add(D);
                        }
                    }
                }

                NothingAdded = NewDirs.Count == 0;

                dirs.AddRange(NewDirs);
            }

            foreach (DirectoryInfo d in dirs)
            {
                FileInfo[] files = d.GetFiles("*.*");

                int Start = Directory.GetCurrentDirectory().Length + 9;

                foreach (FileInfo file in files)
                {
                    string key = d.FullName.Substring(Start) + "/" + file.Name.Split(new char[] { '.' })[0];
                    Logger.Write("Loading : " + key);

                    GeneralManager.LoadTex(key);
                }
            }
        }
Example #27
0
 private void Awake()
 {
     if (m_Instance == null)
     {
         m_Instance = this;
     }
     m_Player = FindObjectOfType <PlayerMovement>().gameObject;
 }
Example #28
0
    private Vector3 velocity = Vector3.zero; // used by smoothDampen exclusively

    // Start is called before the first frame update
    void Start()
    {
        generalManager  = GameObject.FindObjectOfType <GeneralManager>();
        playerComponent = GetComponent <Player>();
        boardTiles      = generalManager.boardTiles;
        playerIndex     = playerComponent.playerIndex;
        this.enabled    = false;
    }
    private void Awake()
    {
        GM   = FindObjectOfType <GeneralManager>();
        anim = GetComponent <Animator>();

        rb = gameObject.GetComponent <Rigidbody2D>();
        rb.freezeRotation = true;
    }
Example #30
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            switch (CommandName)
            {
            case CommandNameEnum.Add:
                obj.Insert();
                break;

            case CommandNameEnum.Edit:
                obj.Update();
                break;
            }
            this.PKID = (this.PKID == 0) ? obj.GetMax() : this.PKID;
            MenuBiz          menuBiz     = new MenuBiz();
            menu_role        menuRoleBiz = new menu_role();
            List <menu_role> _menuRoles  = menuRoleBiz.getRoleListByRoleId(PKID);
            List <menu>      menus       = menuBiz.GetAll().Where(x => x.PREVIOUS_MENU_ID != null).OrderBy(x => x.DISPLAY_ORDER).ToList();

            foreach (menu _menu in menus)
            {
                menu_role menuRole = _menuRoles.Where(x => x.MENU_ID == _menu.MENU_ID).FirstOrDefault();
                if (menuRole != null)
                {
                    menuRole.IS_CREATE = isChecked(menuRole, CommandNameEnum.Add);
                    menuRole.IS_EDIT   = isChecked(menuRole, CommandNameEnum.Edit);
                    menuRole.IS_DELETE = isChecked(menuRole, CommandNameEnum.Delete);
                    menuRole.RowState  = CommandNameEnum.Edit;
                }
                else
                {
                    menu_role _menuRole = new menu_role();
                    _menuRole.ROLE_ID            = this.PKID;
                    _menuRole.MENU_ID            = Convert.ToInt32(_menu.MENU_ID);
                    _menuRole.IS_REQUIRED_ACTION = false;
                    _menuRole.IS_CREATE          = false;
                    _menuRole.IS_DELETE          = false;
                    _menuRole.IS_EDIT            = false;
                    _menuRole.UPDATE_BY          = "SYSTEM";
                    _menuRole.CREATE_DATE        = DateTime.Now;
                    _menuRole.UPDATE_DATE        = DateTime.Now;
                    _menuRole.RowState           = CommandNameEnum.Add;
                    _menuRoles.Add(_menuRole);
                    menu_role tmp_menuRole = _menuRoles.Where(x => x.MENU_ID == _menu.MENU_ID).FirstOrDefault();
                    tmp_menuRole.IS_CREATE = isChecked(tmp_menuRole, CommandNameEnum.Add);
                    tmp_menuRole.IS_DELETE = isChecked(tmp_menuRole, CommandNameEnum.Edit);
                    tmp_menuRole.IS_EDIT   = isChecked(tmp_menuRole, CommandNameEnum.Delete);
                    tmp_menuRole.RowState  = CommandNameEnum.Add;
                }
            }
            foreach (menu_role _menuRole in _menuRoles.Where(x => x.IS_CREATE == (bool)false && x.IS_EDIT == (bool)false && x.IS_DELETE == (bool)false))
            {
                _menuRole.RowState = CommandNameEnum.Delete;
            }
            menuRoleBiz.InsertList(_menuRoles);
            GeneralManager.Commit();
            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
Example #31
0
        static void Main(string[] args)
        {
            CommonManager jinli = new CommonManager("金立");
            Majordomo zongjian = new Majordomo("中坚");
            GeneralManager zhongjingli = new GeneralManager("仲景离");
            jinli.SetSuperior(zongjian);
            zongjian.SetSuperior(zhongjingli);

            Request request1 = new Request
            {
                RequestType = "请假",
                RequestContent = "小菜请假",
                Number = 1
            };
            jinli.RequestApplications(request1);

            Request request2 = new Request
            {
                RequestType = "请假",
                RequestContent = "小菜请假",
                Number = 4
            };
            jinli.RequestApplications(request2);

            Request request3 = new Request
            {
                RequestType = "加薪",
                RequestContent = "小菜请求加薪",
                Number = 500
            };
            jinli.RequestApplications(request3);

            Request request4 = new Request
            {
                RequestType = "加薪",
                RequestContent = "小菜请求加薪",
                Number = 1000
            };
            jinli.RequestApplications(request4);
        }
Example #32
0
 public GeneralManager()
 {
     mInstance = null;
     mInstance = this;
 }