示例#1
0
    override protected void OnInit(EventArgs e)
    {
        if (!IsPostBack)
        {
            ClientDL.ImpactLevel level = new ClientDL.ImpactLevel();

            ddlImpactLevel.DataSource     = level.LoadAllImpactLevel();
            ddlImpactLevel.DataValueField = ClientDL.ImpactLevel.ColumnNames.ImpactLevelID;
            ddlImpactLevel.DataTextField  = ClientDL.ImpactLevel.ColumnNames.Name;
            ddlImpactLevel.DataBind();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string ProjectName         = string.Empty;
        string OrgConnectionString = GetClientDBConnectionString();

        if (OrgConnectionString.Length == 0)
        {
            MessageLabel.Visible = true;
            MainPanel.Visible    = false;
            return;
        }

        if (!IsPostBack)
        {
            ProjectView oProjectView = new ProjectView();
            oProjectView.ConnectionString         = OrgConnectionString;
            oProjectView.Where.ProjectID.Value    = ProjectID;
            oProjectView.Where.ProjectID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            oProjectView.Query.Load();

            if (oProjectView.RowCount == 0)
            {
                MessageLabel.Visible = true;
                MainPanel.Visible    = false;
                return;
            }
            else
            {
                this.ViewState["ProjectName"] = oProjectView.Name;
            }

            hlSubscribe.NavigateUrl = string.Format("{0}?ProjectID={1}&OrganizationID={2}", Global.SubscribePageURL, ProjectID.ToString(), OrganizationID.ToString());

            DL_WEB.DAL.Client.ImpactLevel oImpactLevel = new DL_WEB.DAL.Client.ImpactLevel(OrgConnectionString);
            foreach (DataRow row in oImpactLevel.LoadAllImpactLevel().Table.Rows)
            {
                ddlImpactLevel.Items.Add(new ListItem(row["Name"].ToString(), row["ImpactLevelID"].ToString()));
            }
        }

        if (this.ViewState["ProjectName"] != null)
        {
            ProjectName = this.ViewState["ProjectName"].ToString();
        }

        this.Title = string.Format("Deployment Log for '{0}' Project", ProjectName);

        if (0 != ImpactLevel)
        {
            divImpactLevel.Visible = false;
        }

        ProductionUpdates oProductionUpdates = new ProductionUpdates(OrgConnectionString);

        oProductionUpdates.Where.ProjectID.Value    = ProjectID;
        oProductionUpdates.Where.ProjectID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        oProductionUpdates.Query.Load();
        oProductionUpdates.Sort = ProductionUpdates.ColumnNames.BuildDate + " DESC";

        if (oProductionUpdates.RowCount > 0)
        {
            do
            {
                TableRow  tr = new TableRow();
                TableCell tc = new TableCell();

                tc.Text       = string.Format("<br/><div class=\"project_name\">{0}</div> &nbsp;{1}", ProjectName, oProductionUpdates.IsColumnNull(ProductionUpdates.ColumnNames.BuildNumber) ? "v " + oProductionUpdates.BuildNumber : "") + "&nbsp; - &nbsp;" + oProductionUpdates.BuildDate.Month + "/" + oProductionUpdates.BuildDate.Day + "/" + oProductionUpdates.BuildDate.Year + "<br/><br/>";
                tc.ColumnSpan = 4;
                tr.Cells.Add(tc);

                tblHistory.Rows.Add(tr);

                ProductionLogEntries oProductionLogEntries = new ProductionLogEntries(OrgConnectionString);
                oProductionLogEntries.Where.UpdateID.Value    = oProductionUpdates.UpdateID;
                oProductionLogEntries.Where.UpdateID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                if (ddlImpactLevel.SelectedValue != "0")
                {
                    oProductionLogEntries.Where.ImpactLevelID.Value    = ddlImpactLevel.SelectedValue;
                    oProductionLogEntries.Where.ImpactLevelID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.LessThanOrEqual;
                }
                oProductionLogEntries.Query.Load();

                if (oProductionLogEntries.RowCount > 0)
                {
                    do
                    {
                        tr          = new TableRow();
                        tc          = new TableCell();
                        tc.CssClass = "log_entry_image";
                        Image img = new Image();
                        img.ImageUrl      = oProductionLogEntries.IconPath;
                        img.AlternateText = oProductionLogEntries.TypeName;
                        tc.Controls.Add(img);
                        tc.Width = 30;
                        tr.Cells.Add(tc);

                        tc          = new TableCell();
                        tc.CssClass = "log_entry_section";
                        tc.Text     = string.Format("{0} :", oProductionLogEntries.ProjectSectionName);
                        tr.Cells.Add(tc);

                        tc          = new TableCell();
                        tc.CssClass = "log_entry_name";
                        tc.Text     = oProductionLogEntries.PublicHeader;
                        tr.Cells.Add(tc);

                        tc          = new TableCell();
                        tc.CssClass = "log_entry_description";
                        tc.Text     = oProductionLogEntries.PublicDescription;
                        tr.Cells.Add(tc);

                        tblHistory.Rows.Add(tr);
                    } while (oProductionLogEntries.MoveNext());
                }
                else
                {
                    tr = new TableRow();

                    tc            = new TableCell();
                    tc.Text       = "<i>There were no changes</i>";
                    tc.ColumnSpan = 3;

                    tr.Cells.Add(tc);
                    tblHistory.Rows.Add(tr);
                }
            } while (oProductionUpdates.MoveNext());
        }
    }