Ejemplo n.º 1
0
 public static PackageCodeModel ToModel(this PackageCode aPackageCodeEntity)
 {
     return(new PackageCodeModel()
     {
         PackageId = aPackageCodeEntity.PackageId,
         PackageCd = aPackageCodeEntity.PackageCode1,
         Description = aPackageCodeEntity.Description,
         AddOnPercent = aPackageCodeEntity.AddOnPercent
     });
 }
Ejemplo n.º 2
0
 public GamePackage(
     PackageCode code,
     List <CharacterCode> characters,
     List <ConversationCode> conversations,
     Dictionary <ConversationCode, CharacterCode> edits)
 {
     _code  = code;
     _chars = characters;
     _convs = conversations;
     _edits = edits;
 }
Ejemplo n.º 3
0
        public RootComponent(GraphicsDevice graphics, SpriteBatch sbatch)
        {
            _gp = graphics;
            _sb = sbatch;

            _resetPointer  = new VoidFunctionPointer(Reset);
            _reloadPointer = new VoidFunctionCodeParamPointer(Reload);
            // current package set to Test
            _currPackage = PackageCode.Test;

            _router    = new GameRouter();
            _processor = new RootProcessor();
            _updater   = new RootUpdater(_router);
            _renderer  = new RootRenderer();
            LoadComponents(_gp, _sb);
            LoadGame();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Load Story based on PackageCode
        /// </summary>
        /// <param name="component"></param>
        /// <param name="code"></param>
        public static bool LoadConversation(StoryComponent component, PackageCode code)
        {
            IPackage package = null;

            foreach (IPackage pack in _packages)
            {
                if (pack.Code == code)
                {
                    package = pack;
                }
            }
            if (package == null)
            {
                return(false);
            }
            component.SetConversation(package.Conversations);
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Load GameState data based on PackageCode
        /// </summary>
        /// <param name="gameState"></param>
        /// <param name="code"></param>
        public static bool LoadPackage(IGameState gameState, PackageCode code)
        {
            IPackage package = null;

            foreach (IPackage pack in _packages)
            {
                if (pack.Code == code)
                {
                    package = pack;
                }
            }
            if (package == null)
            {
                return(false);
            }
            gameState.LoadData(CharacterBuilder.GetCharacters(package.Characters), package.EditingIndex);
            return(true);
        }
Ejemplo n.º 6
0
        private void btnLogin_Click(System.Object sender, System.EventArgs e)
        {
            #region Disable Code
            //Check login information from database
            //			ACMSLogic.User oUser = new User();
            //			bool chkUserLogin = false;
            //
            //			chkUserLogin = System.Convert.ToBoolean(oUser.Login(txtUsername.Text, txtPassword.Text));
            //
            //			if (chkUserLogin)
            //			{
            //				if (cmbModule.Text == "ACMS Branch")
            //				{
            //					//Show AMCS Branch
            //					if (modInitForms.fBranch == null)
            //					{
            //						modInitForms.fBranch = new frmBranch();
            //						modInitForms.fBranch.initData(oUser);
            //						modInitForms.fBranch.Show();
            //					}
            //
            //					modInitForms.fLogin.Hide();
            //				}
            //
            //				if (cmbModule.Text == "ACMS POS")
            //				{
            //					//Show AMCS POS
            //					if (modInitForms.fPOS == null)
            //					{
            //						modInitForms.fPOS = new frmPOS();
            //						modInitForms.fPOS.Show();
            //					}
            //
            //					modInitForms.fLogin.Hide();
            //				}
            //
            //				if (cmbModule.Text == "ACMS Staff")
            //				{
            //					//Show AMCS POS
            //					if (modInitForms.fStaff == null)
            //					{
            //						modInitForms.fStaff = new frmStaff();
            //						modInitForms.fStaff.Show();
            //					}
            //
            //					modInitForms.fLogin.Hide();
            //				}
            //			}
            //			else
            //			{
            //				MessageBox.Show(this, "Incorrect username and password, please try again");
            //			}
            #endregion
            //DateTime start = DateTime.Now;
            if (this.txtUsername.Text == "" | this.txtPassword.Text == "")
            {
                ACMS.Utils.UI.ShowErrorMessage(this, "Empty Username & Password!", "Error");
            }

            else
            {
                try
                {
                    ACMSLogic.Login.Login login = new ACMSLogic.Login.Login();
                    //Do.Employee emplogin = login.GetEmployeeByIdAndPassword(this.txtUsername.Text, this.txtPassword.Text);

                    //MessageBox.Show(this, emplogin.Id.ToString()+" "+emplogin.Department.Id+" "+emplogin.RightsLevel.RightsLevelEntrys.Count.ToString());

                    //Rp.EmployeeRepository er = new Rp.EmployeeRepository();
                    Do.Employee emp = login.GetEmployeeByIdAndPassword(this.txtUsername.Text, this.txtPassword.Text);                    //er.GetEmployeeByIdAndPassword(this.txtUsername.Text, this.txtPassword.Text);

                    System.Security.Principal.WindowsIdentity userLogin = System.Security.Principal.WindowsIdentity.GetCurrent();

                    if (login.Check_Concurrent() == false)
                    {
                        ACMS.Utils.UI.ShowErrorMessage(this, "Number of Login Exceed Users Limit!", "Authorisation");
                    }
                    else
                    {
                        //Rp.TerminalUserRepository tup = new Rp.TerminalUserRepository();
                        if (emp != null)
                        {
                            Acms.Core.Domain.TerminalUser tu = login.GetTerminalUserByUserId(userLogin.Name) as Acms.Core.Domain.TerminalUser;                            //tup.GetTerminalUserByUserId(userLogin.Name) as Acms.Core.Domain.TerminalUser;

                            //Show AMCS Branch
                            bool Valid = numberUser();
                            //bool Valid = true;
                            if (emp.CanAccess("AB_LOGIN", tu.Branch.Id) && Valid)
                            {
                                //smell tandas code
                                ACMSDAL.TblTerminalUser UserLog = new TblTerminalUser();
                                UserLog.StrTerminalUserCode = userLogin.Name;
                                UserLog.UpdateSession(true, DateTime.Now);

                                modInitForms.fLogin.Hide();
                                ACMSLogic.User.BranchCode = tu.Branch.Id;
                                ACMSLogic.User.EmployeeID = emp.Id;
                                if (emp.Department != null)
                                {
                                    ACMSLogic.User.DepartmentID = emp.Department.Id;
                                }
                                if (emp.StrEmployeeName != null)
                                {
                                    ACMSLogic.User.EmployeeName = emp.StrEmployeeName;
                                }
                                if (emp.JobPosition.Id != null)
                                {
                                    ACMSLogic.User.JobPositionCode = emp.JobPosition.Id;
                                }
                                if (emp.RightsLevel != null)
                                {
                                    ACMSLogic.User.RightsLevelID = emp.RightsLevel.Id;
                                }
                                try
                                {
                                    ClassAttendance.CreateClassInstance();
                                    PackageCode.CreateUnLinkPackage();
                                }
                                catch (Exception ex)
                                {
                                    return;
                                }
                                ACMSLogic.User oUser = new User();

                                if (modInitForms.fBranch != null)
                                {
                                    modInitForms.fBranch.IsLogin = true;
                                    modInitForms.fBranch.Close();
                                    modInitForms.fBranch.Dispose();
                                    if (modInitForms.fStaff != null)
                                    {
                                        modInitForms.fStaff.Close();
                                        modInitForms.fStaff.Dispose();
                                    }
                                    if (modInitForms.fManager != null)
                                    {
                                        modInitForms.fManager.Close();
                                        modInitForms.fManager.Dispose();
                                    }
                                }
                                modInitForms.fBranch = new frmBranch(cmbLanguage.EditValue.ToString());
                                modInitForms.fBranch.SetEmployeeRecord(emp);
                                modInitForms.fBranch.SetTerminalUser(tu);
                                modInitForms.fBranch.OpenDayShift();

                                //						if (UnclosedShift == true)
                                //							MessageBox.Show("There is unclosed shift. Please close the shift.");

                                modInitForms.fBranch.initData(oUser);
                                modInitForms.fBranch.Show();

                                //DateTime end = DateTime.Now;
                                //TimeSpan diff = end.Subtract(start);
                                //MessageBox.Show(diff.TotalSeconds.ToString(),"Time");
                            }
                            else if (emp.CanAccess("AB_TIMECARD_LOGIN", tu.Branch.Id))
                            {
                                modInitForms.fLogin.Hide();
                                //Show AMCS Time Card
                                if (modInitForms.fTimeCard == null)
                                {
                                    modInitForms.fTimeCard = new frmTimeCard(tu.Branch.Id);
                                    modInitForms.fTimeCard.Show();
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "Invalid username and password or you don't have access to this Branch, please try again");
                            }
                        }
                        else
                        {
                            MessageBox.Show(this, "Invalid username and password, Please try again");
                        }
                    }
                }
                catch (Exception ex)
                {
                    return;
                }
            }
        }