Пример #1
0
 public HomeController(IDataCenterRepository _centerRepository, IMaterialRepository _materialRepository, IAccountRepository _rightRepository, IManagementRepository _managementRepository)
 {
     centerService = new DataCenterService(_centerRepository);
     accountService = new AccountService(_rightRepository);
     materialService = new MaterialService(_materialRepository);
     managementService = new ManagementService(_managementRepository);
 }
Пример #2
0
 public override void executeJob(Job job)
 {
     assertNotNull("Job to execute does not exist", job);
     ManagementService.executeJob(job.Id);
 }
Пример #3
0
        private string GenerateSpreadsheetforGroupedWorksheet(long ScopeId, HttpContext context)
        {
            String        result          = String.Empty;
            ScopeServices objScopeService = new ScopeServices();

            objScopeService.SQLConnection = ConnectDb.SQLConnection;
            ManagementService objManagementService = new ManagementService();

            objManagementService.SQLConnection = ConnectDb.SQLConnection;

            Scope        objScope   = objScopeService.GetScopeByScopeId(ScopeId);
            Project      objProject = objManagementService.GetProjectByProjectId(objScope.ProjectId);
            DataSet      dsQuery    = new DataSet();
            int          intFootTotalStartRow;
            int          intFootTotalStartColum;
            int          intCompanyInfoStartRow;
            int          intCompanyInfoStartColum;
            String       strExcelFile;
            String       strNewExcelFileName;
            DataSet      dsProjectGroup     = new DataSet();
            String       strClaimNo         = "";
            String       strClaimant        = "";
            String       strSiteLocation    = "";
            String       strEQRSupervisor   = "";
            String       strContractorEmail = "";
            String       strScopeDate       = "";
            String       strContractor      = "";
            String       strAddress         = "";
            String       strAccreditationNo = "";
            String       strContractorPhone = "";
            String       strGSTNo           = "";
            String       strTotalPrice      = "";
            DataSet      dsProject          = new DataSet();
            ProjectOwner projectOwner       = new ProjectOwner();
            String       strLogo            = "";

            dsProjectGroup = objScopeService.GetProjectGroupsByProjectOwnerId(objProject.ProjectOwnerId);
            dsProject      = objManagementService.GetProjectInfoByProjectId(objScope.ProjectId);

            //get project group email
            if (dsProjectGroup.Tables.Count > 0)
            {
                if (dsProjectGroup.Tables[0].Rows.Count > 0)
                {
                    if (!Convert.IsDBNull(dsProjectGroup.Tables[0].Rows[0]["Email"]))
                    {
                        strContractorEmail = dsProjectGroup.Tables[0].Rows[0]["Email"].ToString();
                    }
                }
            }
            //get claimant detail
            if (!Convert.IsDBNull(dsProject.Tables[0].Rows[0]["EQCClaimNumber"]))
            {
                strClaimNo = dsProject.Tables[0].Rows[0]["EQCClaimNumber"].ToString();
            }
            if (!Convert.IsDBNull(dsProject.Tables[0].Rows[0]["ScopeDate"]))
            {
                strScopeDate = dsProject.Tables[0].Rows[0]["ScopeDate"].ToString();
            }
            if (!Convert.IsDBNull(dsProject.Tables[0].Rows[0]["ScopeDate"]))
            {
                strScopeDate = Convert.ToDateTime(dsProject.Tables[0].Rows[0]["ScopeDate"]).ToString("dd/MM/yyyy");
            }

            if (!Convert.IsDBNull(dsProject.Tables[0].Rows[0]["Address"]))
            {
                strSiteLocation = dsProject.Tables[0].Rows[0]["Address"].ToString();
            }

            if (!Convert.IsDBNull(dsProject.Tables[0].Rows[0]["ContactName"]))
            {
                strClaimant = dsProject.Tables[0].Rows[0]["ContactName"].ToString();
            }

            //get project owner detail
            projectOwner       = objManagementService.GetProjectOwnerByProjectOwnerId(objProject.ProjectOwnerId);
            strEQRSupervisor   = projectOwner.EQRSupervisor;
            strContractor      = projectOwner.Name;
            strContractorPhone = projectOwner.Contact1;
            strAddress         = projectOwner.Address;
            strGSTNo           = projectOwner.GSTNumber;
            strAccreditationNo = projectOwner.AccreditationNumber;
            String ApprovedexcludeGstCost = objScope.Cost.ToString("c");
            String ApprovedGSTCost        = (objScope.Total - objScope.Cost).ToString("c");
            String ApprovedInGSTCost      = objScope.Total.ToString("c");

            String GrandExGSTCost = (objScope.Cost1 + objScope.Cost).ToString("c");
            String GrandInGSTCost = (objScope.Total1 + objScope.Total).ToString("c");

            strTotalPrice = ApprovedInGSTCost;

            //Company Logo
            strLogo = String.Format("{0}/Images/{1}/{2}", "http://koreprojects.com", projectOwner.Identifier, projectOwner.Logo);

            strNewExcelFileName = String.Empty;

            String strExcelFileNameTemp = Strings.StrConv(strSiteLocation, VbStrConv.ProperCase);
            int    ascChar;

            for (int index = 0; index < strExcelFileNameTemp.Length - 1; index++)
            {
                ascChar = Strings.Asc(strExcelFileNameTemp[index]);
                if ((ascChar >= 65 && ascChar <= 90) || (ascChar >= 97 && ascChar <= 122) || (ascChar >= 48 && ascChar <= 57))
                {
                    strNewExcelFileName = strNewExcelFileName + strExcelFileNameTemp[index];
                }
                else
                {
                    strNewExcelFileName = strNewExcelFileName + "-";
                }
            }
            do
            {
                strNewExcelFileName = Strings.Replace(strNewExcelFileName, "--", "-");
            } while (strNewExcelFileName.Contains("--"));
            if (strNewExcelFileName.Substring(0, 1) == "-")
            {
                strNewExcelFileName = strNewExcelFileName.Substring(1);
            }
            if (strNewExcelFileName.Substring(strNewExcelFileName.Length - 1) == "-")
            {
                strNewExcelFileName = strNewExcelFileName.Substring(0, strNewExcelFileName.Length - 1);
            }
            if (strNewExcelFileName.Length > 20)
            {
                strNewExcelFileName = strNewExcelFileName.Substring(0, 20);
            }
            strExcelFile = String.Format("../Downloads/{0}/{1}.xls", "ExcelExport", strNewExcelFileName);

            if ((!System.IO.Directory.Exists(String.Format("../Downloads/{0}", "ExcelExport"))))
            {
                System.IO.Directory.CreateDirectory(String.Format("../Downloads/{0}", "ExcelExport"));
            }

            WorkSheet workSheet = new WorkSheet();

            //initialzing the cellexport tool
            cellExport = new Spire.DataExport.XLS.CellExport();
            cellExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            //culture format setting
            cellExport.DataFormats.CultureName = "en-NZ";
            cellExport.DataFormats.Currency    = "#,###,##0.00";
            cellExport.DataFormats.DateTime    = "dd/MM/yyyy H:mm";
            cellExport.DataFormats.Float       = "#,###,##0.00";
            cellExport.DataFormats.Integer     = "#,###,##0";
            cellExport.DataFormats.Time        = "H:mm";
            //set up file name and location
            cellExport.FileName = strExcelFile;

            //outlook formating
            cellExport.SheetOptions.AggregateFormat.Font.Name         = "Arial";
            cellExport.SheetOptions.CustomDataFormat.Font.Name        = "Arial";
            cellExport.SheetOptions.DefaultFont.Name                  = "Arial";
            cellExport.SheetOptions.FooterFormat.Font.Name            = "Arial";
            cellExport.SheetOptions.HeaderFormat.Font.Name            = "Arial";
            cellExport.SheetOptions.HyperlinkFormat.Font.Color        = Spire.DataExport.XLS.CellColor.Blue;
            cellExport.SheetOptions.HyperlinkFormat.Font.Name         = "Arial";
            cellExport.SheetOptions.HyperlinkFormat.Font.Underline    = Spire.DataExport.XLS.XlsFontUnderline.Single;
            cellExport.SheetOptions.NoteFormat.Alignment.Horizontal   = Spire.DataExport.XLS.HorizontalAlignment.Left;
            cellExport.SheetOptions.NoteFormat.Alignment.Vertical     = Spire.DataExport.XLS.VerticalAlignment.Top;
            cellExport.SheetOptions.NoteFormat.Font.Bold              = true;
            cellExport.SheetOptions.NoteFormat.Font.Name              = "Tahoma";
            cellExport.SheetOptions.NoteFormat.Font.Size              = 8.0F;
            cellExport.SheetOptions.TitlesFormat.FillStyle.Background = Spire.DataExport.XLS.CellColor.Gray40Percent;
            cellExport.SheetOptions.TitlesFormat.Font.Bold            = true;
            cellExport.SheetOptions.TitlesFormat.Font.Name            = "Arial";

            //worksheet culture format
            workSheet.FormatsExport.CultureName = "en-NZ";
            workSheet.FormatsExport.Currency    = "#,###,##0.00";
            workSheet.FormatsExport.DateTime    = "dd/MM/yyyy H:mm";
            workSheet.FormatsExport.Float       = "#,###,##0.00";
            workSheet.FormatsExport.Integer     = "#,###,##0";
            workSheet.FormatsExport.Time        = "H:mm";

            //worksheet outlook format;
            workSheet.Options.AggregateFormat.Font.Name       = "Arial";
            workSheet.Options.CustomDataFormat.Font.Name      = "Arial";
            workSheet.Options.DefaultFont.Name                = "Arial";
            workSheet.Options.FooterFormat.Font.Name          = "Arial";
            workSheet.Options.HeaderFormat.Font.Name          = "Arial";
            workSheet.Options.HyperlinkFormat.Font.Color      = Spire.DataExport.XLS.CellColor.Blue;
            workSheet.Options.HyperlinkFormat.Font.Name       = "Arial";
            workSheet.Options.HyperlinkFormat.Font.Underline  = Spire.DataExport.XLS.XlsFontUnderline.Single;
            workSheet.Options.NoteFormat.Alignment.Horizontal = Spire.DataExport.XLS.HorizontalAlignment.Left;
            workSheet.Options.NoteFormat.Alignment.Vertical   = Spire.DataExport.XLS.VerticalAlignment.Top;
            workSheet.Options.NoteFormat.Font.Bold            = true;
            workSheet.Options.NoteFormat.Font.Name            = "Tahoma";
            workSheet.Options.NoteFormat.Font.Size            = 8.0F;

            workSheet.Options.TitlesFormat.Font.Bold = true;
            workSheet.Options.TitlesFormat.Font.Name = "Arial";

            workSheet.Options.CustomDataFormat.Borders.Bottom.Color = Spire.DataExport.XLS.CellColor.Blue;
            workSheet.Options.CustomDataFormat.Borders.Left.Color   = Spire.DataExport.XLS.CellColor.Blue;
            workSheet.Options.CustomDataFormat.Borders.Right.Color  = Spire.DataExport.XLS.CellColor.Blue;
            workSheet.Options.CustomDataFormat.Borders.Top.Color    = Spire.DataExport.XLS.CellColor.Blue;
            workSheet.SheetName       = "Worksheet";
            workSheet.AutoFitColWidth = true;

            StripStyle stripStyle1 = new Spire.DataExport.XLS.StripStyle();

            Cell mcell = new Spire.DataExport.XLS.Cell();

            mcell.Column = 1;
            mcell.Row    = 2;
            if (dsProjectGroup.Tables.Count > 0)
            {
                if (dsProjectGroup.Tables[0].Rows.Count > 0)
                {
                    mcell.Value = String.Format("{0} - Contractor's Quote", dsProjectGroup.Tables[0].Rows[0]["Name"]);
                }
                else
                {
                    mcell.Value = String.Format("Contractor's Quote");
                }
            }
            else
            {
                mcell.Value = String.Format("Contractor's Quote");
            }
            mcell.CellType       = Spire.DataExport.XLS.CellType.String;
            workSheet.HeaderRows = 15;
            workSheet.Cells.Add(mcell);

            intCompanyInfoStartRow   = 8;
            intCompanyInfoStartColum = 1;

            CellPicture pic1 = new Spire.DataExport.XLS.CellPicture();

            pic1.FileName = strLogo; //need to find out where the logo is
            pic1.Name     = "Logo";

            cellExport.Pictures.Add(pic1);

            CellImage img1 = new Spire.DataExport.XLS.CellImage();

            img1.Column      = 3;
            img1.PictureName = "Logo";
            img1.Row         = 1;
            workSheet.Images.Add(img1);

            Cell mcell1 = new Spire.DataExport.XLS.Cell();

            mcell1.Column   = intCompanyInfoStartColum;
            mcell1.Row      = intCompanyInfoStartRow;
            mcell1.Value    = "Claim No:";
            mcell1.CellType = CellType.String;
            workSheet.Cells.Add(mcell1);


            Cell mcell2 = new Spire.DataExport.XLS.Cell();

            mcell2.Column   = intCompanyInfoStartColum;
            mcell2.Row      = intCompanyInfoStartRow + 1;
            mcell2.Value    = "Claimant:";
            mcell2.CellType = CellType.String;
            workSheet.Cells.Add(mcell2);


            Cell mcell3 = new Spire.DataExport.XLS.Cell();

            mcell3.Column   = intCompanyInfoStartColum;
            mcell3.Row      = intCompanyInfoStartRow + 2;
            mcell3.Value    = "Site Location:";
            mcell3.CellType = CellType.String;
            workSheet.Cells.Add(mcell3);


            Cell mcell4 = new Spire.DataExport.XLS.Cell();

            mcell4.Column   = intCompanyInfoStartColum;
            mcell4.Row      = intCompanyInfoStartRow + 3;
            mcell4.Value    = "EQR Supervisor:";
            mcell4.CellType = CellType.String;
            workSheet.Cells.Add(mcell4);


            Cell mcell5 = new Spire.DataExport.XLS.Cell();

            mcell5.Column   = intCompanyInfoStartColum;
            mcell5.Row      = intCompanyInfoStartRow + 4;
            mcell5.Value    = "Contractor E-mail:";
            mcell5.CellType = CellType.String;
            workSheet.Cells.Add(mcell5);


            Cell mcell6 = new Spire.DataExport.XLS.Cell();

            mcell6.Column   = intCompanyInfoStartColum;
            mcell6.Row      = intCompanyInfoStartRow + 5;
            mcell6.Value    = "Date:";
            mcell6.CellType = CellType.String;
            workSheet.Cells.Add(mcell6);

            //'add contact detail head field contet
            //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Cell mcell1_2 = new Spire.DataExport.XLS.Cell();

            mcell1_2.Column   = intCompanyInfoStartColum + 1;
            mcell1_2.Row      = intCompanyInfoStartRow;
            mcell1_2.Value    = strClaimNo;
            mcell1_2.CellType = CellType.String;
            workSheet.Cells.Add(mcell1_2);

            Cell mcell2_2 = new Spire.DataExport.XLS.Cell();

            mcell2_2.Column   = intCompanyInfoStartColum + 1;
            mcell2_2.Row      = intCompanyInfoStartRow + 1;
            mcell2_2.Value    = strClaimant;
            mcell2_2.CellType = CellType.String;
            workSheet.Cells.Add(mcell2_2);


            Cell mcell3_2 = new Spire.DataExport.XLS.Cell();

            mcell3_2.Column   = intCompanyInfoStartColum + 1;
            mcell3_2.Row      = intCompanyInfoStartRow + 2;
            mcell3_2.Value    = strSiteLocation;
            mcell3_2.CellType = CellType.String;
            workSheet.Cells.Add(mcell3_2);


            Cell mcell4_2 = new Spire.DataExport.XLS.Cell();

            mcell4_2.Column   = intCompanyInfoStartColum + 1;
            mcell4_2.Row      = intCompanyInfoStartRow + 3;
            mcell4_2.Value    = strEQRSupervisor;
            mcell4_2.CellType = CellType.String;
            workSheet.Cells.Add(mcell4_2);


            Cell mcell5_2 = new Spire.DataExport.XLS.Cell();

            mcell5_2.Column   = intCompanyInfoStartColum + 1;
            mcell5_2.Row      = intCompanyInfoStartRow + 4;
            mcell5_2.Value    = strContractorEmail;
            mcell5_2.CellType = CellType.String;
            workSheet.Cells.Add(mcell5_2);


            Cell mcell6_2 = new Spire.DataExport.XLS.Cell();

            mcell6_2.Column = intCompanyInfoStartColum + 1;
            mcell6_2.Row    = intCompanyInfoStartRow + 5;
            // 'mcell6_2.Value = IIf(strScopeDate.Trim() = String.Empty, Today.ToString("dd/MM/yyyy"), strScopeDate)
            mcell6_2.Value    = DateTime.Now.ToString("dd/MM/yyyy");
            mcell6_2.CellType = CellType.String;
            workSheet.Cells.Add(mcell6_2);

            //'second part of heading
            //''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Cell mcell1_3 = new Spire.DataExport.XLS.Cell();

            mcell1_3.Column   = intCompanyInfoStartColum + 2;
            mcell1_3.Row      = intCompanyInfoStartRow;
            mcell1_3.Value    = "Contractor:";
            mcell1_3.CellType = CellType.String;

            workSheet.Cells.Add(mcell1_3);


            Cell mcell2_3 = new Spire.DataExport.XLS.Cell();

            mcell2_3.Column   = intCompanyInfoStartColum + 2;
            mcell2_3.Row      = intCompanyInfoStartRow + 1;
            mcell2_3.Value    = "Address:";
            mcell2_3.CellType = CellType.String;
            workSheet.Cells.Add(mcell2_3);


            Cell mcell3_3 = new Spire.DataExport.XLS.Cell();

            mcell3_3.Column   = intCompanyInfoStartColum + 2;
            mcell3_3.Row      = intCompanyInfoStartRow + 2;
            mcell3_3.Value    = "Accreditation No:";
            mcell3_3.CellType = CellType.String;
            workSheet.Cells.Add(mcell3_3);


            Cell mcell4_3 = new Spire.DataExport.XLS.Cell();

            mcell4_3.Column   = intCompanyInfoStartColum + 2;
            mcell4_3.Row      = intCompanyInfoStartRow + 3;
            mcell4_3.Value    = "Contractor Phone:";
            mcell4_3.CellType = CellType.String;
            workSheet.Cells.Add(mcell4_3);

            Cell mcell5_3 = new Spire.DataExport.XLS.Cell();

            mcell5_3.Column   = intCompanyInfoStartColum + 2;
            mcell5_3.Row      = intCompanyInfoStartRow + 4;
            mcell5_3.Value    = "GST No:";
            mcell5_3.CellType = CellType.String;
            workSheet.Cells.Add(mcell5_3);


            Cell mcell6_3 = new Spire.DataExport.XLS.Cell();

            mcell6_3.Column   = intCompanyInfoStartColum + 2;
            mcell6_3.Row      = intCompanyInfoStartRow + 5;
            mcell6_3.Value    = "Total Price (incl. GST):";
            mcell6_3.CellType = CellType.String;
            workSheet.Cells.Add(mcell6_3);

            //'second part of heading
            // '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Cell mcell1_4 = new Spire.DataExport.XLS.Cell();

            mcell1_4.Column   = intCompanyInfoStartColum + 3;
            mcell1_4.Row      = intCompanyInfoStartRow;
            mcell1_4.Value    = strContractor;
            mcell1_4.CellType = CellType.String;
            workSheet.Cells.Add(mcell1_4);


            Cell mcell2_4 = new Spire.DataExport.XLS.Cell();

            mcell2_4.Column   = intCompanyInfoStartColum + 3;
            mcell2_4.Row      = intCompanyInfoStartRow + 1;
            mcell2_4.Value    = strAddress;
            mcell2_4.CellType = CellType.String;
            workSheet.Cells.Add(mcell2_4);


            Cell mcell3_4 = new Spire.DataExport.XLS.Cell();

            mcell3_4.Column   = intCompanyInfoStartColum + 3;
            mcell3_4.Row      = intCompanyInfoStartRow + 2;
            mcell3_4.Value    = strAccreditationNo;
            mcell3_4.CellType = CellType.String;
            workSheet.Cells.Add(mcell3_4);

            Cell mcell4_4 = new Spire.DataExport.XLS.Cell();

            mcell4_4.Column   = intCompanyInfoStartColum + 3;
            mcell4_4.Row      = intCompanyInfoStartRow + 3;
            mcell4_4.Value    = strContractorPhone;
            mcell4_4.CellType = CellType.String;
            workSheet.Cells.Add(mcell4_4);

            Cell mcell5_4 = new Spire.DataExport.XLS.Cell();

            mcell5_4.Column   = intCompanyInfoStartColum + 3;
            mcell5_4.Row      = intCompanyInfoStartRow + 4;
            mcell5_4.Value    = strGSTNo;
            mcell5_4.CellType = CellType.String;
            workSheet.Cells.Add(mcell5_4);

            Cell mcell6_4 = new Spire.DataExport.XLS.Cell();

            mcell6_4.Column   = intCompanyInfoStartColum + 3;
            mcell6_4.Row      = intCompanyInfoStartRow + 5;
            mcell6_4.Value    = strTotalPrice;
            mcell6_4.CellType = CellType.String;
            workSheet.Cells.Add(mcell6_4);

            dsQuery = objScopeService.GetScopeItemsByScopeIdScopeItemStatus(ScopeId, 2);
            dsQuery.Tables[0].DefaultView.Sort = "ScopeGroup";
            //DataRowView rowView= new DataRowView();

            int intRowIndex;
            int intColumIndex;

            intRowIndex   = 15;
            intColumIndex = 0;

            String  strPrevScopeGroup        = "****";
            String  strScopeGroup            = String.Empty;
            String  strPrevArea              = "*****";
            String  strArea                  = String.Empty;
            String  strAreaMeasurement       = String.Empty;
            Boolean blnAreaMeasurementFilled = false;

            Cell dynamiccell_1;

            intRowIndex = intRowIndex + 1;
            int Range1 = intRowIndex;

            foreach (DataRowView rowView in dsQuery.Tables[0].DefaultView)
            {
                DataRow row = rowView.Row;
                strScopeGroup = String.Format("{0}", row["ScopeGroup"]);
                if (strScopeGroup != strPrevScopeGroup)
                {
                    intRowIndex            = intRowIndex + 1;
                    dynamiccell_1          = new Spire.DataExport.XLS.Cell();
                    dynamiccell_1.Column   = 1;
                    dynamiccell_1.Row      = intRowIndex;
                    dynamiccell_1.Value    = String.Format("{0}", row["ScopeGroup"]);
                    dynamiccell_1.CellType = CellType.String;
                    workSheet.Cells.Add(dynamiccell_1);

                    dynamiccell_1          = new Spire.DataExport.XLS.Cell();
                    dynamiccell_1.Column   = 2;
                    dynamiccell_1.Row      = intRowIndex;
                    dynamiccell_1.Value    = "Description of Works";
                    dynamiccell_1.CellType = Spire.DataExport.XLS.CellType.String;
                    workSheet.Cells.Add(dynamiccell_1);

                    dynamiccell_1          = new Spire.DataExport.XLS.Cell();
                    dynamiccell_1.Column   = 3;
                    dynamiccell_1.Row      = intRowIndex;
                    dynamiccell_1.Value    = "Dimension";
                    dynamiccell_1.CellType = Spire.DataExport.XLS.CellType.String;
                    workSheet.Cells.Add(dynamiccell_1);

                    dynamiccell_1          = new Spire.DataExport.XLS.Cell();
                    dynamiccell_1.Column   = 4;
                    dynamiccell_1.Row      = intRowIndex;
                    dynamiccell_1.Value    = "$ Rate";
                    dynamiccell_1.CellType = Spire.DataExport.XLS.CellType.String;
                    workSheet.Cells.Add(dynamiccell_1);

                    dynamiccell_1          = new Spire.DataExport.XLS.Cell();
                    dynamiccell_1.Column   = 5;
                    dynamiccell_1.Row      = intRowIndex;
                    dynamiccell_1.Value    = "Contractors Quote";
                    dynamiccell_1.CellType = Spire.DataExport.XLS.CellType.String;
                    workSheet.Cells.Add(dynamiccell_1);

                    intRowIndex = intRowIndex + 1;
                }
                strPrevScopeGroup = strScopeGroup;

                strArea            = String.Format("{0}", row["Area"]);
                strAreaMeasurement = String.Format("{0}", row["AreaMeasurement"]);

                dynamiccell_1        = new Spire.DataExport.XLS.Cell();
                dynamiccell_1.Column = 1;
                dynamiccell_1.Row    = intRowIndex;
                if (strArea != strPrevArea)
                {
                    dynamiccell_1.Value      = strArea;
                    blnAreaMeasurementFilled = false;
                }
                else
                if (blnAreaMeasurementFilled)
                {
                    dynamiccell_1.Value = "-";
                }
                else
                {
                    if (strAreaMeasurement.Trim() == String.Empty)
                    {
                        dynamiccell_1.Value = "-";
                    }
                    else
                    {
                        dynamiccell_1.Value = strAreaMeasurement;
                    }

                    blnAreaMeasurementFilled = true;
                }
                strPrevArea            = strArea;
                dynamiccell_1.CellType = CellType.String;
                workSheet.Cells.Add(dynamiccell_1);

                //'Note
                dynamiccell_1        = new Spire.DataExport.XLS.Cell();
                dynamiccell_1.Column = 2;
                dynamiccell_1.Row    = intRowIndex;

                if (!Convert.IsDBNull(row["Description"]))
                {
                    dynamiccell_1.Value = row["Description"];
                }
                else
                {
                    dynamiccell_1.Value = "";
                }
                if (!Convert.IsDBNull(row["Item"]))
                {
                    if (String.Format("{0}", row["Item"]).Trim() != String.Empty)
                    {
                        dynamiccell_1.Value = String.Format("{0}: {1}", row["Item"], dynamiccell_1.Value);
                    }
                }
                dynamiccell_1.CellType = Spire.DataExport.XLS.CellType.String;
                workSheet.Cells.Add(dynamiccell_1);

                //'QTY
                dynamiccell_1        = new Spire.DataExport.XLS.Cell();
                dynamiccell_1.Column = 3;
                dynamiccell_1.Row    = intRowIndex;

                if (Convert.IsDBNull(row["Quantity"]))
                {
                    dynamiccell_1.Value = Convert.ToDouble(row["Quantity"]).ToString();
                }
                else
                {
                    dynamiccell_1.Value = 0;
                }

                dynamiccell_1.CellType      = Spire.DataExport.XLS.CellType.String;
                dynamiccell_1.NumericFormat = "#,###,##0.00";
                workSheet.Cells.Add(dynamiccell_1);

                //'Rate
                dynamiccell_1        = new Spire.DataExport.XLS.Cell();
                dynamiccell_1.Column = 4;
                dynamiccell_1.Row    = intRowIndex;

                if (Convert.IsDBNull(row["Rate"]))
                {
                    dynamiccell_1.Value = Convert.ToDouble(row["Rate"]).ToString();
                }
                else
                {
                    dynamiccell_1.Value = 0;
                }

                dynamiccell_1.CellType      = Spire.DataExport.XLS.CellType.String;
                dynamiccell_1.NumericFormat = "#,###,##0.00";
                workSheet.Cells.Add(dynamiccell_1);

                //'Cost
                dynamiccell_1        = new Spire.DataExport.XLS.Cell();
                dynamiccell_1.Column = 5;
                dynamiccell_1.Row    = intRowIndex;

                if (Convert.IsDBNull(row["Cost"]))
                {
                    dynamiccell_1.Value = Convert.ToDouble(row["Cost"]).ToString("c");
                }
                else
                {
                    dynamiccell_1.Value = Convert.ToDouble(0).ToString("c");
                }

                dynamiccell_1.CellType      = Spire.DataExport.XLS.CellType.String;
                dynamiccell_1.NumericFormat = "#,###,##0.00";
                workSheet.Cells.Add(dynamiccell_1);

                intRowIndex = intRowIndex + 1;
            }
            int Range2 = intRowIndex - 1;

            intFootTotalStartRow   = intRowIndex;
            intFootTotalStartColum = 4;

            //'heading
            Cell mcell1_5 = new Spire.DataExport.XLS.Cell();

            mcell1_5.Column   = intFootTotalStartColum;
            mcell1_5.Row      = intFootTotalStartRow + 2;
            mcell1_5.Value    = "Subtotal (excl. GST)";
            mcell1_5.CellType = Spire.DataExport.XLS.CellType.String;
            workSheet.Cells.Add(mcell1_5);

            Cell mcell2_5 = new Spire.DataExport.XLS.Cell();

            mcell2_5.Column   = intFootTotalStartColum;
            mcell2_5.Row      = intFootTotalStartRow + 3;
            mcell2_5.Value    = "Add 15% GST";
            mcell2_5.CellType = Spire.DataExport.XLS.CellType.String;
            workSheet.Cells.Add(mcell2_5);

            Cell mcell3_5 = new Spire.DataExport.XLS.Cell();

            mcell3_5.Column   = intFootTotalStartColum;
            mcell3_5.Row      = intFootTotalStartRow + 4;
            mcell3_5.Value    = "Total Incl. GST";
            mcell3_5.CellType = Spire.DataExport.XLS.CellType.String;
            workSheet.Cells.Add(mcell3_5);


            Cell mcell1_7 = new Spire.DataExport.XLS.Cell();

            mcell1_7.Column   = intFootTotalStartColum + 1;
            mcell1_7.Row      = intFootTotalStartRow + 2;
            mcell1_7.Value    = ApprovedexcludeGstCost;
            mcell1_7.CellType = Spire.DataExport.XLS.CellType.String;
            workSheet.Cells.Add(mcell1_7);

            Cell mcell2_7 = new Spire.DataExport.XLS.Cell();

            mcell2_7.Column   = intFootTotalStartColum + 2;
            mcell2_7.Row      = intFootTotalStartRow + 3;
            mcell2_7.Value    = ApprovedGSTCost;
            mcell2_7.CellType = Spire.DataExport.XLS.CellType.String;
            workSheet.Cells.Add(mcell2_7);

            Cell mcell3_7 = new Spire.DataExport.XLS.Cell();

            mcell3_7.Column   = intFootTotalStartColum + 3;
            mcell3_7.Row      = intFootTotalStartRow + 4;
            mcell3_7.Value    = ApprovedInGSTCost;
            mcell3_7.CellType = Spire.DataExport.XLS.CellType.String;
            workSheet.Cells.Add(mcell3_7);


            DataTable InitialDataTable = new DataTable();

            //'connect to dataset
            workSheet.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
            //'workSheet.DataTable = dsQuery.Tables(0)
            workSheet.DataTable = InitialDataTable;
            //'workSheet.SQLCommand = oleDbCommand
            workSheet.StartDataCol = Convert.ToByte(1);
            cellExport.Sheets.Add(workSheet);

            try
            {
                cellExport.SaveToHttpResponse(String.Format("{0}.xls", strNewExcelFileName), context.Response);
                result = strExcelFile;
            }
            catch (Exception)
            {
            }
            return(result);
        }
