private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                InstructorBL   instructorBL = new InstructorBL();
                InstructorType type         = instructorBL.getType(txtUserName.Text, txtPassword.Text);

                if (InstructorType.DepartmentHead == type || InstructorType.Instructor == type)
                {
                    main.instructorType = type;
                    MessageBox.Show(txtUserName.Text + " is " + type.ToString());
                    DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                int times = 0;
                times++;
                //if more than 4 times of login errors, system shut down
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (times == 4)
                {
                    DialogResult = DialogResult.Cancel;
                    MessageBox.Show("Login failed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
        public static IGoPiGoInstructor CreateInstructor(InstructorType instructorType)
        {
            switch (instructorType)
            {
            case InstructorType.OnDevice:
                return(new InstructorOnDeviceGoPiGo());

            case InstructorType.RestfulService:
                return(new InstrustorRestFulGoPiGo());
            }
            return(null);
        }
Ejemplo n.º 3
0
        public bool InsertInstructor(string useranme, string password, InstructorType type)
        {
            List <ParmStruct> parms = new List <ParmStruct>();

            parms.Add(new ParmStruct("@username", useranme, SqlDbType.NVarChar, ParameterDirection.Input, 20));
            parms.Add(new ParmStruct("@Password", password, SqlDbType.NVarChar, ParameterDirection.Input, 10));
            parms.Add(new ParmStruct("@InstructorType", type, SqlDbType.Int, ParameterDirection.Input, 1));


            DataAccess db = new DataAccess();

            return(db.ExecuteNonQuery("spInsertInstructor", CommandType.StoredProcedure, parms) > 0);
        }
Ejemplo n.º 4
0
        private StoryDialog(InstructorType instractorType, String instructorName, String message, Action callback)
        {
            this.instructorName = instructorName;
            this.message = message;
            this.callback = callback;

            var windowWidth = Math.Max(600, Screen.width / 2);
            var windowHeight = Math.Max(500, Screen.height / 2);
            this.windowPosition = new Rect((Screen.width / 2) - (windowWidth / 2), (Screen.height / 2) - (windowHeight / 2), windowWidth, windowHeight);

            this.labelStyle = new GUIStyle(HighLogic.Skin.label) {
                alignment = TextAnchor.MiddleCenter,
            };
            this.scrollStyle = new GUIStyle(HighLogic.Skin.scrollView);
            this.instructor = this.GetInstructor(instractorType);
            this.instructorTexture = new RenderTexture(this.instructorPortraitSize, this.instructorPortraitSize, 8);
            this.instructor.instructorCamera.targetTexture = this.instructorTexture;
            this.instructor.instructorCamera.ResetAspect();

            InputLockManager.SetControlLock(LOCK_ID);
            RenderingManager.AddToPostDrawQueue(144, this.OnDraw);
        }
Ejemplo n.º 5
0
        public bool InsertInstructor(string id, string password, InstructorType type)
        {
            InstructorRepo instructorBL = new InstructorRepo();

            return(instructorBL.InsertInstructor(id, password, type));
        }
Ejemplo n.º 6
0
 public KerbalInstructor GetInstructor(InstructorType type)
 {
     var name = String.Format("Instructor_{0}", type.ToString());
     var gameObject = (GameObject)UnityEngine.Object.Instantiate(AssetBase.GetPrefab(name));
     return gameObject.GetComponent<KerbalInstructor>();
 }
Ejemplo n.º 7
0
 public void UpdateType(InstructorType newType)
 {
     _type = newType;
 }