Пример #1
1
        public bool Update(Spotlight spotlight, Database db, DbTransaction transaction)
        {
            DbCommand command = db.GetStoredProcCommand("usp_SpotlightUpdate");

            db.AddInParameter(command, "UserId", DbType.Guid, spotlight.UserId);
            db.AddInParameter(command, "Awards", DbType.String, spotlight.Awards);
            db.AddInParameter(command, "Achievements", DbType.String, spotlight.Achievements);
            db.AddInParameter(command, "CurentGPA", DbType.String, spotlight.CurentGPA);
            db.AddInParameter(command, "OraganizationId", DbType.Int16, spotlight.OraganizationId);
            db.AddInParameter(command, "Involvments", DbType.String, spotlight.Involvments);
            db.AddInParameter(command, "FraternityId", DbType.Int16, spotlight.FraternityId);
            db.AddInParameter(command, "SoroityId", DbType.Int16, spotlight.SoroityId);
            db.AddInParameter(command, "GreekHonorSocitiesId", DbType.Int16, spotlight.GreekHonorSocitiesId);
            db.AddInParameter(command, "GreakOrganizationId", DbType.Int16, spotlight.GreakOrganizationId);
            db.AddInParameter(command, "IsDeleted", DbType.Boolean, spotlight.IsDeleted);
            db.AddInParameter(command, "UpdatedBy", DbType.Guid, spotlight.UpdatedBy);

            db.AddOutParameter(command, "UpdatedDate", DbType.DateTime, 30);

            db.ExecuteNonQuery(command, transaction);

            spotlight.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "UpdatedDate").ToString());
            spotlight.UpdatedDate = spotlight.CreatedDate;

            return true;
        }
Пример #2
0
        public bool Delete(Spotlight spotlight, Database db, DbTransaction transaction)
        {
            DbCommand command = db.GetStoredProcCommand("usp_SpotlightDelete");

            db.AddInParameter(command, "SpotlightId", DbType.Guid, spotlight.SpotlightId);
            db.AddInParameter(command, "UpdatedBy", DbType.Guid, spotlight.UpdatedBy);

            db.ExecuteNonQuery(command, transaction);

            return true;
        }
Пример #3
0
        /// <summary>
        /// Checks if user record with UserId exist in User table of the database.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool IsSpotlightExist(Spotlight spotlight)
        {
            Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
            DbCommand command = db.GetStoredProcCommand("usp_Spotlight_IsSpotlightExist");

            db.AddInParameter(command, "UserId", DbType.Guid, spotlight.UserId);
            db.AddOutParameter(command, "IsExist", DbType.Boolean, 1);

            db.ExecuteNonQuery(command);

            return Convert.ToBoolean(db.GetParameterValue(command, "IsExist").ToString());
        }
Пример #4
0
        public void loaddata()
        {
            // school data

            spotlight = Spotlight.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            if (spotlight != null)
            {
                Awards.Text = string.IsNullOrEmpty(spotlight.Awards) ? string.Empty : spotlight.Awards;
                Achievements.Text = string.IsNullOrEmpty(spotlight.Achievements) ? string.Empty : spotlight.Achievements;
                CurentGPA.Text = string.IsNullOrEmpty(spotlight.CurentGPA) ? string.Empty : spotlight.CurentGPA;
                Involvments.Text = string.IsNullOrEmpty(spotlight.Involvments) ? string.Empty : spotlight.Involvments;

                if (spotlight.OraganizationId.HasValue)
                {
                    for (int i = 0; i < DrpOraganizations.Items.Count; i++)
                    {
                        if (DrpOraganizations.Items[i].Value.ToString().ToLower() == spotlight.OraganizationId.ToString().ToLower())
                        {
                            DrpOraganizations.ClearSelection();
                            DrpOraganizations.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.FraternityId.HasValue)
                {
                    for (int i = 0; i < DrpFraternity.Items.Count; i++)
                    {
                        if (DrpFraternity.Items[i].Value.ToString().ToLower() == spotlight.OraganizationId.ToString().ToLower())
                        {
                            DrpFraternity.ClearSelection();
                            DrpFraternity.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.SoroityId.HasValue)
                {
                    for (int i = 0; i < DrpSoroity.Items.Count; i++)
                    {
                        if (DrpSoroity.Items[i].Value.ToString().ToLower() == spotlight.SoroityId.ToString().ToLower())
                        {
                            DrpSoroity.ClearSelection();
                            DrpSoroity.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.GreakOrganizationId.HasValue)
                {
                    for (int i = 0; i < DrpGreekOrganizations.Items.Count; i++)
                    {
                        if (DrpGreekOrganizations.Items[i].Value.ToString().ToLower() == spotlight.GreakOrganizationId.ToString().ToLower())
                        {
                            DrpGreekOrganizations.ClearSelection();
                            DrpGreekOrganizations.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.GreekHonorSocitiesId.HasValue)
                {
                    for (int i = 0; i < DrpGreekHonorSocities.Items.Count; i++)
                    {
                        if (DrpGreekHonorSocities.Items[i].Value.ToString().ToLower() == spotlight.GreekHonorSocitiesId.ToString().ToLower())
                        {
                            DrpGreekHonorSocities.ClearSelection();
                            DrpGreekHonorSocities.Items[i].Selected = true;
                        }
                    }
                }
            }
        }
Пример #5
0
        public static Spotlight Select(Guid Userid)
        {
            Spotlight spotlight = Generic.GetByFieldValue <Spotlight>("Userid", Userid.ToString());

            return(spotlight);
        }