Пример #4
0
 static RelyingPartyAddress GetLongestPrefixRelyingPartyAddress(ManagementService serviceClient, string relyingPartyAddress)
 {
     return
         ((from a in serviceClient.RelyingPartyAddresses where relyingPartyAddress.IndexOf(a.Address) == 0 select a).OrderByDescending(
              a => a.Address.Length).FirstOrDefault());
 }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initServices()
        public virtual void initServices()
        {
            managementService = engineRule.ManagementService;
        }
Пример #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initServices()
        public virtual void initServices()
        {
            runtimeService             = engineRule.RuntimeService;
            managementService          = engineRule.ManagementService;
            processEngineConfiguration = engineRule.ProcessEngineConfiguration;
        }
Пример #7
0
        /// <summary>
        /// Add the Rules into a Rule Group.
        /// </summary>
        private static void AddRulesToRuleGroup(string ruleGroupName, string issuerName)
        {
            ManagementService svc = ManagementServiceHelper.CreateManagementServiceClient();

            RuleGroup rg = svc.RuleGroups.AddQueryOption("$filter", "Name eq '" + ruleGroupName + "'").FirstOrDefault();

            Issuer issuer = svc.Issuers.Where(i => i.Name == issuerName).ToArray()[0];

            Rule namePassthroughRule = new Rule()
            {
                Issuer   = issuer,
                IssuerId = issuer.Id,

                // InputClaimIssuerId = issuer.Id,
                InputClaimType  = "http://www.theselfsts2.net/claims/nome",
                OutputClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
                RuleGroup       = rg,
                Description     = "Passthrough \"nome\" claim from SelfSTS2 as \"name\""
            };

            svc.AddRelatedObject(rg, "Rules", namePassthroughRule);

            Rule emailPassthroughRule = new Rule()
            {
                Issuer          = issuer,
                IssuerId        = issuer.Id,
                InputClaimType  = "http://www.theselfsts2.net/claims/postaelettronica",
                OutputClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
                RuleGroup       = rg,
                Description     = "Passthrough \"postaelettronica\" claim from SelfSTS2 as \"emailaddress\""
            };

            svc.AddRelatedObject(rg, "Rules", emailPassthroughRule);

            Rule goldenRule = new Rule()
            {
                Issuer           = issuer,
                IssuerId         = issuer.Id,
                InputClaimType   = "http://www.theselfsts2.net/claims/gruppo",
                InputClaimValue  = "Amministratori",
                OutputClaimType  = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role",
                OutputClaimValue = "Gold",
                RuleGroup        = rg,
                Description      = "Map Gold Role SelfSTS2"
            };

            svc.AddRelatedObject(rg, "Rules", goldenRule);

            Rule silverRule = new Rule()
            {
                Issuer           = issuer,
                IssuerId         = issuer.Id,
                InputClaimType   = "http://www.theselfsts2.net/claims/gruppo",
                InputClaimValue  = "Utenti",
                OutputClaimType  = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role",
                OutputClaimValue = "Silver",
                RuleGroup        = rg,
                Description      = "Map Silver Role SelfSTS2"
            };

            svc.AddRelatedObject(rg, "Rules", silverRule);

            svc.SaveChanges(SaveChangesOptions.Batch);

            Console.WriteLine();
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("Info: Passthrough Rules:");
            Console.WriteLine("Info: Passthrough Name Rule created: {0}", namePassthroughRule.Description);
            Console.WriteLine("Info: Passthrough Email Rule created: {0}", emailPassthroughRule.Description);

            Console.WriteLine();
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("Info: Roles Rules:");
            Console.WriteLine("Info: Golden Rule created: {0}", goldenRule.Description);
            Console.WriteLine("Info: Silver Rule created: {0}", silverRule.Description);
        }
