Beispiel #1
0
        public ActionResult ViewSellProductQty(int nStoreID, int nStoreProductID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            _oStoreProduct         = new StoreProduct();
            _oStoreProduct.StoreID = nStoreID;

            if (nStoreProductID > 0)
            {
                _oStoreProduct = _oStoreProductService.Get(nStoreID, nStoreProductID, (int)Session[GlobalSession.UserID]);
            }
            ContractorService oContractorService = new ContractorService();
            List <Contractor> oContractors       = new List <Contractor>();

            oContractors = oContractorService.GetsByContractorType(EnumContractorType.Supplier, (int)Session[GlobalSession.UserID]);

            List <ProductCategory> oProductCategorys       = new List <ProductCategory>();
            ProductCategoryService oProductCategoryService = new ProductCategoryService();

            oProductCategorys = oProductCategoryService.Gets(1, (int)Session[GlobalSession.UserID]);

            List <Product> oProducts       = new List <Product>();
            ProductService oProductService = new ProductService();

            oProducts = oProductService.Gets(1, (int)Session[GlobalSession.UserID]);

            ViewBag.ProductTypes     = _oProductTypeService.Gets(1, (int)Session[GlobalSession.UserID]);
            ViewBag.Contractors      = oContractors;
            ViewBag.Products         = oProducts;
            ViewBag.ProductCategorys = oProductCategorys;

            return(View(_oStoreProduct));
        }
Beispiel #2
0
        private IEnumerator _InitNetworkReady()
        {
            while (!_socket.isOpen)
            {
                yield return(new WaitForSeconds(0.5f));
            }

            userData.Load((success) =>
            {
                if (success)
                {
                    var newSession = new GlobalSession
                    {
                        User      = userData.GetUserInfo(),
                        Character = userData.GetCurrentCharacter()
                    };
                    MainContainer.Container.Register <IGlobalSession>(newSession);

                    SetToNextState();
                }
                else
                {
                    Debug.LogError("LoginWithDeviceId failed");
                    // send to show error state
                }
            });
        }
        public AuthorizedControl()
        {
            InitializeComponent();
            var user = GlobalSession.GetDesktopCurrentUser();

            AuthorizedText.Text = string.Format(AuthorizedText.Text, user.UserName);
        }
Beispiel #4
0
        public RTSWorld()
            : base()
        {
            // Add default, neutral team.
            Team neutral = new Team(0, "Neutral", Color.LightGray);

            this.Teams.Add(neutral);

#if MULTIPLAYER
            // Get global session information.
            this.m_GlobalSession             = new Distributed <GlobalSession>("rts-session");
            this.m_GlobalSession.LogEmitted += (sender, ev) => { this.UiManager.Log(ev.ToString()); };
            this.m_LocalPlayer = this.m_GlobalSession.Join();

            // Hook the game started event.
            if (LocalNode.Singleton.IsServer)
            {
                this.m_GlobalSession.ServerGameStarted += this._HandleServerGameStart;
            }
            else
            {
                this.m_GlobalSession.ClientGameStarted += this._HandleClientGameStart;
            }
#else
            // Get global session information.
            this.m_GlobalSession             = new GlobalSession();
            this.m_GlobalSession.LogEmitted += (sender, ev) => { this.UiManager.Log(ev.ToString()); };
            this.m_LocalPlayer = this.m_GlobalSession.Join();

            // Hook the game started event.
            this.m_GlobalSession.ServerGameStarted += (sender, ev) => { this.HandleServerGameStart(); };
#endif
        }
 public ActionResult ViewCustomers(int nBUID, int nUserID)
 {
     GlobalSession.SessionIsAlive(Session, Response);
     _oContractors = _oContractorService.GetsByContractorType(EnumContractorType.Customer, (int)Session[GlobalSession.UserID]);
     ViewBag.BUID  = nBUID;
     return(View(_oContractors));
 }
        private void LogOutLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            GlobalSession.EndDesktopSession();
            var mainForm = ParentForm as MainForm;

            mainForm?.ChangeHeader(false);
        }
