Esempio n. 1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (this.RoleId > 0)
     {
         RoleGetResponse roleGetResponse = LocalApi.Execute(new RoleGetRequest()
         {
             RoleId = this.RoleId
         });
         this.dialogTitle.Content = "修改角色";
         if (roleGetResponse.Role != null)
         {
             this.RoleName = roleGetResponse.Role.RoleName;
             this.Remark   = roleGetResponse.Role.Remark;
             List <string> permissionCodes = ((IEnumerable <string>)(roleGetResponse.Role.PermissionCodes ?? "").Split(',')).Where <string>(m => !string.IsNullOrEmpty(m)).ToList();
             this.Menus      = this.BuildMenuCodes(PermissionNode.BuildPermissionNodes((LocalApi.Execute(new PermissionListRequest())).Permissions), permissionCodes);
             permissionCodes = null;
         }
     }
     else
     {
         this.dialogTitle.Content = "添加角色";
         this.Menus = this.BuildMenuCodes(PermissionNode.BuildPermissionNodes((LocalApi.Execute(new PermissionListRequest())).Permissions), new List <string>());
     }
     this.DataContext = this;
 }
Esempio n. 2
0
        //刷新状态
        public void RefreshStates()
        {
            foreach (CraftModel craft in (LocalApi.GetCraftsList(new CraftListRequest())).Crafts)
            {
                string craftShortNo = CommonHelper.GetCraftShortNO(craft.CraftNO);
                StateCycle.StateCycleItem stateCycleItem = this.stateCycleItems.FirstOrDefault <StateCycle.StateCycleItem>(m => m.Name == craftShortNo);
                if (stateCycleItem != null)
                {
                    MainPage.StateCycleItemData stateCycleItemData = (MainPage.StateCycleItemData)stateCycleItem.Tag;
                    if (stateCycleItemData != null)
                    {
                        stateCycleItemData.CraftDID = craft.CraftDID;
                        stateCycleItemData.CraftNO  = craft.CraftNO;
                    }
                    stateCycleItem.State = craft.State;
                }
            }
            ProductionLineProbablyGetResponse probablyGetResponse = LocalApi.Execute(new ProductionLineProbablyGetRequest()
            {
                DID = 1
            });

            if (probablyGetResponse.ProductionLineProbably != null)
            {
                //this.lineProbably.BindData(probablyGetResponse.ProductionLineProbably);
                this.stateCycle.Setup(this.stateCycleItems);
            }
        }
Esempio n. 3
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.viewModel.FieldName))
            {
                MessageBox.Show("字段名称不能为空");
            }
            else if (!new Regex("^[a-zA-Z][a-zA-Z0-9_]*$").IsMatch(this.viewModel.FieldName))
            {
                MessageBox.Show("字段名称必须由字母、数字、_组成");
            }
            else if (string.IsNullOrEmpty(this.viewModel.FieldDescription))
            {
                MessageBox.Show("字段说明不能为空");
            }
            else
            {
                AlarmFieldSaveResponse fieldSaveResponse = LocalApi.Execute(new AlarmFieldSaveRequest()
                {
                    FieldDescription = this.viewModel.FieldDescription,
                    FieldName        = this.viewModel.FieldName
                });

                if (fieldSaveResponse.IsError)
                {
                    int num4 = (int)MessageBox.Show(fieldSaveResponse.ErrMsg, "提示");
                }
                else
                {
                    int num5 = (int)MessageBox.Show("提交成功", "提示");
                    this.Reset();
                }
            }
        }
Esempio n. 4
0
        private void Init()
        {
            OneKeyResponse oneKeyResponse = LocalApi.OneKey(new OneKeyRequest()
            {
            });

            isReady = oneKeyResponse.oneKeys.Select(m => m.OneKey_flag).ToArray()[0];

            if (isReady == 0)
            {
                oneKey_flag   = true;
                label.Content = "启动中。。。";
                //btnOneKey.Content = "停止";
                button.Content  = "启动中。。。";
                RecGO_DOWN.Fill = new SolidColorBrush(Color.FromRgb(0, 255, 64));
            }
            else if (isReady == 1)
            {
                oneKey_flag   = false;
                label.Content = "停止中。。。";
                //btnOneKey.Content = "启动";
                //button.Content = "启动中。。。";
                RecGO_DOWN.Fill = new SolidColorBrush(Color.FromRgb(255, 0, 0));
            }
        }