Пример #8
0
 /// <summary>
 /// GetUsers method implementation
 /// </summary>
 public static int GetUsersCount(int maxrows = 20000)
 {
     EnsureService();
     return(ManagementService.GetUserRegistrationsCount(Filter));
 }
Пример #9
0
        public async Task <IActionResult> PutTestCaseZip(
            string problemId,
            [FromServices] IHubContext <OnlineJudgeHub> hub,
            CancellationToken token)
        {
            var value = JsonConvert.DeserializeObject <TestCaseZipUpload>(RequestBody);

            value.Zip = value.Zip.Substring(value.Zip.IndexOf("base64,") + "base64,".Length);

            var path = Path.Combine(Path.GetTempPath(), "joyoi_" + Guid.NewGuid().ToString().Replace("-", "") + ".zip");

            System.IO.File.WriteAllBytes(path, Convert.FromBase64String(value.Zip));

            var count = 0;

            using (var zip = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
                using (var zipArchive = new ZipArchive(zip, ZipArchiveMode.Update))
                {
                    var inputs = zipArchive.Entries.Where(x => x.FullName.EndsWith(".in"));

                    foreach (var input in inputs)
                    {
                        var output = zipArchive.Entries.SingleOrDefault(x => x.FullName == input.FullName.Substring(0, input.FullName.Length - 3) + ".out" || x.FullName == input.FullName.Substring(0, input.FullName.Length - 3) + ".ans");
                        if (output == null)
                        {
                            continue;
                        }

                        var testCase = new TestCase
                        {
                            ProblemId = problemId,
                            Type      = value.Type
                        };

                        using (var stream = input.Open())
                        {
                            var bytes = new byte[stream.Length];
                            stream.Read(bytes, 0, bytes.Length);
                            testCase.InputSizeInByte = (int)stream.Length;
                            testCase.InputBlobId     = await ManagementService.PutBlobAsync("input.txt", bytes, token);
                        }

                        using (var stream = output.Open())
                        {
                            var bytes = new byte[stream.Length];
                            stream.Read(bytes, 0, bytes.Length);
                            testCase.OutputSizeInByte = (int)stream.Length;
                            testCase.OutputBlobId     = await ManagementService.PutBlobAsync("output.txt", bytes, token);
                        }

                        DB.TestCases.Add(testCase);
                        ++count;
                    }
                    await DB.SaveChangesAsync(token);
                }

            System.IO.File.Delete(path);

            if (value.Type == TestCaseType.Sample)
            {
                hub.Clients.All.InvokeAsync("ItemUpdated", "problem-sample-data", problemId);
            }

            return(Result(200, count + " test cases uploaded."));
        }
Пример #10
0
        public async Task <IActionResult> Put(string id, CancellationToken token)
        {
            if (await DB.Problems.AnyAsync(x => x.Id == id, token))
            {
                return(Result(400, "The problem id is already exists, please pick another one."));
            }

            var reservedConfig = await DB.Configurations
                                 .SingleOrDefaultAsync(x => x.Key == "reservedproblemidprefixes", token);

            if (reservedConfig != null)
            {
                var reserved = JsonConvert.DeserializeObject <IEnumerable <string> >(reservedConfig.Value);
                if (reserved.Any(x => id.ToLower().StartsWith(x)))
                {
                    return(Result(400, "The problem id is already exists, please pick another one."));
                }
            }

            var problem = PutEntity <Problem>(RequestBody).Entity;

            problem.Id   = id;
            problem.Tags = LocalProblemSetTag;

            if (IsGroupRequest())
            {
                if (!await HasPermissionToGroupAsync(token))
                {
                    return(Result(400, "You don't have the permission to create a problem in this group."));
                }
                else
                {
                    DB.GroupProblems.Add(new GroupProblem
                    {
                        GroupId   = CurrentGroup.Id,
                        ProblemId = problem.Id
                    });
                }
            }

            // 处理比较器
            if (problem.ValidatorBlobId.HasValue)
            {
                // 检查使用的Blob是否合法
                if (!await DB.SharedValidators.AnyAsync(x => x.Id == problem.ValidatorBlobId.Value, token) && await User.Manager.IsInAnyRolesAsync(User.Current, Constants.MasterOrHigherRoles))
                {
                    return(Result(401, "You don't have the permission to the specified validator, id=" + problem.ValidatorBlobId.Value));
                }
            }
            else if (string.IsNullOrWhiteSpace(problem.ValidatorCode) && string.IsNullOrEmpty(problem.ValidatorLanguage))
            {
                problem.ValidatorBlobId = null;
            }
            else
            {
                // 如果用户上传了比较器代码
                if (Constants.SupportedLanguages.Contains(problem.ValidatorLanguage))
                {
                    // 编译自定义比较器并缓存编译后的blob
                    await CompileAsync(id, problem.ValidatorCode, problem.ValidatorLanguage, token);
                }
                else
                {
                    // 直接缓存比较器脚本的blob
                    problem.ValidatorBlobId = await ManagementService.PutBlobAsync(id + ".validator", Encoding.UTF8.GetBytes(problem.ValidatorCode), token);
                }
            }

            DB.Problems.Add(problem);
            await DB.SaveChangesAsync(token);

            await User.Manager.AddClaimAsync(User.Current, new System.Security.Claims.Claim(Constants.ProblemEditPermission, problem.Id));

            return(Result(200, "Put Succeeded"));
        }
 /// <summary>
 /// GetUsers method implementation
 /// </summary>
 public static RegistrationList GetUsers(int maxrows = 20000)
 {
     EnsureService();
     return(ManagementService.GetUserRegistrations(Filter, Order, Paging, maxrows));
 }
 /// <summary>
 /// CheckAttribute method implementation
 /// </summary>
 internal static bool CheckAttribute(string attribute, int choice)
 {
     EnsureService();
     return(ManagementService.CheckRepositoryAttribute(attribute, choice));
 }
Пример #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            runtimeService    = rule.RuntimeService;
            managementService = rule.ManagementService;
        }