Beispiel #7
0
        public ActionResult ViewBill(int nBillID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            Bill _oBill = new Bill();

            if (nBillID > 0)
            {
                _oBill = _oBillService.Get(nBillID, (int)Session[GlobalSession.UserID]);

                _oBillDetails = _oBillDetailService.GetsByBillID(_oBill.BillID, (int)Session[GlobalSession.UserID]);
            }
            else
            {
                Random random = new Random();
                _oBill.BillNo = random.Next(1, 99).ToString() + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
            }
            ViewBag.BillDetails = _oBillDetails;
            List <Store> oStores       = new List <Store>();
            StoreService oStoreService = new StoreService();

            oStores = oStoreService.Gets(1, (int)Session[GlobalSession.UserID]);
            List <StoreProduct> oStoreProducts = new List <StoreProduct>();

            ViewBag.Stores        = oStores;
            ViewBag.StoreProducts = oStoreProducts;
            return(View(_oBill));
        }
Beispiel #8
0
        public MainForm()
        {
            InitializeComponent();
            CreateMenu();
            var user = GlobalSession.GetDesktopCurrentUser();

            ChangeHeader(user != null);
        }
Beispiel #9
0
        public override void Start()
        {
            base.Start();

            Console.AddCommandByMethod(() => ReloadConfig());

            Container.Register(config);

            Container.TryResolve(out IGlobalSession globalSession);

            Debug.Log("Remote config loading...");
            AppConfig.LoadByUrlAsync().ContinueWith((json) =>
            {
                var loadedConfig = OnConfigLoaded(json);

                var globalPort = CommandLine.GetArg("--port");
                if (globalPort != null)
                {
                    loadedConfig.Main.ServerPort = ushort.Parse(globalPort);
                }

                var gameId = CommandLine.GetArg("--gameid");
                if (globalSession?.Game != null) //TODO: Have separate logic(client\serv\editor)
                {
                    LoadGameData(globalSession.Game.id)
                    .ContinueWith(data =>
                    {
                        var(game, characters) = data;
                        Container.Resolve <IGlobalSession>().Game             = game;
                        Container.Resolve <IGlobalSession>().CharactersInGame = characters;

                        //InitWorlds(Container.Resolve<IGlobalSession>().Game);
                        InitWorlds(loadedConfig.Main.ServerPort);
                    });
                }
                else if (gameId != null)
                {
                    LoadGameData(gameId)
                    .ContinueWith(data =>
                    {
                        var(game, characters) = data;
                        var newSession        = new GlobalSession
                        {
                            Game             = game,
                            CharactersInGame = characters
                        };
                        MainContainer.Container.Register <IGlobalSession>(newSession);
                        InitWorlds(loadedConfig.Main.ServerPort);
                    });
                }
                else
                {
                    InitWorlds(loadedConfig.Main.ServerPort);
                }
            });
        }
        public ActionResult ViewStoreProductHistorys(int nBUID, int nUserID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            nUserID = Convert.ToInt32(Session["UserID"].ToString());

            _oStoreProductHistorys = _oStoreProductHistoryService.Gets("SELECT TOP(200)* FROM View_StoreProductHistory ORDER BY DBServerDateTime DESC", (int)Session[GlobalSession.UserID]);
            ViewBag.Stores         = _oStoreService.Gets(1, (int)Session[GlobalSession.UserID]);
            ViewBag.BUID           = nBUID;
            return(View(_oStoreProductHistorys));
        }