Esempio n. 5
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            this.model       = new AlarmRuleModel();
            this.DataContext = this.model;
            AlarmFieldListResponse fieldListResponse = LocalApi.Execute(new AlarmFieldListRequest());

            for (int index = 0; index < fieldListResponse.AlarmFields.Count; ++index)
            {
                AlarmFieldModel alarmFieldModel = fieldListResponse.AlarmFields[index];
                this.formGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(60.0)
                });
                TextBlock textBlock = new TextBlock();
                textBlock.Text = alarmFieldModel.FieldDescription + ":";
                Grid.SetRow(textBlock, this.formGrid.RowDefinitions.Count - 2);
                Grid.SetColumn(textBlock, 0);
                TextBox textBox = new TextBox();
                textBox.Height = 36;
                textBox.Width  = 320;

                Grid.SetRow(textBox, this.formGrid.RowDefinitions.Count - 2);
                Grid.SetColumn(textBox, 1);
                this.formGrid.Children.Add(textBlock);
                this.formGrid.Children.Add(textBox);
                formGrid.VerticalAlignment   = VerticalAlignment.Center;
                formGrid.HorizontalAlignment = HorizontalAlignment.Left;

                this.dicFields.Add(alarmFieldModel.FieldName, textBox);
            }
            this.ddlCraft.ItemsSource     = (LocalApi.GetCraftsList(new CraftListRequest())).Crafts.Where(m => AppContext.Current.CraftDIDs.Contains(m.CraftDID));
            this.ddlUnit.ItemsSource      = (LocalApi.Execute(new UnitListRequest())).Units;
            this.ddlAlarmType.ItemsSource = (LocalApi.Execute(new AlarmTypeListRequest())).AlarmTypes;
        }
Esempio n. 6
0
        private void RefreshData()
        {
            PermissionListResponse permissionListResponse = LocalApi.Execute(new PermissionListRequest());

            if (permissionListResponse.Permissions == null)
            {
                return;
            }
            List <PermissionModel> permissionModelList = new List <PermissionModel>();

            //重新排序
            foreach (PermissionModel permissionModel in permissionListResponse.Permissions.Where(m => !m.ParentId.HasValue))
            {
                PermissionModel tm = permissionModel;
                permissionModelList.Add(tm);  //先显示根对象
                permissionModelList.AddRange(permissionListResponse.Permissions.Where(m =>
                {
                    int?parentId     = m.ParentId;
                    int permissionId = tm.PermissionId;
                    if (parentId.GetValueOrDefault() != permissionId)
                    {
                        return(false);
                    }
                    return(parentId.HasValue);
                }));  //再显示该根对象下的子对象
            }

            this.dataGrid.ItemsSource = permissionModelList;
        }
Esempio n. 7
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     this.model = (LocalApi.Execute(new CraftDetailGetRequest()
     {
         CraftDID = this.CraftDID
     })).CraftDetail;
     this.DataContext = this.model;
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     this.model = (LocalApi.Execute(new ProductionLineProbablyGetRequest()
     {
         DID = this.ProductionLineProbablyDID
     })).ProductionLineProbably;
     this.DataContext = this.model;
 }
Esempio n. 9
0
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterInstance <ITokenRepository>(new TokenRepository());

            var localApi = LocalApi.GetInstance();
            var localize = DependencyService.Get <ILocalize>();

            InitCultureAsync(localApi, localize).Wait();

            var httpService = new HttpService(ServerConfig.Address);

            containerRegistry.RegisterInstance <IHttpService>(httpService);

            containerRegistry.RegisterInstance <ILocalApi>(localApi);
            containerRegistry.RegisterInstance <ILocalize>(localize);

            var emailActivationService = new EmailActivationService(httpService);

            var localTokenService = new LocalTokenService(localApi);
            var tokenService      = new TokenService(localTokenService, httpService);

            var ticketsService     = new TicketsService(tokenService, httpService);
            var transactionService = new TransactionService(httpService);

            var userService   = new UserService(httpService);
            var userValidator = new UserValidator(httpService);

            containerRegistry.RegisterInstance <IUserValidator>(userValidator);

            containerRegistry.RegisterInstance <IUserService>(userService);
            containerRegistry.RegisterInstance <ILocalTokenService>(localTokenService);
            containerRegistry.RegisterInstance <IEmailActivationService>(emailActivationService);
            containerRegistry.RegisterInstance <ITokenService>(tokenService);
            containerRegistry.RegisterInstance <ITicketsService>(ticketsService);
            containerRegistry.RegisterInstance <ITransactionService>(transactionService);

            containerRegistry.RegisterForNavigation <NavigationPage>();
            containerRegistry.RegisterForNavigation <MainView, MainViewModel>();
            containerRegistry.RegisterForNavigation <LoginView, LoginViewModel>();
            containerRegistry.RegisterForNavigation <EmailRegistrationView, EmailRegistrationViewModel>();
            containerRegistry.RegisterForNavigation <NameRegistrationView, NameRegistrationViewModel>();
            containerRegistry.RegisterForNavigation <PasswordRegistrationView, PasswordRegistrationViewModel>();
            containerRegistry.RegisterForNavigation <BirthdayRegistrationView, BirthdayRegistrationViewModel>();
            containerRegistry.RegisterForNavigation <ForgotPasswordView, ForgotPasswordViewModel>();
            containerRegistry.RegisterForNavigation <TicketsView, TicketsViewModel>();
            containerRegistry.RegisterForNavigation <PhoneRegistrationView, PhoneRegistrationViewModel>();
            containerRegistry.RegisterForNavigation <ConfirmEmailView, ConfirmEmailViewModel>();
            containerRegistry.RegisterForNavigation <ConfirmForgotPasswordView, ConfirmForgotPasswordViewModel>();
            containerRegistry.RegisterForNavigation <CreateNewPasswordView, CreateNewPasswordViewModel>();
            containerRegistry.RegisterForNavigation <LiqPayView, LiqPayViewModel>();
            containerRegistry.RegisterForNavigation <TransactionCompletedView, TransactionCompletedViewModel>();
            containerRegistry.RegisterForNavigation <MainMenuView, MainMenuViewModel>();
            containerRegistry.RegisterForNavigation <UserAccountView, UserAccountViewModel>();
            containerRegistry.RegisterForNavigation <SettingsView, SettingsViewModel>();
            containerRegistry.RegisterForNavigation <UserTransactionsView, UserTransactionsViewModel>();
            containerRegistry.RegisterForNavigation <LocalizationView, LocalizationViewModel>();
            containerRegistry.RegisterForNavigation <MyTicketsView, MyTicketsViewModel>();
        }
