예제 #1
0
        public int Create(STag tag)
        {
            string sqlExpression = "sp_InsertTag";

            using (SqlConnection conn = DBConnection.Instance.GetConnection())
            {
                conn.Open();
                SqlCommand command = new SqlCommand(sqlExpression, conn);
                command.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter urlParam = new SqlParameter
                {
                    ParameterName = "@name",
                    Value         = tag.Value
                };
                command.Parameters.Add(urlParam);

                var result = command.ExecuteScalar();

                Console.WriteLine("Id добавленного объекта: {0}", result);
                string value = result.ToString();
                int    id    = int.Parse(value);
                return(id);
            }
        }
예제 #2
0
        private List <GroupItemModel> GetDatas(List <string> selectedList, List <GroupInfo> gInfos)
        {
            List <GroupItemModel> infos = new List <GroupItemModel>();

            foreach (var item in gInfos)
            {
                infos.Add(new GroupItemModel()
                {
                    IsSelected = selectedList.Contains(item.Name) ? 1 : 0,
                    Info       = item,
                    Tags       = STag.GetTags(item.MapperName)
                });
            }
            return(infos);
        }
예제 #3
0
        public void Execute([Values(false, true)] bool compile)
        {
            var model = TypeModel.Create();

            model.SkipForcedLateReference = true;
            model.AutoCompile             = compile;
            model.Add(typeof(SObjectSurrogate), true);
            model.Add(typeof(STag), true);
            model.Add(typeof(object), false).SetSurrogate(typeof(SObjectSurrogate));
            var obj = new STag()
            {
                Type = 123, Value = new LegacyObject(1)
            };

            var clone = model.DeepClone(obj);

            Assert.AreEqual(obj.Type, clone.Type);
            Assert.IsNotNull(obj.Value);
        }
예제 #4
0
        public List <ArticleInfo> GetAll()
        {
            string             sqlExpression  = "sp_GetArticles";
            CCountryGateway    countryGateway = new CCountryGateway();
            List <ArticleInfo> articles       = new List <ArticleInfo>();
            STag articleTag = new STag();

            using (SqlConnection conn = DBConnection.Instance.GetConnection())
            {
                conn.Open();

                SqlCommand command = new SqlCommand(sqlExpression, conn);
                command.CommandType = System.Data.CommandType.StoredProcedure;

                using (var reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            articleTag.Value = (string)reader["Tag"];
                            int         countryId = (int)reader["CountryID"];
                            ArticleInfo article   = new ArticleInfo();
                            article.ID      = (int)reader["ID"];
                            article.Url     = (string)reader["URL"];
                            article.Title   = (string)reader["Title"];
                            article.Content = (string)reader["Content"];
                            article.Html    = (byte[])reader["HTML"];
                            article.Date    = (DateTime)reader[6];              //todo: fix the problem with Date  -> rename column?
                            article.Country = countryGateway.Get(countryId);
                            article.Tag     = articleTag;

                            articles.Add(article);
                        }
                    }
                }
            }

            return(articles);
        }
예제 #5
0
 public void Update(STag tag)
 {
     throw new NotImplementedException();
 }
예제 #6
0
파일: SCard.cs 프로젝트: P1nkL1on/Gwent3
 public bool containsTag(STag tag)
 {
     return(_tags.Contains(tag));
 }