Пример #14
0
        public void ProcessRequest(HttpContext context)
        {
            UserProfile       ContactUserProfile = new UserProfile();
            Project           CurrentProject     = new Project();
            ManagementService managementservice  = new ManagementService();

            managementservice.SQLConnection = ConnectDb.SQLConnection;

            string projectpath = "http://koreprojects.com";
            string ProjectID   = "0";
            string details     = "";

            try { ProjectID = context.Request.QueryString["ProjectID"]; }
            catch { ProjectID = "0"; }
            try { details = context.Request.QueryString["Details"]; }
            catch { details = ""; }
            if (ProjectID == "0")
            {
                context.Response.Write("un");
            }
            else
            {
                CurrentProject     = managementservice.GetProjectByProjectId(long.Parse(ProjectID));
                ContactUserProfile = managementservice.GetUserProfileByUserID(CurrentProject.ContactId);
                string filename = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
                string fname = "", virtualpath = "";
                System.Text.StringBuilder str = new System.Text.StringBuilder();
                try
                {
                    if (context.Request.Files.Count > 0)
                    {
                        HttpFileCollection files = context.Request.Files;

                        string myactualfilename = "";
                        for (int i = 0; i < files.Count; i++)
                        {
                            HttpPostedFile file = files[i];
                            myactualfilename = file.FileName;
                            var p = file.FileName.Split('.');

                            var    extention = myactualfilename.Split('.');
                            string ext       = extention[extention.Length - 1];
                            filename = filename + '.' + ext;
                            //filename = "demo1" + '.' + ext;
                            //
                            //myactualfilename = RemoveSpecialChar(p[0]) + '.' + ext;
                            //filename = RemoveSpecialChar(p[0]) + "_" + filename;

                            //string folderPath = context.Server.MapPath("../Images/" + ContactUserProfile.Identifier);
                            //if (!System.IO.Directory.Exists(folderPath))
                            //{
                            //    System.IO.Directory.CreateDirectory(folderPath);
                            //}
                            //fname = context.Server.MapPath("../Images/" + ContactUserProfile.Identifier + "/" + filename);

                            string folderPath = context.Server.MapPath(projectpath + "/Images/" + ContactUserProfile.Identifier);
                            if (!System.IO.Directory.Exists(folderPath))
                            {
                                System.IO.Directory.CreateDirectory(folderPath);
                            }
                            fname = context.Server.MapPath(projectpath + "/Images/" + ContactUserProfile.Identifier + "/" + filename);


                            file.SaveAs(fname);

                            try
                            {
                                string   fn           = filename;
                                string[] fext         = fn.Split(new char[] { '.' });
                                string   Extentestion = fext[1];
                                virtualpath = fname;
                            }
                            catch { }
                            UserFile CurrentFile = new UserFile();
                            if (long.Parse(ProjectID) > 0)
                            {
                                CurrentFile.Owner = long.Parse(ProjectID);
                            }
                            CurrentFile.FileName      = filename;
                            CurrentFile.FileExtension = ext;
                            CurrentFile.Description   = details;
                            managementservice.CreateUserFile(CurrentFile);
                        }
                    }
                    bool IsJson = true;
                    //try
                    //{
                    //    //?android=1
                    //    IsJson = context.Request.QueryString["android"].Contains("1");
                    //}
                    //catch { IsJson = false; }
                    if (IsJson)
                    {
                        context.Response.Write(virtualpath);
                    }
                    //else
                    //{
                    //    context.Response.Write(str);
                    //}
                    return;
                }
                catch
                {
                    context.Response.Write("un");
                    return;
                }//TemporaryInboxfileSaving
            }
        }
