コード例 #1
0
ファイル: VkApiSettings.cs プロジェクト: ukionik/VDesktopeNew
 public VkApiSettings(IAppConfig config)
 {
     Language = GetVkLanguage(config.Language);
     Permissions = AppPermissions.Messages
                   | AppPermissions.Notifications
                   | AppPermissions.Friends
                   | AppPermissions.Offline;
 }
コード例 #2
0
    public async Task <bool> Update()
    {
        if (await AppPermissions.LocationWhenInUsePermission().ConfigureAwait(false) != PermissionStatus.Granted)
        {
            return(false);
        }

        State status = await GetLocationAsync().ConfigureAwait(false);

        return(status == State.Success);
    }
コード例 #3
0
    public void AppPermissions()
    {
        TestTwiceWith(new AppPermissions(0));
        TestTwiceWith(new AppPermissions(0, null));
        TestTwiceWith(new AppPermissions(1, 100));
        TestTwiceWith(new AppPermissions(2, 100, 101));
        var ap = new AppPermissions("#3,1,2,3");

        Assert.AreEqual("#3,1,2,3", ap.TextualRepresentation);
        TestTwiceWith(ap);
        TestTwiceWith(new AppPermissions(4, 100, 4, 101, 3));
    }
コード例 #4
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowLearningPlanForm()
        {
            if (!AppPermissions.Check("LearningPlanForm"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_learningPlanFormOpened)
            {
                LearningPlanForm.Activate();
                NoteForm.Focus();
                return;
            }

            LearningPlanForm        = new LearningPlanList(ApiEndpoint);
            _learningPlanFormOpened = true;
            LearningPlanForm.Show();
            _learningPlanFormOpened = false;
        }
コード例 #5
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowDepartmentForm()
        {
            if (!AppPermissions.Check("DepartmentForm"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_departmentFormOpened)
            {
                DepartmentForm.Activate();
                DepartmentForm.Focus();
                return;
            }

            DepartmentForm        = new DepartmentList(ApiEndpoint);
            _departmentFormOpened = true;
            DepartmentForm.Show();
            _departmentFormOpened = false;
        }
コード例 #6
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowTeacherForm()
        {
            if (!AppPermissions.Check("TeacherForm"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_teacherFormOpened)
            {
                TeacherForm.Activate();
                TeacherForm.Focus();
                return;
            }

            TeacherForm        = new TeacherList(ApiEndpoint);
            _teacherFormOpened = true;
            TeacherForm.Show();
            _teacherFormOpened = false;
        }
コード例 #7
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowFacultyForm()
        {
            if (!AppPermissions.Check("FacultyForm"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_facultyFormOpened)
            {
                FacultyForm.Activate();
                FacultyForm.Focus();
                return;
            }

            FacultyForm        = new FacultyList(ApiEndpoint);
            _facultyFormOpened = true;
            FacultyForm.Show();
            _facultyFormOpened = false;
        }
コード例 #8
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowStudentGroupsForm()
        {
            if (!AppPermissions.Check("StudentGroupsForm"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_studentGroupsFormOpened)
            {
                StudentGroupsForm.Activate();
                StudentGroupsForm.Focus();
                return;
            }

            StudentGroupsForm        = new StudentGroupList(ApiEndpoint);
            _studentGroupsFormOpened = true;
            StudentGroupsForm.Show();
            _studentGroupsFormOpened = false;
        }
コード例 #9
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowPhoneForm()
        {
            if (!AppPermissions.Check("PhoneForm"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_phoneFormOpened)
            {
                PhoneForm.Activate();
                PhoneForm.Focus();
                return;
            }

            PhoneForm        = new PhoneForm(ApiEndpoint);
            _phoneFormOpened = true;
            PhoneForm.Show();
            _phoneFormOpened = false;
        }
コード例 #10
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowPositionYearRateHoursForm()
        {
            if (!AppPermissions.Check("PositionYearRateHoursList"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_positionYearRateHoursListOpened)
            {
                PositionYearRateHoursForm.Activate();
                PositionYearRateHoursForm.Focus();
                return;
            }

            PositionYearRateHoursForm        = new PositionYearRateHoursList(ApiEndpoint);
            _positionYearRateHoursListOpened = true;
            PositionYearRateHoursForm.Show();
            _positionYearRateHoursListOpened = false;
        }
コード例 #11
0
ファイル: StartupForm.cs プロジェクト: BesuglovS/nudata
        private void ShowMarkTypeForm()
        {
            if (!AppPermissions.Check("MarkTypeList"))
            {
                MessageBox.Show("У вас нет разрешения на использование этой части приложения.");

                return;
            }

            if (_markTypeListOpened)
            {
                MarkTypeForm.Activate();
                MarkTypeForm.Focus();
                return;
            }

            MarkTypeForm        = new MarkTypeList(ApiEndpoint);
            _markTypeListOpened = true;
            MarkTypeForm.Show();
            _markTypeListOpened = false;
        }
コード例 #12
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var db = DbService.db();

            // install tables for fresh installations

            if (!db.TableExist("pipelineContact"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineContact not found.");
                db.CreateTable(false, new Contact().GetType());

                // set max lengths as petapoco decoration was deprecated: https://our.umbraco.org/forum/developers/extending-umbraco/66609-umbracocorepersistence-ntext-deprecated-nvarchar-max
                db.Execute("ALTER table pipelineContact ALTER COLUMN CustomProps nvarchar(max)");
            }

            if (!db.TableExist("pipelineContactType"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineContactType not found.");
                db.CreateTable(false, new ContactType().GetType());

                db.Save(new ContactType()
                {
                    Name = "Prospects"
                });
                db.Save(new ContactType()
                {
                    Name = "Clients"
                });
            }
            if (!db.TableExist("pipelineOrganisation"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineOrganisation not found.");
                db.CreateTable(false, new Organisation().GetType());
                db.Execute("ALTER table pipelineOrganisation ALTER COLUMN CustomProps nvarchar(max)");
            }
            if (!db.TableExist("pipelineOrganisationType"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineOrganisationType not found.");
                db.CreateTable(false, new OrgType().GetType());

                db.Save(new OrgType()
                {
                    Name = "Prospects"
                });
                db.Save(new OrgType()
                {
                    Name = "Clients"
                });
            }
            if (!db.TableExist("pipelinePipeline"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelinePipeline not found.");
                db.CreateTable(false, new Pipeline().GetType());
                db.Execute("ALTER table pipelinePipeline ALTER COLUMN CustomProps nvarchar(max)");
            }
            if (!db.TableExist("pipelineLabel"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineLabel not found.");
                db.CreateTable(false, new Label().GetType());

                db.Save(new Label()
                {
                    Name = "Danger", Value = "#d9534f"
                });
                db.Save(new Label()
                {
                    Name = "Warning", Value = "#f0ad4e"
                });
                db.Save(new Label()
                {
                    Name = "Info", Value = "#5bc0de"
                });
                db.Save(new Label()
                {
                    Name = "Success", Value = "#5cb85c"
                });
                db.Save(new Label()
                {
                    Name = "Primary", Value = "#337ab7"
                });
                db.Save(new Label()
                {
                    Name = "Default", Value = "#cccccc"
                });
            }
            if (!db.TableExist("pipelineStatus"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineStatus not found.");
                db.CreateTable(false, new Status().GetType());

                db.Save(new Status()
                {
                    Name = "Prospect"
                });
                db.Save(new Status()
                {
                    Name = "Won"
                });
                db.Save(new Status()
                {
                    Name = "Lost"
                });
            }
            if (!db.TableExist("pipelineTask"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineTask not found.");
                db.CreateTable(false, new Task().GetType());
            }


            if (!db.TableExist("pipelinePreferences"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelinePreferences not found.");
                db.CreateTable(false, new Preferences().GetType());
            }

            // install tables for fresh installations
            if (!db.TableExist("pipelineSegment"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineSegment not found.");
                db.CreateTable(false, new Segment().GetType());
                db.Execute("ALTER table pipelineSegment ALTER COLUMN CustomProps nvarchar(max)");
                db.Execute("ALTER table pipelineSegment ALTER COLUMN CriteriaProps nvarchar(max)");
            }

            if (!db.TableExist("pipelineSegmentType"))
            {
                LogHelper.Info(MethodBase.GetCurrentMethod().DeclaringType, "pipelineSegmentType not found.");
                db.CreateTable(false, new SegmentType().GetType());

                db.Save(new SegmentType()
                {
                    Name = "Sectors"
                });
                db.Save(new SegmentType()
                {
                    Name = "Source"
                });
            }

            // translate files
            TranslationHelper.AddTranslations();

            // add admin user to pipeline if not already added
            AppPermissions.Grant("pipelineCrm");

            // Copy icon
            if (!File.Exists(HttpContext.Current.Server.MapPath("/umbraco/images/tray/PipelineCRM-icon.png")))
            {
                File.Copy(HttpContext.Current.Server.MapPath("/App_plugins/PipelineCRM/PipelineCRM-icon.png"),
                          HttpContext.Current.Server.MapPath("/umbraco/images/tray/PipelineCRM-icon.png"));
            }

            // v1.08 Add Segment Priority column
            db.Execute(@"
                IF COL_LENGTH('pipelineSegment', 'Priority') IS NULL
                BEGIN
                    ALTER TABLE pipelineSegment
                    ADD Priority INT
                END
            ");

            // update tables for upgrades
            // note: SQL CE doesn't support IF :(

            /*db.Execute(@"
             *  IF COL_LENGTH('pipelineTask','SegmentId') IS NULL
             *  BEGIN
             *      ALTER TABLE pipelineTask ADD SegmentId INT
             *  END
             *  ");
             *
             * db.Execute(@"
             *  if col_length('pipelinePreferences','SendDigest') is null
             *  begin
             *      alter table pipelinePreferences add SendDigest int
             *  end
             * ");*/
        }