Exemple #1
0
        void EIWizard_ActiveStepChanged(object sender, EventArgs e)
        {
            BindStepsLabels();
            if (EIWizard.ActiveStep.ID == "step1")            //bind radio button list hints
            {
                if (IsProjectMSSynchronized || _toMSPrj)      // Sync mode
                {
                    divStep1NotSyncronized.Visible = false;
                    divStep1Syncronized.Visible    = true;
                    switch (rblFirstStep.SelectedValue)
                    {
                    case "UpdateInIBN":
                        lbSUpInIBN.Style.Add(HtmlTextWriterStyle.Display, "");
                        lbSUpInMS.Style.Add(HtmlTextWriterStyle.Display, "none");
                        break;

                    case "UpdateInMS":
                        lbSUpInIBN.Style.Add(HtmlTextWriterStyle.Display, "none");
                        lbSUpInMS.Style.Add(HtmlTextWriterStyle.Display, "");
                        break;
                    }
                }
                else                    // Update mode
                {
                    divStep1NotSyncronized.Visible = true;
                    divStep1Syncronized.Visible    = false;
                    switch (rblFirstStep.SelectedValue)
                    {
                    case "Import":
                        lbNSImport.Style.Add(HtmlTextWriterStyle.Display, "");
                        lbNSExport.Style.Add(HtmlTextWriterStyle.Display, "none");
                        break;

                    case "Export":
                        lbNSImport.Style.Add(HtmlTextWriterStyle.Display, "none");
                        lbNSExport.Style.Add(HtmlTextWriterStyle.Display, "");
                        break;
                    }
                }
            }

            if (EIWizard.ActiveStep.ID == "step3")
            {
                if (!Page.IsValid)
                {
                    EIWizard.MoveTo(this.step4);
                    return;
                }
                if (divStep3Synchronization.Visible)
                {
                    ddCType.Items.Clear();
                    ddCType.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.ImportProjectWizard", "tCTAll").ToString(), "All"));
                    ddCType.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.ImportProjectWizard", "tCTAny").ToString(), "Any"));
                    BindDataGrid();
                    foreach (DataGridItem dgi in dgMembers.Items)
                    {
                        DropDownList ddl = (DropDownList)dgi.FindControl("ddProjectTeam");
                        CommonHelper.SafeSelect(ddl, dgi.Cells[3].Text);
                    }
                }
                if (divStep3Import.Visible)
                {
                    BindImportDataGrid();
                    foreach (DataGridItem dgi in dgMembersImport.Items)
                    {
                        DropDownList ddl = (DropDownList)dgi.FindControl("ddProjectTeam");
                        CommonHelper.SafeSelect(ddl, dgi.Cells[3].Text);
                    }
                }
            }
            if (EIWizard.ActiveStep.ID == "step4")
            {
                if (!Page.IsValid)
                {
                    ImportSuccessLiteral.Text = GetGlobalResourceObject("IbnFramework.ImportProjectWizard", "tWizardError").ToString();
                }

                if (divExportSuccess.Visible)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "OpenWindow('" + this.ResolveClientUrl("~/Projects/GetIBNProjectXML.aspx") + "?ProjectId=" + ProjectId.ToString() + (IsProjectMSSynchronized ? "&Synchronized=true" : "") + "',600,400);", true);
                }
            }
        }
Exemple #2
0
        void EIWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            if (EIWizard.ActiveStep.ID == "step1")
            {
                bool t = false;
                switch (rblFirstStep.SelectedValue)
                {
                case "UpdateInIBN":
                    divStep3Synchronization.Visible = true;
                    divStep3Import.Visible          = false;
                    divExportSuccess.Visible        = false;
                    break;

                case "Import":
                    divStep2Import.Visible          = true;
                    divStep3Synchronization.Visible = false;
                    divStep3Import.Visible          = true;
                    divExportSuccess.Visible        = false;
                    break;

                case "Export":
                case "UpdateInMS":
                    divStep2Import.Visible = false;
                    t = true;
                    divStep3Synchronization.Visible = false;
                    divStep3Import.Visible          = false;
                    divExportSuccess.Visible        = true;
                    divImportSuccess.Visible        = false;
                    break;
                }
                if (t)
                {
                    EIWizard.MoveTo(this.step4);
                }
            }
            if (EIWizard.ActiveStep.ID == "step2")
            {
                if (divStep2Import.Visible)                //upload xml from MS Project
                {
                    Page.Validate();
                    if (!Page.IsValid)
                    {
                        EIWizard.MoveTo(this.step4);
                        return;
                    }
                    ViewState["ImportError"] = null;
                    XmlId = -1;
                    try
                    {
                        if (mcImportFile.PostedFile != null && mcImportFile.PostedFile.ContentLength > 0)
                        {
                            XmlTextReader xmlreader = new XmlTextReader(mcImportFile.PostedFile.InputStream);
                            bool          valid     = CommonHelper.ValidateXMLWithMsProjectSchema(xmlreader);
                            if (valid)
                            {
                                mcImportFile.PostedFile.InputStream.Position = 0;
                                XmlId = Project.UploadImportXML(ProjectId, mcImportFile.PostedFile.FileName, mcImportFile.PostedFile.InputStream);
                            }
                            else
                            {
                                cvFileError.IsValid = false;
                            }
                        }
                        else
                        {
                            cvFileError.IsValid = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        CHelper.GenerateErrorReport(ex);
                        cvFileError.IsValid = false;
                    }
                    divStep3Export.Visible = false;
                }
                else                //load xml from ibn
                {
                    divStep3Synchronization.Visible = false;
                    divStep3Import.Visible          = false;
                    divStep3Export.Visible          = true;
                }
                //find button
                Control startPoint = EIWizard.Controls[0].Controls[EIWizard.Controls[0].Controls.Count - 1];
                if (startPoint != null)
                {
                    startPoint = GetControlFromColl(startPoint.Controls);
                }
                if (startPoint != null)
                {
                    Button btn = (Button)startPoint;
                    btn.Attributes.Add("onclick", "MakeHide();");
                }
            }
        }