Пример #15
0
        public virtual void unregisterDeployment(string deploymentId)
        {
            ManagementService managementService = processEngine.ManagementService;

            managementService.unregisterDeploymentForJobExecutor(deploymentId);
        }
Пример #16
0
 public materialController(IMaterialRepository _materialRepository, ICostanalysisRepository _costanalysisRepository,IManagementRepository _managementRepository)
 {
     materialService = new MaterialService(_materialRepository);
     costanalysisService = new CostanalysisService(_costanalysisRepository);
     managementService = new ManagementService(_managementRepository);
 }
Пример #17
0
 public void ExceptionLoggin(string ControllerName, string ActionName, string ErrorMessage)
 {
     ServiceLayer.ManagementService ManObj = new ManagementService();
     ManObj.ExceptionLoggin(ControllerName, ActionName, ErrorMessage);
 }
Пример #18
0
        /// <summary>
        /// ManageCerts method implmentation
        /// </summary>
        internal void ManageCerts()
        {
            MessageBoxParameters messageBoxParameters = new MessageBoxParameters
            {
                Caption       = "Multi-Factor Authentication",
                Buttons       = MessageBoxButtons.YesNo,
                DefaultButton = MessageBoxDefaultButton.Button1,
                Icon          = MessageBoxIcon.Question,
                Text          = res.CERTIFICATESSECURITYMSG
            };

            if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.Yes)
            {
                try
                {
                    if (ManagementService.UpdateCertificatesACL())
                    {
                        MessageBoxParameters messageBoxParametersResult = new MessageBoxParameters
                        {
                            Caption       = "Multi-Factor Authentication",
                            Buttons       = MessageBoxButtons.OK,
                            DefaultButton = MessageBoxDefaultButton.Button1,
                            Icon          = MessageBoxIcon.Information,
                            Text          = res.CERTIFICATESSECURITYMSGRESULT
                        };
                        this.SnapIn.Console.ShowDialog(messageBoxParametersResult);
                    }
                }
                catch (Exception ex)
                {
                    MessageBoxParameters messageBoxParametersError = new MessageBoxParameters
                    {
                        Caption       = "Multi-Factor Authentication Error",
                        Buttons       = MessageBoxButtons.OK,
                        DefaultButton = MessageBoxDefaultButton.Button1,
                        Icon          = MessageBoxIcon.Error,
                        Text          = ex.Message
                    };
                    this.SnapIn.Console.ShowDialog(messageBoxParametersError);
                }
            }

            /*
             * MessageBoxParameters messageBoxParameters2 = new MessageBoxParameters
             * {
             *  Caption = "Multi-Factor Authentication",
             *  Buttons = MessageBoxButtons.YesNo,
             *  DefaultButton = MessageBoxDefaultButton.Button1,
             *  Icon = MessageBoxIcon.Question,
             *  Text = res.CERTIFICATESCLEANMSG
             * };
             * if (this.SnapIn.Console.ShowDialog(messageBoxParameters2)==DialogResult.Yes)
             * {
             *  try
             *  {
             *      int nb = ManagementService.CleanOrphanedPrivateKeys(0x00, 0);
             *      MessageBoxParameters messageBoxParametersResult = new MessageBoxParameters
             *      {
             *          Caption = "Multi-Factor Authentication",
             *          Buttons = MessageBoxButtons.OK,
             *          DefaultButton = MessageBoxDefaultButton.Button1,
             *          Icon = MessageBoxIcon.Information,
             *          Text = string.Format(res.CERTIFICATESCLEANMSGCOUNT + " : {0}", nb)
             *      };
             *      this.SnapIn.Console.ShowDialog(messageBoxParametersResult);
             *  }
             *  catch (Exception ex)
             *  {
             *      MessageBoxParameters messageBoxParametersError = new MessageBoxParameters
             *      {
             *          Caption = "Multi-Factor Authentication Error",
             *          Buttons = MessageBoxButtons.OK,
             *          DefaultButton = MessageBoxDefaultButton.Button1,
             *          Icon = MessageBoxIcon.Error,
             *          Text = ex.Message
             *      };
             *      this.SnapIn.Console.ShowDialog(messageBoxParametersError);
             *  }
             * }*/
        }
