Ejemplo n.º 1
0
 public GSTightenController(ScreenConfig config, Logging logger, MainViewModels viewModel)
 {
     _logger      = logger;
     tdConfig     = config;
     view         = viewModel;
     TightenDatas = new TightenDataCaChe(tdConfig.Tighten.BoltCount);
 }
Ejemplo n.º 2
0
 public MainForm(ScreenConfig scnConfig = null)
 {
     //InitializeComponent();
     //Load += FormForm_Load;
     _screenConfig = scnConfig;
     ViewModel     = new MainViewModels();
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Login(LoginUser loguser)
        {
            int            id = loguser.UserID;
            MainViewModels mg = new MainViewModels();

            mg.employee = await _db.Employees.SingleOrDefaultAsync(e => e.EmployeeId == id);

            if (ModelState.IsValid)
            {
                if (id == 1)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else if (EmployeeExists(id))
                {
                    loguser = await _db.LoginUsers.SingleOrDefaultAsync(u => u.UserID == id);

                    if (loguser != null)
                    {
                        loguser.Logintime = DateTime.Now; loguser.Status = "Log_IN";
                        _db.LoginUsers.Update(loguser);
                        await _db.SaveChangesAsync();

                        mg.Login = loguser;
                    }
                    return(View("WorkSpace", mg));
                }
                else
                {
                    ModelState.AddModelError("UserID", "UserID not Exists, Please check with administrator");
                }
            }
            return(View());
        }
Ejemplo n.º 4
0
        async void Navigate()
        {
            switch (PageName)
            {
            case "LoginView":
                var mainViewModel = MainViewModels.GetInstance();
                mainViewModel.Token.IsRemembered = false;
                dataService.Update(mainViewModel.Token);
                mainViewModel.Login = new LoginViewModel();
                navigationService.SetMainPage(PageName);
                break;

            case "UbicationsView":
                MainViewModels.GetInstance().Ubications =
                    new UbicationsViewModel();
                await navigationService.NavigateOnMaster(PageName);

                break;

            case "SyncView":
                MainViewModels.GetInstance().Sync =
                    new SyncViewModel();
                await navigationService.NavigateOnMaster(PageName);

                break;

            case "MyProfileView":
                MainViewModels.GetInstance().MyProfile =
                    new MyProfileViewModel();
                await navigationService.NavigateOnMaster(PageName);

                break;
            }
        }
Ejemplo n.º 5
0
        public App()
        {
            apiService        = new ApiService();
            dialogService     = new DialogService();
            navigationService = new NavigationService();
            dataService       = new DataService();

            InitializeComponent();

            var token = dataService.First <TokenResponse>(false);

            if (token != null &&
                token.IsRemembered &&
                token.Expires > DateTime.Now)
            {
                var mainViewModel = MainViewModels.GetInstance();
                mainViewModel.Token      = token;
                mainViewModel.Categories = new CategoriesViewModel();
                navigationService.SetMainPage("MasterView");
            }
            else
            {
                navigationService.SetMainPage("LoginView");
            }
        }
Ejemplo n.º 6
0
        async void SelectCategory()
        {
            var mainViewModel = MainViewModels.GetInstance();

            //Mantenemos en memoria la category seleccionada
            mainViewModel.Category = this;
            mainViewModel.Products = new ProductsViewModel(Products);
            await navigationService.NavigateOnMaster("ProductsView");
        }
        public ActionResult ServicesPicturesPage(int id)
        {
            ViewBag.Title = "Services Details";

            MngList        obj = new MngList();
            MainViewModels vm  = new MainViewModels();

            vm.vmListPicture_N_EventTypeViewModels = obj.GetListofServicesPicture(id);
            vm.vmListClsEventType = obj.EventTypeDistinct(id);

            return(View(vm));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Registers the change between view models
 /// </summary>
 /// <param name="newVM"></param>
 public void ChangeMenu(BaseViewModel newVM)
 {
     if (!MainViewModels.Contains(newVM))
     {
         MainViewModels.Add(newVM);
     }
     if (CurrentViewModel != null)
     {
         CurrentViewModel.Selected = false;
     }
     CurrentViewModel          = MainViewModels.FirstOrDefault(vm => vm == newVM);
     CurrentViewModel.Selected = true;
 }
Ejemplo n.º 9
0
        public App()
        {
            InitializeComponent();

            if (Settings.IsRemembered && string.IsNullOrEmpty(Settings.AccessToken))
            {
                MainViewModels.GetInstance().Products = new ProductsViewModel();
                MainPage = new NavigationPage(new ProductsPage());
            }
            else
            {
                MainViewModels.GetInstance().Login = new LoginViewModel();
                MainPage = new NavigationPage(new LoginPage());
            }
        }
Ejemplo n.º 10
0
        private async void Save()
        {
            string x = DateTime.Now.ToString("yyyy:MM:dd:HH:mm:ss");

            UserDialogs.Instance.ShowLoading("Espere");
            stream?.Seek(0, SeekOrigin.Begin);
            await ServiceWebApi.UpdateUser(App.User, stream, x);

            App.User = await ServiceWebApi.GetUser(App.User.IdUser.Value, x);

            UserDialogs.Instance.HideLoading();
            MainViewModels.GetInstance().Home = new HomeViewModel();
            await App.Current.MainPage.DisplayAlert("Información", "Perfil actualizado", "Aceptar");

            await App.Current.MainPage.Navigation.PopAsync();
        }
Ejemplo n.º 11
0
        //GET Employee/id?
        public async Task <IActionResult> GetEmployee(int?id)
        {
            MainViewModels me = new MainViewModels();

            if (id == null)
            {
                return(NotFound());
            }
            me.employee = await _db.Employees.SingleOrDefaultAsync(m => m.EmployeeId == id);

            if (me.employee == null)
            {
                return(NotFound());
            }
            return(View(me));
        }
Ejemplo n.º 12
0
        public MainForm(ScreenConfig config, MainViewModels viewModel, IAdamController iAdam, IOpcController iopc, ICardController iCard)
        {
            try
            {
                _screenConfig = config;
                ViewModel     = viewModel ?? new MainViewModels();
                adam          = iAdam;
                opc           = iopc;
                mwCard        = iCard;
                InitializeComponent();
                Load += FormForm_Load;
                adam.OnSensorTrigger += Adam_OnSensorTrigger;//开关\按钮信息
                mwCard.SwipedEvent   += MwCard_SwipedEvent;
                if (_screenConfig != null)
                {
                    lblAppName.Text = _screenConfig.Title;
                    if (_screenConfig.Part.Available)
                    {
                        panelPart.Visible = true;
                    }
                    if (config.Id != 0)
                    {
                        btClose.Visible = false;
                    }
                    theTitle = config.Title;
                }

                {
                    var dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
                    dataGridViewCellStyle1.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
                    dataGridViewCellStyle1.BackColor          = System.Drawing.SystemColors.Window;
                    dataGridViewCellStyle1.Font               = new System.Drawing.Font("宋体", 36F);
                    dataGridViewCellStyle1.ForeColor          = System.Drawing.SystemColors.ControlText;
                    dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                    dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                    dataGridViewCellStyle1.WrapMode           = System.Windows.Forms.DataGridViewTriState.False;
                    this.dataViewTd.DefaultCellStyle          = dataGridViewCellStyle1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Form:" + ex.Message);
            }
        }
Ejemplo n.º 13
0
        public async static void LoginFacebookSuccess(FacebookResponse profile)
        {
            if (profile == null)
            {
                Current.MainPage = new NavigationPage(new LoginView());
                return;
            }

            var apiService    = new ApiService();
            var dialogService = new DialogService();

            var checkConnetion = await apiService.CheckConnection();

            if (!checkConnetion.IsSuccess)
            {
                await dialogService.ShowMessage("Error", checkConnetion.Message);

                return;
            }

            var urlAPI = Application.Current.Resources["URLAPI"].ToString();
            var token  = await apiService.LoginFacebook(
                urlAPI,
                "/api",
                "/Customers/LoginFacebook",
                profile);

            if (token == null)
            {
                await dialogService.ShowMessage(
                    "Error",
                    "Problem ocurred retrieving user information, try latter.");

                Current.MainPage = new NavigationPage(new LoginView());
                return;
            }

            var mainViewModel = MainViewModels.GetInstance();

            mainViewModel.Token      = token;
            mainViewModel.Categories = new CategoriesViewModel();
            Current.MainPage         = new MasterView();
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> GetWorkingHours()
        {
            MainViewModels mvm = new MainViewModels();

            mvm.emplist = await _db.Employees.ToListAsync();

            mvm.loginlist = await _db.LoginUsers.ToListAsync();

            mvm.emplist   = mvm.emplist.OrderBy(e => e.EmployeeId).ToList();
            mvm.loginlist = mvm.loginlist.OrderBy(u => u.UserID).ToList();
            foreach (Employee e in mvm.emplist)
            {
                mvm.employee = e;
            }
            foreach (LoginUser lu in mvm.loginlist)
            {
                mvm.Login = lu;
            }
            return(View("WorkingHours", mvm));
        }
Ejemplo n.º 15
0
 /// <summary>
 /// 分屏启动界面
 /// </summary>
 private void RunForms()
 {
     try
     {
         Screen[] scs  = Screen.AllScreens;
         int      left = 0;
         for (int i = 0; i < scs.Length; i++)
         {
             if (appConfig.Screenlist.Length > i)
             {
                 ScreenConfig   fConfig   = appConfig.Screenlist[i];
                 MainViewModels viewmodel = new MainViewModels();
                 MainForm       f         = new MainForm(fConfig, viewmodel, adam, opc, mwCard)
                 {
                     StartPosition = FormStartPosition.Manual,
                     Location      = new System.Drawing.Point(left + 10, scs[i].Bounds.Top)
                 };
                 left += scs[i].Bounds.Right;
                 f.Show();
                 forms.Add(f);
                 ViewModels.Add(viewmodel);
                 if (i == 0)
                 {
                     MainForm = f;
                 }
                 viewmodel.OnWorkCompate = WorkComplate;
                 Log.Information("启动窗体:{Title}", appConfig.Screenlist[i].Title);
             }
         }
         Log.Information("窗口加载完成");
     }
     catch (Exception ex)
     {
         Log.Error(ex, "启动界面报错");
     }
 }
Ejemplo n.º 16
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new MainViewModels();
 }
 public MainViewModels()
 {
     instance = this;
     this.Id  = new PhotosViewModel();
 }
Ejemplo n.º 18
0
 async void Edit()
 {
     MainViewModels.GetInstance().EditProduct = new EditProductViewModel(this);
     await navigationService.NavigateOnMaster("EditProductView");
 }
Ejemplo n.º 19
0
 public InstanceLocator()
 {
     Main = new MainViewModels();
 }
Ejemplo n.º 20
0
        public MainPage()
        {
            InitializeComponent();

            BindingContext = new MainViewModels();
        }
Ejemplo n.º 21
0
 public Instancelocator()
 {
     this.Main = new MainViewModels();
 }