Beispiel #11
0
        public ActionResult ViewStoreProducts(int nBUID, int nUserID)
        {
            GlobalSession.SessionIsAlive(Session, Response);

            _oStores = _oStoreService.Gets(nBUID, (int)Session[GlobalSession.UserID]);

            _oStoreProducts = _oStoreProductService.Gets(nBUID, (int)Session[GlobalSession.UserID]);
            ViewBag.BUID    = nBUID;
            return(View(_oStores));
        }
        public ActionResult ViewStore(int nStoreID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            Store _oStore = new Store();

            if (nStoreID > 0)
            {
                _oStore = _oStoreService.Get(nStoreID, (int)Session[GlobalSession.UserID]);
            }
            return(View(_oStore));
        }
        public ActionResult ViewProductCategory(int nProductCategoryID)
        {
            GlobalSession.SessionIsAlive(Session, Response);

            ProductCategory _oProductCategory = new ProductCategory();

            if (nProductCategoryID > 0)
            {
                _oProductCategory = _oProductCategoryService.Get(nProductCategoryID, (int)Session[GlobalSession.UserID]);
            }
            ViewBag.ProductTypes = _oProductTypeService.Gets(1, (int)Session[GlobalSession.UserID]);
            return(View(_oProductCategory));
        }
        public ActionResult ViewCustomer(int nContractorID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            Contractor _oContractor = new Contractor();

            if (nContractorID > 0)
            {
                _oContractor = _oContractorService.Get(nContractorID, (int)Session[GlobalSession.UserID]);
            }
            ViewBag.ContractorTypes = Enum.GetValues(typeof(EnumContractorType)).Cast <EnumContractorType>().Select(e => new EnumClass {
                Id = ((int)e), Name = e.ToString()
            });
            return(View(_oContractor));
        }
