Ejemplo n.º 1
0
 public Note(int noteID, DateTime createDate, InternalUser author, string noteText, DateTime editDate)
 {
     NoteID = noteID;
     CreateDate = createDate;
     Author = author;
     NoteText = noteText;
     EditDate = editDate;
 }
Ejemplo n.º 2
0
        protected internal void BindData(InternalUser thisPerson)
        {
            PhoneNumbersRepeater.DataSource = thisPerson.PhoneNumbers;
            PhoneNumbersRepeater.DataBind();

            AddressesRepeater.DataSource = thisPerson.Addresses;
            AddressesRepeater.DataBind();

            CasesRepeater.DataSource = thisPerson.GetCases();
            CasesRepeater.DataBind();
        }
Ejemplo n.º 3
0
        protected internal void LoadHeader(InternalUser thisPerson)
        {
            HeaderRelationship.Visible = false;
            HeaderPassword.Visible = true;
            HeaderUserType.Visible = true;
            HeaderOffenderNumber.Visible = false;

            PersonID.Text = thisPerson.PersonID.ToString();
            FirstName.Text = thisPerson.FirstName.ToString();
            LastName.Text = thisPerson.LastName.ToString();
            DateOfBirth.Text = (thisPerson.DateOfBirth == default(DateTime) ? "" : thisPerson.DateOfBirth.ToString("MM/dd/yyyy"));
            Gender.Text = thisPerson.Gender.ToString();
            Email.Text = thisPerson.Email.ToString();
            Race.Text = thisPerson.Race.ToString();
            UserType.Text = thisPerson.Role.ToString();

            //foreach (ListItem item in UserType.Items)
            //{
            //    if (item.Value == thisPerson.Role.ToString().ToLower())
            //    {
            //        item.Selected = true;
            //        break;
            //    }
            //}

            MainContainer.Visible = true;
            GuardiansPanel.Visible = false;
        }
Ejemplo n.º 4
0
        internal void DeleteCaseManager(InternalUser manager)
        {
            string sql = @"
                DELETE FROM CASE_MANAGER
                WHERE       Case_ID = @CaseID
                AND         Person_ID = @PersonID";

            using (SqlConnection conn = new SqlConnection(Constants.DSN))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("CaseID", CaseID);
                cmd.Parameters.AddWithValue("PersonID", manager.PersonID);

                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 5
0
        internal void AddCaseManager(InternalUser manager)
        {
            string sql = @"
                INSERT INTO CASE_MANAGER (Case_ID, Person_ID)
                VALUES                (@CaseID, @PersonID)";

            using (SqlConnection conn = new SqlConnection(Constants.DSN))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("CaseID", CaseID);
                cmd.Parameters.AddWithValue("PersonID", manager.PersonID);

                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 6
0
        public static InternalUser Get(int personID)
        {
            string dsn = ConfigurationManager.ConnectionStrings["RJLouEntities"].ToString();
            string sql = @"
                SELECT      iu.Person_ID,
                            First_Name,
                            Last_Name,
                            Date_Of_Birth,
                            Gender,
                            Email,
                            Race,
                            Password,
                            Title
                FROM        Internal_User iu
                INNER JOIN  Person p ON iu.Person_ID = p.Person_ID
                INNER JOIN  User_Type ut ON iu.User_Type_ID = ut.User_Type_ID
                WHERE       iu.Person_ID = @PersonID";

            using (SqlConnection conn = new SqlConnection(dsn))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("PersonID", personID);

                SqlDataReader read = cmd.ExecuteReader();

                if (read.Read())
                {
                    InternalUser result = new InternalUser()
                    {
                        PersonID = Convert.ToInt32(read["Person_ID"]),
                        FirstName = read["First_Name"].ToString(),
                        LastName = read["Last_Name"].ToString(),
                        DateOfBirth = Convert.ToDateTime(read["Date_Of_Birth"]),
                        Gender = read["Gender"].ToString(),
                        Race = read["Race"].ToString(),
                        Email = read["Email"].ToString(),
                        Password = read["Password"].ToString()
                    };

                    result.GetPhoneNumbers();
                    result.GetAddresses();
                    result.GetRole(read["Title"].ToString());

                    return result;
                }
            }

            return null;
        }
Ejemplo n.º 7
0
        public static int Add(DateTime createDate, InternalUser author, string noteText)
        {
            int result = -1;
            string dsn = ConfigurationManager.ConnectionStrings["RJLouEntities"].ToString();
            string sql = "INSERT INTO NOTE (CreateDate, Author, Note_Text) OUTPUT INSERTED.Note_ID VALUES (@CreateDate, @Author, @NoteText)";

            using (SqlConnection conn = new SqlConnection(dsn))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("CreateDate", createDate);
                cmd.Parameters.AddWithValue("Author", author.PersonID);
                cmd.Parameters.AddWithValue("NoteText", noteText);

                result = (int)cmd.ExecuteScalar();
            }

            return result;
        }