Пример #19
0
 public void DeleteUserAd(int AdId)
 {
     ServiceLayer.ManagementService ManObj = new ManagementService();
     ManObj.DeleteUserAd(AdId);
 }
Пример #20
0
        /// <summary>
        /// Add an Identity Provider
        /// </summary>
        private static Issuer CreateIdpManually(DateTime startDate, DateTime endDate, ManagementService svc0, string idpName, string idpDisplayName, string idpAddress, string idpKeyDisplayName)
        {
            var issuer = new Issuer
            {
                Name = idpName
            };

            // Check the Issuer does not exist previouly (if it exists, delete it)
            var oldIssuer = svc0.Issuers.Where(ip => ip.Name == issuer.Name).FirstOrDefault();

            if (oldIssuer != null)
            {
                svc0.DeleteObject(oldIssuer);
                svc0.SaveChanges();
            }

            // Add Issuer
            svc0.AddToIssuers(issuer);
            svc0.SaveChanges(SaveChangesOptions.Batch);
            Console.WriteLine("Info: Issuer created: {0}", idpName);

            var idp = new IdentityProvider
            {
                DisplayName        = idpDisplayName,
                LoginLinkName      = idpDisplayName,
                WebSSOProtocolType = "WsFederation",
                IssuerId           = issuer.Id
            };

            // Check the IP does not exist previouly (if it exists, delete it)
            var oldIdentityProvider = svc0.IdentityProviders.Where(ip => ip.DisplayName == idp.DisplayName).FirstOrDefault();

            if (oldIdentityProvider != null)
            {
                svc0.DeleteObject(oldIdentityProvider);
                svc0.SaveChanges();
            }

            // Add the new IP to ACS
            svc0.AddObject("IdentityProviders", idp);

            // Console.WriteLine("Info: Identity Provider created: {0}", idp.Name);
            Console.WriteLine("Info: Identity Provider created: {0}", idp.DisplayName);

            // Identity provider public key to verify the signature
            var cert = File.ReadAllBytes(@"Resources\SelfSTS.cer");
            var key  = new IdentityProviderKey
            {
                IdentityProvider = idp,
                DisplayName      = idpKeyDisplayName,
                EndDate          = endDate,
                StartDate        = startDate,
                Type             = "X509Certificate",
                Usage            = "Signing",
                Value            = cert
            };

            svc0.AddRelatedObject(idp, "IdentityProviderKeys", key);
            svc0.SaveChanges(SaveChangesOptions.Batch);

            Console.WriteLine("Info: Identity Provider Key added: {0}", idpKeyDisplayName);

            // WS-Federation sign-in URL
            var idpaSignIn = new IdentityProviderAddress
            {
                IdentityProviderId = idp.Id,
                EndpointType       = "SignIn",
                Address            = idpAddress
            };

            svc0.AddRelatedObject(idp, "IdentityProviderAddresses", idpaSignIn);
            svc0.SaveChanges(SaveChangesOptions.Batch);

            Console.WriteLine("Info: Identity Provider Address added: {0}", idpAddress);

            string labRelyingPartyName = "WebSiteAdvancedACS";

            // Relying Party related to the Identity Provider
            foreach (var existingRelyingParty in svc0.RelyingParties)
            {
                var rpid = new RelyingPartyIdentityProvider
                {
                    IdentityProviderId = idp.Id,
                    RelyingPartyId     = existingRelyingParty.Id
                };
                existingRelyingParty.RelyingPartyIdentityProviders.Add(rpid);
                idp.RelyingPartyIdentityProviders.Add(rpid);
                svc0.AddToRelyingPartyIdentityProviders(rpid);
            }

            svc0.SaveChanges(SaveChangesOptions.Batch);

            Console.WriteLine("Info: Relying Party added to Identity Provider: {0}", labRelyingPartyName);

            return(issuer);
        }
