Exemple #1
0
        public void InsertId(Mobile MobileDB, Image ImageDB)
        {
            SqlQueryImage  SQImage  = new SqlQueryImage();
            var            Image    = SQImage.GetImage(ImageDB);
            SqlQueryMobile SQMobile = new SqlQueryMobile();
            var            Mobile   = SQMobile.GetMobile(MobileDB);

            if (Image.Id != 0)
            {
                var InsertMobileQuery = "insert into dbo.[MobileImage] (MobileId,ImageId) values ( @val1, @val2 );";

                var           connect = Connection.SqlConnectionObject;
                SqlQueryBrand SQbrand = new SqlQueryBrand();

                connect.Open();


                SqlCommand command = new SqlCommand(InsertMobileQuery, connect);
                command.Parameters.AddWithValue("@val1", Mobile.Id);
                command.Parameters.AddWithValue("@val2", Image.Id);

                var value = command.ExecuteNonQuery();
                connect.Close();
            }
        }
        public void InsertId(Mobile MobileDB, Network NetworkDB, int i)
        {
            var InsertMobileQuery = "insert into dbo.[NetworkMobile] (Mobile_Id , Network_Id) values ( @val1, @val2 );";

            var           connect = Connection.SqlConnectionObject;
            SqlQueryBrand SQbrand = new SqlQueryBrand();

            connect.Open();
            SqlQueryNetwork SQImage  = new SqlQueryNetwork();
            var             Network  = SQImage.GetNetwork(NetworkDB, i);
            SqlQueryMobile  SQMobile = new SqlQueryMobile();
            var             Mobile   = SQMobile.GetMobile(MobileDB);

            SqlCommand command = new SqlCommand(InsertMobileQuery, connect);

            command.Parameters.AddWithValue("@val1", Mobile.Id);
            command.Parameters.AddWithValue("@val2", Network.Id);

            var value = command.ExecuteNonQuery();

            connect.Close();
        }