Esempio n. 1
0
        public childOptions readOptions(Guid child, Guid user)
        {
            if (child == null || user == null)
            {
                return(new childOptions());
            }
            childOptions options = new childOptions();

            SqlConnection con = new SqlConnection(data);
            SqlCommand    cmd = new SqlCommand("SELECT * FROM parentOptions WHERE type = 'child' AND typeId = @childId", con);

            cmd.Parameters.AddWithValue("@childId", child);

            con.Open();
            try
            {
                SqlDataReader Dr = cmd.ExecuteReader();
                options.childId      = new Guid(Dr["typeId"].ToString());
                options.user         = new Guid(Dr["lastModifier"].ToString());
                options.releaseDate  = Dr["openDate"] == null ? DateTime.Now : DateTime.Parse(Dr["openDate"].ToString());
                options.releaseDates = Convert.ToInt32(Dr["openAfterDays"]);
                Dr.Close();
            }
            catch (SqlException ex)
            {
            }catch (Exception ex)
            {
            }
            con.Close();

            return(options);
        }
Esempio n. 2
0
        public string updateOptions(childOptions options)
        {
            string response = "";

            SqlConnection con = new SqlConnection(data);
            SqlCommand    cmd = new SqlCommand("UPDATE options SET lastModifier = @user, openDate = @openDate, openAfterDays = @openAfter WHERE type = @type, typeId = @childId", con);

            return(response);
        }