Пример #1
0
        public static Zadacha XmlToObject(string str)
        {
            //  XmlSerializer formatter = new XmlSerializer(typeof(Zadacha));
            Zadacha       result     = new Zadacha();
            XmlSerializer serializer = new XmlSerializer(typeof(Zadacha));

            using (TextReader reader = new StringReader(str))
            {
                result = (Zadacha)serializer.Deserialize(reader);
            }
            return(result);
        }
Пример #2
0
        public void addXml(Zadacha person)
        {
            using (SqlConnection conn = new SqlConnection(Config.SqlConnStr))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("[dbo].[setSeryal]", conn))
                {
                    var FilterXML = ObjectToXMLGeneric(person);

                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@inXml", SqlDbType.Xml).Value = FilterXML;
                    //cmd.Parameters.Add("@inName", SqlDbType.Xml).Value = fs.;
                    cmd.ExecuteNonQuery();
                }
            }
        }
Пример #3
0
        public void addZadacha(Zadacha book)
        {
            using (SqlConnection conn = new SqlConnection(Config.SqlConnStr))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("[dbo].[addZadacha]", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@inName", SqlDbType.NVarChar).Value     = book.Name;
                    cmd.Parameters.Add("@inOpisanya", SqlDbType.NVarChar).Value = book.Opisanya;
                    cmd.Parameters.Add("@inDayy", SqlDbType.Date).Value         = book.date;
                    cmd.Parameters.Add("@inModulId", SqlDbType.Int).Value       = book.modulID;
                    cmd.Parameters.Add("@inPredprinID", SqlDbType.Int).Value    = book.predprinID;
                    cmd.Parameters.Add("@inByte", SqlDbType.VarBinary).Value    = book.fileUpload;
                    cmd.ExecuteNonQuery();
                }
            }
        }