private string AttachmentPathx(int id)
        {
            string path = Connection.AttachmentPath(id);

            path = Path.Combine(Path.Combine(path, "Organizations"), OrganizationID.ToString());
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return(path);
        }
Beispiel #2
0
        public OrganizationRank SaveOrganizationRank()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_OrganizationRank";
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationRankID", SqlDbType.Int, OrganizationRankID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationID", SqlDbType.Int, OrganizationID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationRankLevel", SqlDbType.Int, OrganizationRankLevel.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ScoreMin", SqlDbType.Int, ScoreMin.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ScoreMax", SqlDbType.Int, ScoreMax.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Title", SqlDbType.VarChar, Title, 400));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Benefits", SqlDbType.VarChar, Benefits, 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Duties", SqlDbType.Int, Duties, 4000));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
        public Organization SaveOrganization()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_Organization";
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationID", SqlDbType.Int, OrganizationID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationName", SqlDbType.VarChar, OrganizationName, 100));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationDescription", SqlDbType.VarChar, OrganizationDescription, 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ScaleID", SqlDbType.Int, ScaleID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationTypeID", SqlDbType.Int, OrganizationTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationAllies", SqlDbType.VarChar, OrganizationAllies, 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationEnemies", SqlDbType.VarChar, OrganizationEnemies, 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTraditionID", SqlDbType.Int, ForceTraditionID.ToString(), 0));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
        /// <summary>
        /// Deletes the Organization.
        /// </summary>
        /// <returns>boolean</returns>
        public bool DeleteOrganization()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Delete_Organization";
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationID", SqlDbType.Int, OrganizationID.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this.DeleteOK);
        }
    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());
        }
    }