Beispiel #15
0
        public JsonResult Delete(ProductType oProductType)
        {
            GlobalSession.SessionIsAlive(Session, Response);

            ProductType _oProductType = new ProductType();

            if (oProductType.ProductTypeID > 0)
            {
                _oProductType.ErrorMessage = _oProductTypeService.Delete(oProductType, (int)Session[GlobalSession.UserID]);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string sjson = serializer.Serialize(_oProductType);

            return(Json(sjson, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Delete(ProductCategory oProductCategory)
        {
            GlobalSession.SessionIsAlive(Session, Response);

            ProductCategory _oProductCategory = new ProductCategory();

            if (oProductCategory.ProductCategoryID > 0)
            {
                _oProductCategory = _oProductCategoryService.IUD(oProductCategory, EnumDBOperation.Delete, (int)Session[GlobalSession.UserID]);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string sjson = serializer.Serialize(_oProductCategory);

            return(Json(sjson, JsonRequestBehavior.AllowGet));
        }
Beispiel #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIgnoreOtherSessions()
        public virtual void ShouldIgnoreOtherSessions()
        {
            // given
            GlobalSession        sessionB           = new GlobalSession(System.Guid.randomUUID(), null);
            DistributedOperation aliasUnderSessionB = new DistributedOperation(ReplicatedInteger.valueOf(0), sessionB, new LocalOperationId(_operationA.operationId().localSessionId(), _operationA.operationId().sequenceNumber()));

            Progress progressA = _tracker.start(_operationA);

            // when
            _tracker.trackReplication(aliasUnderSessionB);
            _tracker.trackResult(aliasUnderSessionB, Result.of("result"));

            // then
            assertFalse(progressA.Replicated);
            assertFalse(progressA.FutureResult().Done);
        }
Beispiel #18
0
        public ActionResult Save(ProductType oProductType)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            if (oProductType.ProductTypeID <= 0)
            {
                _oProductType = _oProductTypeService.IUD(oProductType, EnumDBOperation.Insert, (int)Session[GlobalSession.UserID]);
            }
            else
            {
                _oProductType = _oProductTypeService.IUD(oProductType, EnumDBOperation.Update, (int)Session[GlobalSession.UserID]);
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string sjson = serializer.Serialize(_oProductType);

            return(Json(sjson, JsonRequestBehavior.AllowGet));
        }
Beispiel #19
0
        private async void LoginButton_Click(object sender, EventArgs e)
        {
            var userName = UserNameTextBox.Text;
            var password = PasswordTextBox.Text;

            var loginModel = new LoginModel
            {
                UserName = userName,
                Password = password
            };

            var loginResult = await _authenticationService.LoginUser(loginModel);

            if (loginResult.IsSuccessful)
            {
                GlobalSession.StartDesktopSession(loginResult.Data);
                OwnerForm.ChangeHeader(true);
                Close();
            }
        }
Beispiel #20
0
        public ActionResult ViewStoreProduct(int nStoreID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            _oStoreProduct = new StoreProduct();

            ContractorService oContractorService = new ContractorService();
            List <Contractor> oContractors       = new List <Contractor>();

            oContractors = oContractorService.GetsByContractorType(EnumContractorType.Supplier, (int)Session[GlobalSession.UserID]);


            if (nStoreID > 0)
            {
                _oStore         = _oStoreService.Get(nStoreID, (int)Session[GlobalSession.UserID]);
                _oStoreProducts = _oStoreProductService.GetsByStoreID(_oStore.StoreID, (int)Session[GlobalSession.UserID]);
            }
            ViewBag.ProductTypes  = _oProductTypeService.Gets(1, (int)Session[GlobalSession.UserID]);
            ViewBag.StoreProducts = _oStoreProducts;
            ViewBag.Contractors   = oContractors;
            return(View(_oStore));
        }
        /// <summary>
        /// Flushes the queue of stored attribute updates and commits the changes to the database
        /// </summary>
        private void CommitCurrentAttributeUpdates()
        {
            if (GlobalSession.IsOpen)
            {
                GlobalSession.Close();
            }

            using (IStatelessSession session = SessionFactory.OpenStatelessSession())
            {
                var transaction = session.BeginTransaction();
                foreach (KeyValuePair <Guid, Dictionary <string, object> > componentUpdate in ComponentAttributesToPersist)
                {
                    Guid componentGuid = componentUpdate.Key;
                    foreach (KeyValuePair <string, object> attributeUpdate in componentUpdate.Value)
                    {
                        String updateQuery = "update attributes_to_components set value = :newValue where componentID = :componentGuid AND attributeName = :attributeName";
                        IQuery sqlQuery    = session.CreateSQLQuery(updateQuery)
                                             .SetBinary("newValue", ObjectToByteArray(attributeUpdate.Value))
                                             .SetParameter("componentGuid", componentGuid)
                                             .SetParameter("attributeName", attributeUpdate.Key);
                        sqlQuery.ExecuteUpdate();
                    }
                }
                try
                {
                    transaction.Commit();
                }
                catch (Exception e)
                {
                    logger.WarnException("Failed to update Attribute", e);
                    transaction.Rollback();
                }
                finally
                {
                    session.Close();
                }
            }
        }
Beispiel #22
0
        public ActionResult ViewDueBill(int nBillID)
        {
            GlobalSession.SessionIsAlive(Session, Response);
            Bill _oBill = new Bill();

            if (nBillID > 0)
            {
                _oBill = _oBillService.Get(nBillID, (int)Session[GlobalSession.UserID]);

                if (_oBill.BillID_Ref <= 0)
                {
                    _oBill.BillNo_Ref = _oBill.BillNo;
                    _oBill.YetToPay   = (_oBill.AmountToPaid - _oBill.TotalPaidAmount);
                    _oBill.DueAmount  = 0;

                    _oBill.PaidTotal = 0;
                    _oBillDetails    = _oBillDetailService.GetsByBillID(_oBill.BillID, (int)Session[GlobalSession.UserID]);
                }
                else
                {
                    _oBillDetails = _oBillDetailService.GetsByBillID(_oBill.BillID_Ref, (int)Session[GlobalSession.UserID]);
                }
            }
            else
            {
                throw new Exception("Exception: Invalid Due Bill.");
            }
            ViewBag.BillDetails = _oBillDetails;
            List <Store> oStores       = new List <Store>();
            StoreService oStoreService = new StoreService();

            oStores = oStoreService.Gets(1, (int)Session[GlobalSession.UserID]);
            List <StoreProduct> oStoreProducts = new List <StoreProduct>();

            ViewBag.Stores        = oStores;
            ViewBag.StoreProducts = oStoreProducts;
            return(View(_oBill));
        }
        /// <summary>
        /// Flushes the queue of stored entity updates and commits the changes to the database
        /// </summary>
        private void CommitCurrentEntityUpdates()
        {
            if (GlobalSession.IsOpen)
            {
                GlobalSession.Close();
            }

            using (ISession session = SessionFactory.OpenSession())
            {
                var transaction = session.BeginTransaction();
                foreach (Entity entity in EntitiesToPersist)
                {
                    try
                    {
                        session.SaveOrUpdate(entity);
                    }
                    catch (Exception e)
                    {
                        logger.LogException(LogLevel.Error, "Save or Update of Entity failed", e);
                    }
                }
                try
                {
                    transaction.Commit();
                }
                catch (Exception e)
                {
                    Console.WriteLine("Transaction to persist entities failed: " + e.Message);
                    transaction.Rollback();
                }
                finally
                {
                    session.Close();
                }
            }
        }
 public ActionResult Index()
 {
     GlobalSession.SessionIsAlive(Session, Response);
     return(View(_oUser));
 }
Beispiel #25
0
 private void InitializeInstanceFields()
 {
     _session     = new GlobalSession(System.Guid.randomUUID(), _myself);
     _sessionPool = new LocalSessionPool(_session);
 }
Beispiel #26
0
        private async void RegistrationButton_Click(object sender, EventArgs e)
        {
            ValidationErrorsLabel.Text = string.Empty;

            var validationResult = ValidateForm();

            if (validationResult.IsValid)
            {
                var userName = UserNameTextBox.Text;
                var password = PasswordTextBox.Text;
                var email    = EmailTextBox.Text;

                var registrationModel = new RegistrationModel
                {
                    Email    = email,
                    UserName = userName,
                    Password = password
                };

                if (await _authenticationService.CheckIfExist(userName))
                {
                    SetErrorMessage($"User '{userName}' is already exist");
                    return;
                }

                var result = await _authenticationService.RegisterUser(registrationModel);

                if (result.IsSuccessful)
                {
                    var loginModel = new LoginModel
                    {
                        UserName = userName,
                        Password = password
                    };

                    var loginResult = await _authenticationService.LoginUser(loginModel);

                    if (loginResult.IsSuccessful)
                    {
                        GlobalSession.StartDesktopSession(loginResult.Data);
                        OwnerForm.ChangeHeader(true);
                        Close();
                    }
                    else
                    {
                        SetErrorMessage(loginResult.ErrorMessage);
                    }
                }
                else
                {
                    SetErrorMessage(result.ErrorMessage);
                }
            }
            else
            {
                foreach (var error in validationResult.ErrorMessages)
                {
                    SetErrorMessage(error);
                }
            }
        }
 public ActionResult ViewProductCategorys(int nBUID, int menuid)
 {
     GlobalSession.SessionIsAlive(Session, Response);
     _oProductCategorys = _oProductCategoryService.Gets(nBUID, (int)Session[GlobalSession.UserID]);
     return(View(_oProductCategorys));
 }
Beispiel #28
0
 public OperationContext(GlobalSession globalSession, LocalOperationId localOperationId, LocalSession localSession)
 {
     this._globalSession    = globalSession;
     this._localOperationId = localOperationId;
     this._localSession     = localSession;
 }
Beispiel #29
0
 public ProgressTrackerImpl(GlobalSession myGlobalSession)
 {
     this._myGlobalSession = myGlobalSession;
 }