Пример #21
0
        /// <summary>
        /// BuildNodes method
        /// </summary>
        private void BuildNodes(bool doall = true)
        {
            if (doall)
            {
                this.RootNode = new RootScopeNode();
                FormViewDescription fvr = new FormViewDescription();
                fvr.DisplayName = "MFA Platform";
                fvr.ControlType = typeof(RootViewControl);
                fvr.ViewType    = typeof(RootFormView);
                this.RootNode.ViewDescriptions.Add(fvr);
                this.RootNode.ViewDescriptions.DefaultIndex = 0;

                if (IsPrimary)
                {
                    // Service Node
                    this.ServiceNode = new ServiceScopeNode();
                    FormViewDescription fvc = new FormViewDescription();
                    fvc.DisplayName = "MFA Platform Service";
                    fvc.ControlType = typeof(ServiceViewControl);
                    fvc.ViewType    = typeof(ServiceFormView);
                    this.ServiceNode.ViewDescriptions.Add(fvc);
                    this.ServiceNode.ViewDescriptions.DefaultIndex = 0;

                    // General Scope
                    this.ServiceGeneralNode = new ServiceGeneralScopeNode();
                    FormViewDescription fvs = new FormViewDescription();
                    fvs.DisplayName = "MFA Platform General Properties";
                    fvs.ControlType = typeof(GeneralViewControl);
                    fvs.ViewType    = typeof(GeneralFormView);
                    this.ServiceGeneralNode.ViewDescriptions.Add(fvs);
                    this.ServiceGeneralNode.ViewDescriptions.DefaultIndex = 0;

                    // Storage
                    this.ServiceStorageNode = new ServiceStorageScopeNode();
                    FormViewDescription fstore = new FormViewDescription();
                    fstore.DisplayName = "MFA Platform Storage Properties";
                    fstore.ControlType = typeof(StorageViewControl);
                    fstore.ViewType    = typeof(ServiceStoreFormView);
                    this.ServiceStorageNode.ViewDescriptions.Add(fstore);
                    this.ServiceStorageNode.ViewDescriptions.DefaultIndex = 0;

                    // ADDS Scope
                    this.ServiceADDSNode = new ServiceADDSScopeNode();
                    FormViewDescription fadds = new FormViewDescription();
                    fadds.DisplayName = "MFA Platform Active Directory Properties";
                    fadds.ControlType = typeof(ADDSViewControl);
                    fadds.ViewType    = typeof(ServiceADDSFormView);
                    this.ServiceADDSNode.ViewDescriptions.Add(fadds);
                    this.ServiceADDSNode.ViewDescriptions.DefaultIndex = 0;

                    // SQL Scope
                    this.ServiceSQLNode = new ServiceSQLScopeNode();
                    FormViewDescription fsql = new FormViewDescription();
                    fsql.DisplayName = "MFA Platform SQL Server Properties";
                    fsql.ControlType = typeof(SQLViewControl);
                    fsql.ViewType    = typeof(ServiceSQLFormView);
                    this.ServiceSQLNode.ViewDescriptions.Add(fsql);
                    this.ServiceSQLNode.ViewDescriptions.DefaultIndex = 0;

                    // Custom Storage Scope
                    this.ServiceCustomStorageNode = new ServiceCustomStorageScopeNode();
                    FormViewDescription cust = new FormViewDescription();
                    cust.DisplayName = "MFA Custom Storage Properties";
                    cust.ControlType = typeof(CustomStoreViewControl);
                    cust.ViewType    = typeof(ServiceCustomStoreFormView);
                    this.ServiceCustomStorageNode.ViewDescriptions.Add(cust);
                    this.ServiceCustomStorageNode.ViewDescriptions.DefaultIndex = 0;

                    // Security Scope
                    this.ServiceSecurityNode = new ServiceSecurityRootScopeNode();
                    FormViewDescription fsec = new FormViewDescription();
                    fsec.DisplayName = "Security Features";
                    fsec.ControlType = typeof(ServiceSecurityRootViewControl);
                    fsec.ViewType    = typeof(ServiceSecurityRootFormView);
                    this.ServiceSecurityNode.ViewDescriptions.Add(fsec);
                    this.ServiceSecurityNode.ViewDescriptions.DefaultIndex = 0;

                    // RNG
                    this.ServiceRNGNode = new ServiceSecurityRNGScopeNode();
                    FormViewDescription frng = new FormViewDescription();
                    frng.DisplayName = "Encoded Keys RGN ";
                    frng.ControlType = typeof(ServiceSecurityRNGViewControl);
                    frng.ViewType    = typeof(ServiceSecurityRNGFormView);
                    this.ServiceRNGNode.ViewDescriptions.Add(frng);
                    this.ServiceRNGNode.ViewDescriptions.DefaultIndex = 0;

                    // AES
                    this.ServiceAESNode = new ServiceSecurityAESScopeNode();
                    FormViewDescription faes = new FormViewDescription();
                    faes.DisplayName = "Symmetric Keys AES";
                    faes.ControlType = typeof(ServiceSecurityAESViewControl);
                    faes.ViewType    = typeof(ServiceSecurityAESFormView);
                    this.ServiceAESNode.ViewDescriptions.Add(faes);
                    this.ServiceAESNode.ViewDescriptions.DefaultIndex = 0;

                    // RSA
                    this.ServiceRSANode = new ServiceSecurityRSAScopeNode();
                    FormViewDescription frsa = new FormViewDescription();
                    frsa.DisplayName = "Asymmetric Keys RSA ";
                    frsa.ControlType = typeof(ServiceSecurityRSAViewControl);
                    frsa.ViewType    = typeof(ServiceSecurityRSAFormView);
                    this.ServiceRSANode.ViewDescriptions.Add(frsa);
                    this.ServiceRSANode.ViewDescriptions.DefaultIndex = 0;

                    // Custom
                    this.ServiceCustomSecurityNode = new ServiceCustomSecurityScopeNode();
                    FormViewDescription fcust = new FormViewDescription();
                    fcust.DisplayName = "Custom Keys";
                    fcust.ControlType = typeof(SecurityCustomViewControl);
                    fcust.ViewType    = typeof(ServiceSecurityCustomFormView);
                    this.ServiceCustomSecurityNode.ViewDescriptions.Add(fcust);
                    this.ServiceCustomSecurityNode.ViewDescriptions.DefaultIndex = 0;

                    // WebAuthN
                    this.ServiceWebAuthNNode = new ServiceSecurityWebAuthNScopeNode();
                    FormViewDescription frweb = new FormViewDescription();
                    frweb.DisplayName = "WebAuthN Credentials";
                    frweb.ControlType = typeof(ServiceSecurityWebAuthNViewControl);
                    frweb.ViewType    = typeof(ServiceSecurityWebAuthNFormView);
                    this.ServiceWebAuthNNode.ViewDescriptions.Add(frweb);
                    this.ServiceWebAuthNNode.ViewDescriptions.DefaultIndex = 0;

                    // Providers Scope
                    this.ServiceProvidersNode = new ServiceProvidersScopeNode();
                    FormViewDescription fprov = new FormViewDescription();
                    fprov.DisplayName = "MFA Providers";
                    fprov.ControlType = typeof(ProvidersViewControl);
                    fprov.ViewType    = typeof(ServiceProvidersFormView);
                    this.ServiceProvidersNode.ViewDescriptions.Add(fprov);
                    this.ServiceProvidersNode.ViewDescriptions.DefaultIndex = 0;

                    ManagementService.EnsureService();
                    RuntimeAuthProvider.LoadProviders(ManagementService.Config);

                    IExternalProvider prv0 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Code);
                    if (prv0 != null)
                    {
                        // TOTP Scope
                        this.ServiceTOTPNode = new ServiceTOTPScopeNode();
                        FormViewDescription ftotp = new FormViewDescription();
                        ftotp.DisplayName = "MFA Platform TOTP Properties";
                        ftotp.ControlType = typeof(ServiceTOTPViewControl);
                        ftotp.ViewType    = typeof(ServiceTOTPFormView);
                        this.ServiceTOTPNode.ViewDescriptions.Add(ftotp);
                        this.ServiceTOTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv4 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Biometrics);
                    if (prv4 != null)
                    {
                        // Biometrics Scope
                        this.ServiceBiometricsNode = new ServiceBiometricsScopeNode();
                        FormViewDescription fbio = new FormViewDescription();
                        fbio.DisplayName = "MFA Platform Biometrics Properties";
                        fbio.ControlType = typeof(ServiceBiometricsViewControl);
                        fbio.ViewType    = typeof(ServiceBiometricsFormView);
                        this.ServiceBiometricsNode.ViewDescriptions.Add(fbio);
                        this.ServiceBiometricsNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv1 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Email);
                    if (prv1 != null)
                    {
                        // SMTP Scope
                        this.ServiceSMTPNode = new ServiceSMTPScopeNode();
                        FormViewDescription fsmtp = new FormViewDescription();
                        fsmtp.DisplayName = "MFA Platform SMTP Properties";
                        fsmtp.ControlType = typeof(SMTPViewControl);
                        fsmtp.ViewType    = typeof(ServiceSMTPFormView);
                        this.ServiceSMTPNode.ViewDescriptions.Add(fsmtp);
                        this.ServiceSMTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv2 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.External);
                    if (prv2 != null)
                    {
                        // SMS Scope
                        this.ServiceSMSNode = new ServicePhoneScopeNode();
                        FormViewDescription fsms = new FormViewDescription();
                        fsms.DisplayName = "MFA Platform SMS Properties";
                        fsms.ControlType = typeof(SMSViewControl);
                        fsms.ViewType    = typeof(ServiceSMSFormView);
                        this.ServiceSMSNode.ViewDescriptions.Add(fsms);
                        this.ServiceSMSNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv3 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Azure);
                    if (prv3 != null)
                    {
                        // Azure Scope
                        this.ServiceAzureNode = new ServiceAzureScopeNode();
                        FormViewDescription faz = new FormViewDescription();
                        faz.DisplayName = "MFA Platform SMS Properties";
                        faz.ControlType = typeof(AzureViewControl);
                        faz.ViewType    = typeof(ServiceAzureFormView);
                        this.ServiceAzureNode.ViewDescriptions.Add(faz);
                        this.ServiceAzureNode.ViewDescriptions.DefaultIndex = 0;
                    }
                }

                // Users Scope
                this.UsersNode = new UsersScopeNode();
                FormViewDescription fvu = new FormViewDescription();
                fvu.DisplayName = "MFA Platform Users";
                fvu.ControlType = typeof(UsersListView);
                fvu.ViewType    = typeof(UsersFormView);
                this.UsersNode.ViewDescriptions.Add(fvu);
                this.UsersNode.ViewDescriptions.DefaultIndex = 0;


                if (IsPrimary)
                {
                    this.RootNode.Children.Add(this.ServiceNode);
                    this.RootNode.Children.Add(this.ServiceGeneralNode);

                    this.RootNode.Children.Add(this.ServiceSecurityNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRNGNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceAESNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRSANode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceWebAuthNNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceCustomSecurityNode);

                    this.RootNode.Children.Add(this.ServiceStorageNode);
                    this.ServiceStorageNode.Children.Add(this.ServiceADDSNode);
                    this.ServiceStorageNode.Children.Add(this.ServiceSQLNode);
                    this.ServiceStorageNode.Children.Add(this.ServiceCustomStorageNode);

                    this.RootNode.Children.Add(this.ServiceProvidersNode);
                    if (this.ServiceTOTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceTOTPNode);
                    }
                    if (this.ServiceBiometricsNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceBiometricsNode);
                    }
                    if (this.ServiceSMTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMTPNode);
                    }
                    if (this.ServiceSMSNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMSNode);
                    }
                    if (this.ServiceAzureNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceAzureNode);
                    }
                }
                this.RootNode.Children.Add(this.UsersNode);

                this.IsModified = true;
                this.SmallImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder16, Color.Black);
                this.LargeImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder32, Color.Black);
            }
            else
            {
                RefreshUI();
            }
        }
 static WorkspacesExtensions()
 {
     _managementService = ManagementService.Instance;
 }
Пример #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initServices()
        public virtual void initServices()
        {
            runtimeService    = engineRule.RuntimeService;
            managementService = engineRule.ManagementService;
            historyService    = engineRule.HistoryService;
        }
Пример #24
0
 static RelyingParty GetRelyingPartyByAddress(ManagementService serviceClient, RelyingPartyAddress longestPrefixRpAddress)
 {
     return((from rp in serviceClient.RelyingParties.Expand("RelyingPartyAddresses,RelyingPartyIdentityProviders,RelyingPartyRuleGroups")
             where rp.Id == longestPrefixRpAddress.RelyingPartyId
             select rp).FirstOrDefault());
 }