Esempio n. 10
0
        public int?GetGetFacilityStateByCraft(int craftDID)
        {
            CraftStateGetResponse stateGetResponse = LocalApi.Execute(new CraftStateGetRequest()
            {
                CraftDID = craftDID
            });

            return(stateGetResponse.IsError ? new int?() : new int?(stateGetResponse.State));
        }
Esempio n. 11
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     this.model = (LocalApi.Execute(new PermissionGetRequest()
     {
         PermissionId = this.PermissionId
     }
                                    )).Permission;
     this.DataContext = this.model;
 }
Esempio n. 12
0
        private void LoadCraftChartData()
        {
            DataPicResponse datapicResponse = LocalApi.ExcutePicCapacity(new DataPicRequest()
            {
            });

            arrayNo   = datapicResponse.DataPics.Select(m => m.Iden).ToArray();
            arrayDate = datapicResponse.DataPics.Select(m => m.ProductTime).ToArray();
        }
Esempio n. 13
0
        private void LoadCraftChartData()
        {
            string result = ddlType.Text;
            string type   = ddlType.Text;

            time = ddlTime.Text;
            //timec = ddlTimes.Text;

            if (Date.Text != "")
            {
                Datee = DateTime.Parse(Date.Text);
            }
            else
            {
                //Dates = DateTime.Now;
                Datee = DateTime.Now.Date;
            }
            if (time == "")
            {
                time = "早";
            }
            this.model       = new UserModel();
            this.DataContext = this.model;
            result           = ChangeLanguage(ddlSize.Text, result);
            UserSaveResponse userSaveResponse = LocalApi.ExecuteAve(
                new UserSaveRequest()
            {
            });
            AVEResponse aveResponse = LocalApi.ExcuteAVE2(new AVERequest()
            {
                side = result, datee = Datee, type = type
            });
            AVEResponse aveResponses = LocalApi.ExcuteType(new AVERequest()
            {
                datee = Datee
            });

            this.ddlSize.ItemsSource = SizeMeas2.MainBody_Width_Top.ToArrayList();
            this.ddlTime.ItemsSource = TimeC.Mornings.ToArrayList();
            //this.ddlTimes.ItemsSource = TimeS.Mins.ToArrayList();
            arrayNo   = aveResponse.Aves.Select(m => m.Size).ToArray();
            arrayDate = aveResponse.Aves.Select(m => m.TimeStart).ToArray();
            arrayType = aveResponses.Aves.Select(n => n.Type).ToArray();
            this.ddlType.Items.Clear();
            //this.ddlType.DisplayMemberPath = arrayType[0];
            for (int a = 0; a < arrayType.Length; a++)
            {
                this.ddlType.Items.Add(arrayType[a]);
                if (arrayType[a] == type)
                {
                    this.ddlType.IsEditable = true;
                    this.ddlType.Text       = type;
                }
            }
            //SetArrayDateLast(time,0);
        }
Esempio n. 14
0
        public void RefreshData()
        {
            RoleListResponse roleListResponse = LocalApi.Execute(new RoleListRequest()
            {
                PageNumber = this.pager.PageNumber, PageSize = 10
            });

            this.pager.Setup(roleListResponse.Roles);
            this.dataGrid.ItemsSource = roleListResponse.Roles;
        }
Esempio n. 15
0
        private void DownMenu(PermissionModel model)
        {
            PermissionOrderResponse permissionOrderResponse = LocalApi.Execute(new PermissionOrderRequest()
            {
                PermissionId = model.PermissionId,
                Direction    = PermissionOrderRequest.DirectionType.Down
            });

            this.RefreshData();
        }