Пример #25
0
 /// <summary>
 /// GetEncodedUserKey method implmentation
 /// </summary>
 internal static string GetEncodedUserKey(string upn)
 {
     EnsureService();
     return(ManagementService.GetEncodedUserKey(upn));
 }
        /// <summary>
        /// BuildNodes method
        /// </summary>
        private void BuildNodes(bool doall = true)
        {
            if (doall)
            {
                this.RootNode = new RootScopeNode();
                FormViewDescription fvr = new FormViewDescription();
                fvr.DisplayName = "MFA Platform";
                fvr.ControlType = typeof(RootViewControl);
                fvr.ViewType    = typeof(RootFormView);
                this.RootNode.ViewDescriptions.Add(fvr);
                this.RootNode.ViewDescriptions.DefaultIndex = 0;

                if (IsPrimary)
                {
                    // Service Node
                    this.ServiceNode = new ServiceScopeNode();
                    FormViewDescription fvc = new FormViewDescription();
                    fvc.DisplayName = "MFA Platform Service";
                    fvc.ControlType = typeof(ServiceViewControl);
                    fvc.ViewType    = typeof(ServiceFormView);
                    this.ServiceNode.ViewDescriptions.Add(fvc);
                    this.ServiceNode.ViewDescriptions.DefaultIndex = 0;

                    // General Scope
                    this.ServiceGeneralNode = new ServiceGeneralScopeNode();
                    FormViewDescription fvs = new FormViewDescription();
                    fvs.DisplayName = "MFA Platform General Properties";
                    fvs.ControlType = typeof(GeneralViewControl);
                    fvs.ViewType    = typeof(GeneralFormView);
                    this.ServiceGeneralNode.ViewDescriptions.Add(fvs);
                    this.ServiceGeneralNode.ViewDescriptions.DefaultIndex = 0;

                    // ADDS Scope
                    this.ServiceADDSNode = new ServiceADDSScopeNode();
                    FormViewDescription fadds = new FormViewDescription();
                    fadds.DisplayName = "MFA Platform Active Directory Properties";
                    fadds.ControlType = typeof(ADDSViewControl);
                    fadds.ViewType    = typeof(ServiceADDSFormView);
                    this.ServiceADDSNode.ViewDescriptions.Add(fadds);
                    this.ServiceADDSNode.ViewDescriptions.DefaultIndex = 0;

                    // SQL Scope
                    this.ServiceSQLNode = new ServiceSQLScopeNode();
                    FormViewDescription fsql = new FormViewDescription();
                    fsql.DisplayName = "MFA Platform SQL Server Properties";
                    fsql.ControlType = typeof(SQLViewControl);
                    fsql.ViewType    = typeof(ServiceSQLFormView);
                    this.ServiceSQLNode.ViewDescriptions.Add(fsql);
                    this.ServiceSQLNode.ViewDescriptions.DefaultIndex = 0;

                    // Security Scope
                    this.ServiceSecurityNode = new ServiceSecurityRootScopeNode();
                    FormViewDescription fsec = new FormViewDescription();
                    fsec.DisplayName = "Security Features";
                    fsec.ControlType = typeof(ServiceSecurityRootViewControl);
                    fsec.ViewType    = typeof(ServiceSecurityRootFormView);
                    this.ServiceSecurityNode.ViewDescriptions.Add(fsec);
                    this.ServiceSecurityNode.ViewDescriptions.DefaultIndex = 0;

                    // RNG
                    this.ServiceRNGNode = new ServiceSecurityRNGScopeNode();
                    FormViewDescription frng = new FormViewDescription();
                    frng.DisplayName = "RGN Ramdom Number Generator";
                    frng.ControlType = typeof(ServiceSecurityRNGViewControl);
                    frng.ViewType    = typeof(ServiceSecurityRNGFormView);
                    this.ServiceRNGNode.ViewDescriptions.Add(frng);
                    this.ServiceRNGNode.ViewDescriptions.DefaultIndex = 0;

                    // RSA
                    this.ServiceRSANode = new ServiceSecurityRSAScopeNode();
                    FormViewDescription frsa = new FormViewDescription();
                    frsa.DisplayName = "RSA Key Generator";
                    frsa.ControlType = typeof(ServiceSecurityRSAViewControl);
                    frsa.ViewType    = typeof(ServiceSecurityRSAFormView);
                    this.ServiceRSANode.ViewDescriptions.Add(frsa);
                    this.ServiceRSANode.ViewDescriptions.DefaultIndex = 0;

                    // RSA CUST
                    this.ServiceRSAXNode = new ServiceSecurityRSAXScopeNode();
                    FormViewDescription frsax = new FormViewDescription();
                    frsax.DisplayName = "RSA Extended Key Generator";
                    frsax.ControlType = typeof(ServiceSecurityRSAXViewControl);
                    frsax.ViewType    = typeof(ServiceSecurityRSAXFormView);
                    this.ServiceRSAXNode.ViewDescriptions.Add(frsax);
                    this.ServiceRSAXNode.ViewDescriptions.DefaultIndex = 0;

                    // Providers Scope
                    this.ServiceProvidersNode = new ServiceProvidersScopeNode();
                    FormViewDescription fprov = new FormViewDescription();
                    fprov.DisplayName = "MFA Providers";
                    fprov.ControlType = typeof(ProvidersViewControl);
                    fprov.ViewType    = typeof(ServiceProvidersFormView);
                    this.ServiceProvidersNode.ViewDescriptions.Add(fprov);
                    this.ServiceProvidersNode.ViewDescriptions.DefaultIndex = 0;

                    ManagementService.EnsureService();
                    RuntimeAuthProvider.LoadProviders(ManagementService.Config);

                    IExternalProvider prv0 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Code);
                    if (prv0 != null)
                    {
                        // TOTP Scope
                        this.ServiceTOTPNode = new ServiceSecurityScopeNode();
                        FormViewDescription ftotp = new FormViewDescription();
                        ftotp.DisplayName = "MFA Platform TOTP Properties";
                        ftotp.ControlType = typeof(ServiceSecurityViewControl);
                        ftotp.ViewType    = typeof(ServiceSecurityFormView);
                        this.ServiceTOTPNode.ViewDescriptions.Add(ftotp);
                        this.ServiceTOTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv1 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Email);
                    if (prv1 != null)
                    {
                        // SMTP Scope
                        this.ServiceSMTPNode = new ServiceSMTPScopeNode();
                        FormViewDescription fsmtp = new FormViewDescription();
                        fsmtp.DisplayName = "MFA Platform SMTP Properties";
                        fsmtp.ControlType = typeof(SMTPViewControl);
                        fsmtp.ViewType    = typeof(ServiceSMTPFormView);
                        this.ServiceSMTPNode.ViewDescriptions.Add(fsmtp);
                        this.ServiceSMTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv2 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.External);
                    if (prv2 != null)
                    {
                        // SMS Scope
                        this.ServiceSMSNode = new ServicePhoneScopeNode();
                        FormViewDescription fsms = new FormViewDescription();
                        fsms.DisplayName = "MFA Platform SMS Properties";
                        fsms.ControlType = typeof(SMSViewControl);
                        fsms.ViewType    = typeof(ServiceSMSFormView);
                        this.ServiceSMSNode.ViewDescriptions.Add(fsms);
                        this.ServiceSMSNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv3 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Azure);
                    if (prv3 != null)
                    {
                        // Azure Scope
                        this.ServiceAzureNode = new ServiceAzureScopeNode();
                        FormViewDescription faz = new FormViewDescription();
                        faz.DisplayName = "MFA Platform SMS Properties";
                        faz.ControlType = typeof(AzureViewControl);
                        faz.ViewType    = typeof(ServiceAzureFormView);
                        this.ServiceAzureNode.ViewDescriptions.Add(faz);
                        this.ServiceAzureNode.ViewDescriptions.DefaultIndex = 0;
                    }
                }

                // Users Scope
                this.UsersNode = new UsersScopeNode();
                FormViewDescription fvu = new FormViewDescription();
                fvu.DisplayName = "MFA Platform Users";
                fvu.ControlType = typeof(UsersListView);
                fvu.ViewType    = typeof(UsersFormView);
                this.UsersNode.ViewDescriptions.Add(fvu);
                this.UsersNode.ViewDescriptions.DefaultIndex = 0;

                if (IsPrimary)
                {
                    this.RootNode.Children.Add(this.ServiceNode);
                    this.RootNode.Children.Add(this.ServiceGeneralNode);
                    this.RootNode.Children.Add(this.ServiceADDSNode);
                    this.RootNode.Children.Add(this.ServiceSQLNode);

                    this.RootNode.Children.Add(this.ServiceSecurityNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRNGNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRSANode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRSAXNode);

                    this.RootNode.Children.Add(this.ServiceProvidersNode);
                    if (this.ServiceTOTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceTOTPNode);
                    }
                    if (this.ServiceSMTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMTPNode);
                    }
                    if (this.ServiceSMSNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMSNode);
                    }
                    if (this.ServiceAzureNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceAzureNode);
                    }
                }
                this.RootNode.Children.Add(this.UsersNode);

                this.IsModified = true;
                this.SmallImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder16, Color.Black);
                this.LargeImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder32, Color.Black);
            }
            else
            {
                RefreshUI();
            }
        }
Пример #27
0
 /// <summary>
 /// NewUserKey method implementation
 /// </summary>
 internal static void NewUserKey(string upn)
 {
     EnsureService();
     ManagementService.NewUserKey(upn);
 }
Пример #28
0
 public override JobDefinition getExecutionJobDefinition(Batch batch)
 {
     return(ManagementService.createJobDefinitionQuery().jobDefinitionId(batch.BatchJobDefinitionId).jobType(org.camunda.bpm.engine.batch.Batch_Fields.TYPE_PROCESS_INSTANCE_RESTART).singleResult());
 }
Пример #29
0
 /// <summary>
 /// EnsureService() method implmentation
 /// </summary>
 internal static void EnsureService()
 {
     ManagementService.Initialize(true);
 }
Пример #30
0
        public virtual void reportDbMetrics()
        {
            ManagementService managementService = processEngine.ManagementService;

            managementService.reportDbMetricsNow();
        }
Пример #31
0
 /// <summary>
 /// GetUsers method implementation
 /// </summary>
 public static MFAUserList GetUsers()
 {
     EnsureService();
     return(ManagementService.GetUserRegistrations(Filter, Order, Paging));
 }
Пример #32
0
 /// <summary>
 /// GetAllUsers method implementation
 /// </summary>
 public static MFAUserList GetAllUsers(bool enabledonly = false)
 {
     EnsureService();
     return(ManagementService.GetAllUserRegistrations(Order, enabledonly));
 }
Пример #33
0
 public managementController(IManagementRepository _managementRepository, IAccountRepository _accountRepository)
 {
     managementService = new ManagementService(_managementRepository);
     accountService = new AccountService(_accountRepository);
 }