Пример #1
0
        public List<Model.Category> GetList(Int64 _CategoryID, Int64 _ParentID, string _CategoryName, int _Status, int _Start, int _Limit)
        {
            List<Model.Category> lModel = new List<Model.Category>();

            try
            {
                SqlParameter[] p =  {
                                        new SqlParameter("@CategoryID", SqlDbType.Int, 4),
                                        new SqlParameter("@ParentID", SqlDbType.Int, 4),
                                        new SqlParameter("@CategoryName", SqlDbType.NVarChar, 250),
                                        new SqlParameter("@Status", SqlDbType.Int, 4),
                                        new SqlParameter("@Start", SqlDbType.Int, 4),
                                        new SqlParameter("@Limit", SqlDbType.Int, 4)
                                    };

                p[0].Value = _CategoryID;
                p[1].Value = _ParentID;
                p[2].Value = _CategoryName;
                p[3].Value = _Status;
                p[4].Value = _Start;
                p[5].Value = _Limit;

                DataTable dt = db.ExcuteSelectReturnDataTable("Category_Select", CommandType.StoredProcedure, p);

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Model.Category model = new Model.Category();

                        model.Ind = Convert.ToInt64(dr["Ind"]);
                        model.CategoryID = Convert.ToInt64(dr["CategoryID"]);
                        model.ParentID = Convert.ToInt64(dr["ParentID"]);
                        model.CategoryIcon = dr["CategoryIcon"].ToString();
                        model.CategoryName = dr["CategoryName"].ToString();
                        model.CategoryNameUrl = dr["CategoryNameUrl"].ToString();
                        model.Intro = dr["Intro"].ToString();
                        model.CreateBy = dr["CreateBy"].ToString();
                        model.CreateTime = dr["CreateTime"].ToString();
                        model.UpdateBy = dr["UpdateBy"].ToString();
                        model.UpdateTime = dr["UpdateTime"].ToString();
                        model.Status = Convert.ToInt32(dr["Status"]);
                        model.TotalRow = Convert.ToInt64(dr["TotalRow"]);

                        lModel.Add(model);
                    }

                }
            }
            catch (Exception ex)
            {
                PTSLog.Error(ex.Message);
            }
            return lModel;
        }
Пример #2
0
 protected void Bt_Submit_Click(object sender, EventArgs e)
 {
     string categryName = TB_CategoryName.Text;
     if (categryName == "")
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!分类名称必须为1-50个字符!');", true);
         return;
     }
     SmartLaw.Model.Category cgModel = new Model.Category();
     cgModel.ParentCategoryID = cpautoID;
     cgModel.CategoryName = categryName;
     cgModel.IsValid = RCB_Enable.SelectedItem.Value == "1" ? true : false;
     cgModel.LastModifyTime = DateTime.Now;
     cgModel.Memo = TB_Memo.Text;
     long newAutoID = 0;
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "添加分类";
     logModel.Operator = user.UserInfo.UserID;
     logModel.OperationTime = DateTime.Now;
     logModel.OperationDetail = "分类名称:" + categryName + " - 父类编号:" + cpautoID + " - 分类备注:" + TB_Memo.Text;
     try
     {
         cgModel.Orders = cg.GetList(2, cpautoID.ToString()).Tables[0].Rows.Count + 1;
         newAutoID = cg.Add(cgModel);
         if (newAutoID != 0)
         {
             logModel.Memo = "成功";
         }
         else
         {
             logModel.Memo = "失败!";
         }
     }
     catch (Exception ex)
     {
         logModel.Memo = "异常:" + ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (newAutoID != 0)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('添加子类成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('添加子类失败!');", true);
         }
     }
 }
        public void CreateCategory_Should_Return_Category_After_Persisting_It_In_Database()
        {
            var expected = new Model.Category("RTV", "moc", "wykonanie", "użyteczność", "cena/jakość", "popularność");

            var actual = _sut.CreateCategory(expected);

            // Nie rozumiem FakeItEasy, nie ruszam tego póki co.
            A.CallTo(() => _repository.Persist(A<Category>._)).Returns(expected);

            // Tu również ciągnie się błąd z testów "repository",
            // Obiekty są takie same, ale NUnit twierdzi co innego.
            //Assert.That(actual, Is.EqualTo(expected));

            //Assert.That(actual.Name, Is.EqualTo(expected.Name));
            //Assert.That(actual.Id, Is.EqualTo(expected.Id));
        }
Пример #4
0
 protected void btnAdd_Click(object sender, ImageClickEventArgs e)
 {
     if (String.IsNullOrEmpty(txtColumn.Text))
     {
         return;
     }
     Model.Category c = new Model.Category() { CategoryName = txtColumn.Text };
     if (new BLL.CategoryBLL().Add(c))
     {
         Response.Redirect("default.aspx");
     }
     else
     {
         Response.Write("<script>alert('添加失败,请稍后重试!')</script>");
     }
 }
Пример #5
0
        public IEnumerable<Model.Category> GetCategories()
        {
            string sql = "";
            string connectionString = ConfigurationSettings.AppSettings["petshop4"].ToString();

            List<Model.Category> list = new List<Model.Category>();

            using (SqlDataReader reader = DBUtility.SqlHelper.ExecuteReader(connectionString, System.Data.CommandType.Text, sql))
            {
                while (reader.Read())
                {
                    Model.Category category = new Model.Category()
                    {
                        CategoryId = reader.GetString(0),
                        CategoryName = reader.GetString(1),
                        Description = reader.GetString(2)
                    };

                    list.Add(category);

                }
                reader.Close();
            }

            //using (SqlConnection conn = new SqlConnection(connectionString))
            //{
            //    SqlCommand cmd = new SqlCommand(sql, conn);
            //    conn.Open();
            //    SqlDataReader reader = cmd.ExecuteReader();
            //    while (reader.Read())
            //    {
            //        Model.Category category = new Model.Category() { 
            //            CategoryId=reader.GetString(0),
            //            CategoryName=reader.GetString(1),
            //            Description=reader.GetString(2)
            //        };

            //        list.Add(category);

            //    }
            //    reader.Close();
            //}
            return list;
        }
Пример #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.Category DataRowToModel(DataRow row)
 {
     Model.Category model=new Model.Category();
     if (row != null)
     {
         if(row["AutoID"]!=null && row["AutoID"].ToString()!="")
         {
             model.AutoID=long.Parse(row["AutoID"].ToString());
         }
         if(row["CategoryName"]!=null)
         {
             model.CategoryName=row["CategoryName"].ToString();
         }
         if(row["ParentCategoryID"]!=null && row["ParentCategoryID"].ToString()!="")
         {
             model.ParentCategoryID=long.Parse(row["ParentCategoryID"].ToString());
         }
         if(row["Orders"]!=null && row["Orders"].ToString()!="")
         {
             model.Orders=int.Parse(row["Orders"].ToString());
         }
         if(row["LastModifyTime"]!=null && row["LastModifyTime"].ToString()!="")
         {
             model.LastModifyTime=DateTime.Parse(row["LastModifyTime"].ToString());
         }
         if(row["IsValid"]!=null && row["IsValid"].ToString()!="")
         {
             if((row["IsValid"].ToString()=="1")||(row["IsValid"].ToString().ToLower()=="true"))
             {
                 model.IsValid=true;
             }
             else
             {
                 model.IsValid=false;
             }
         }
         if(row["Memo"]!=null)
         {
             model.Memo=row["Memo"].ToString();
         }
     }
     return model;
 }
Пример #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string CreateBy = string.Empty;
            if (Utils.GetCookie(PTSKeys.ADMIN_NAME, PTSKeys.CDL_CMS_KEY) != null)
            {
                CreateBy = Utils.GetCookie(PTSKeys.ADMIN_NAME, PTSKeys.CDL_CMS_KEY);
            }

            int _ErrCode = 0;
            int _RowEffects = 0;

            Model.Category model = new Model.Category();
            model = bll.GetModel(id, -1, "", -1, 1, 1);
            model.CategoryIcon = txtCategoryIcon.Text.Trim();
            model.CategoryName = title.Text.Trim();
            model.CategoryNameUrl = Utils.GenURL(title.Text.Trim());
            model.Intro = txtIntro.Text.Trim();
            model.ParentID = Convert.ToInt64(ddlCategoryId.SelectedValue);
            model.Status = Convert.ToInt32(status.SelectedValue);
            model.CreateBy = CreateBy;

            bll.Update(model, ref _ErrCode, ref _RowEffects);

            if (_RowEffects > 0)
            {

                JscriptMsg(_ErrCode.ToString(), "List.aspx", "Success");

                //reload category in memory
                bll.LoadCategory("vi");
            }
            else
            {
                JscriptMsg(_ErrCode.ToString(), "", "Error");
            }
        }
Пример #8
0
        /// <summary>
        /// 编辑类别
        /// </summary>
        /// <param name="str">接收CategoryId</param>
        /// <returns>返回json</returns>
        private string Edit(string str)
        {
            int _cateId =GetId(str);
            string _result = string.Empty;
            if (_cateId>0)
            {
                modelCategory = bllCategoryExt.GetModel(_cateId);
            }
            if (modelCategory != null)
            {
                DataTable dt = new DataTable();

                dt.Columns.Add("title");
                dt.Columns.Add("images");
                dt.Columns.Add("sort");
                dt.Columns.Add("detail");
                dt.Columns.Add("id");
                DataRow dr = dt.NewRow();
                dr[0] = modelCategory.Title;
                dr[1] = modelCategory.Images;
                dr[2] = modelCategory.Sort;
                dr[3] = modelCategory.Detail;
                dr[4] = modelCategory.CategoryID;
                dt.Rows.Add(dr);
                _result = Json.ToJson(dt);
            }
            return _result;
        }
Пример #9
0
        public void Copy_NotNull_SameTransactionDifferentId()
        {
            //given
            var user = new Stock {
                Name = "User1", IsUserStock = true
            };
            var external = new Stock {
                Name = "Ex"
            };
            var type = new TransactionType {
                Income = true, IsDefault = true
            };
            var tag = new Tag {
                Name = "tag"
            };
            var category = new Model.Category {
                Name = "cat"
            };
            var parent = new Transaction
            {
                Title = "Title",
                Notes = new TrulyObservableCollection <Note> {
                    new Note("Note")
                },
                BookDate      = DateTime.Today,
                UserStock     = user,
                ExternalStock = external,
                Type          = type
            };
            var storedFileInfo = new StoredFileInfo("file", parent.Id);

            parent.StoredFiles.Add(storedFileInfo);
            var source = new Position
            {
                Value    = new PaymentValue(10, 10, 0),
                Category = category,
                Title    = "pos",
                Tags     = new[] { tag },
                Parent   = parent
            };

            parent.Positions = new TrulyObservableCollection <Position>(new[] { source });
            MapperConfiguration.Configure();

            //when
            var result = Position.Copy(source);

            //then
            Assert.NotNull(result);
            Assert.NotEqual(source.Id, result.Id);
            Assert.Equal(source.Value.NetValue, result.Value.NetValue);
            Assert.Equal(source.Value.GrossValue, result.Value.GrossValue);
            Assert.Equal(source.Value.TaxPercentValue, result.Value.TaxPercentValue);
            Assert.Equal(source.Parent, result.Parent);
            Assert.Equal(source.BookDate, result.BookDate);
            Assert.Equal(source.Category, result.Category);
            Assert.Equal(source.Tags, result.Tags);
            Assert.Equal(source.Title, result.Title);

            //parent
            Assert.Equal(parent.Id, result.Parent.Id);
            Assert.Equal(parent.Title, result.Parent.Title);
            Assert.Equal(parent.Notes, result.Parent.Notes);
            Assert.Equal(parent.BookDate, result.Parent.BookDate);
            Assert.Equal(parent.UserStock, result.Parent.UserStock);
            Assert.Equal(parent.ExternalStock, result.Parent.ExternalStock);
            Assert.Equal(parent.IsPropertyChangedEnabled, result.Parent.IsPropertyChangedEnabled);
            Assert.Equal(parent.Type, result.Parent.Type);
            Assert.Equal(parent.Positions.Count, result.Parent.Positions.Count);
            Assert.True(result.Parent.IsValid);
        }
        public bool Update(Model.Category category)
        {
            bool isUpdated = _CategoryRepository.Update(category);

            return(isUpdated);
        }
Пример #11
0
 public void Post(OeDataContext dataContext, Model.Category category)
 {
     dataContext.Update(category);
 }
Пример #12
0
 public bool AddCategory(Model.Category category)
 {
     return(db.AddCategory(category));
 }
Пример #13
0
 /// <summary>
 /// 更改数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Update(Model.Category model)
 {
     return(dal.Update(model));
 }
Пример #14
0
        /// <summary>
        /// 修改父级分类
        /// </summary>
        /// <param name="oldParentCategory">原父级分类</param>
        /// <param name="newParentCategory">现父级分类</param>
        /// <param name="beMovedCategory">所移动的分类</param>
        /// <param name="movedCategory">移动后的分类</param>
        /// <returns></returns>
        public int UpdateFatherCategory(Model.Category oldParentCategory, Model.Category newParentCategory, Model.Category beMovedCategory, Model.Category movedCategory)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(string.Format(" update Category set Name='{0}',Type={1},ParentId={2},Status={3},SortIndex={4},Url='{5}',Content='{6}',", movedCategory.Name, movedCategory.Type, movedCategory.ParentId, movedCategory.Status, movedCategory.SortIndex, movedCategory.Url, movedCategory.Content));
            sb.Append(string.Format(" IdPath=STUFF(IdPath,1,LEN('{0}'),'{1}'),", oldParentCategory.IdPath, newParentCategory == null ? "," : newParentCategory.IdPath));
            sb.Append(string.Format(" Depth={0}+1+(Depth-{1}) ", newParentCategory == null ? 0 : newParentCategory.Depth, beMovedCategory.Depth));
            sb.Append(string.Format(" where CategoryId in (select CategoryId from Category where IdPath like (select IdPath from Category where CategoryId={0})+'%')", beMovedCategory.CategoryId));
            sb.Append(string.Format(" update Category set ParentId={0} where CategoryId={1} ", movedCategory.ParentId, beMovedCategory.CategoryId));
            sb.Append(string.Format(" if not exists(select * from Category where ParentId={0}) ", beMovedCategory.ParentId));
            sb.Append(string.Format(" update Category set HasChildren=0 where CategoryId={0} ", beMovedCategory.ParentId));
            sb.Append(string.Format(" update Category set HasChildren=1 where CategoryId={0} ", movedCategory.ParentId));
            return(DbHelperSQL.ExecuteSql(sb.ToString()));
        }
Пример #15
0
 public IActionResult Create(Model.Category row, string ReturnUrl, int ID)
 {
     return(this.CreateBase(row, ReturnUrl));
 }
Пример #16
0
 public IActionResult Edit(Model.Category row, string returnURL)
 {
     return(this.EditBase(row, returnURL));
 }
Пример #17
0
        ///// <summary>
        ///// 获取列表查询条件项,并构建查询参数集
        ///// </summary>
        //private void GetSearchItem()
        //{
        //    if (parms == null) parms = new ParamsHelper();
        //    if (!string.IsNullOrEmpty(keyword))
        //    {
        //        string productName = keyword;
        //        hKw.Value = productName;
        //        sqlWhere += "and ProductName like @ProductName ";
        //        SqlParameter parm = new SqlParameter("@ProductName", SqlDbType.NVarChar, 256);
        //        parm.Value = "%" + productName + "%";
        //        parms.Add(parm);
        //    }
        //    string sSPrice = txtSPrice.Value.Trim();
        //    if (!string.IsNullOrEmpty(sSPrice))
        //    {
        //        decimal minPrice = 0;
        //        if (decimal.TryParse(sSPrice, out minPrice))
        //        {
        //            sqlWhere += "and ProductPrice >= @MinPrice ";
        //            SqlParameter parm = new SqlParameter("@MinPrice", SqlDbType.Decimal);
        //            parm.Value = minPrice;
        //            parms.Add(parm);
        //        }
        //    }
        //    string sEPrice = txtEPrice.Value.Trim();
        //    if (!string.IsNullOrEmpty(sEPrice))
        //    {
        //        decimal maxPrice = 0;
        //        if (decimal.TryParse(sEPrice, out maxPrice))
        //        {
        //            sqlWhere += "and ProductPrice <= @MaxPrice ";
        //            SqlParameter parm = new SqlParameter("@MaxPrice", SqlDbType.Decimal);
        //            parm.Value = maxPrice;
        //            parms.Add(parm);
        //        }
        //    }
        //}

        /// <summary>
        /// 绑定分类
        /// </summary>
        private void BindCategory()
        {
            string categoryAppend      = string.Empty;
            List <Model.Category> list = WebHelper.CategoryDataProxy.GetList();

            if (list != null && list.Count > 0)
            {
                //获取当前分类
                Model.Category currentItem = null;
                if (!string.IsNullOrEmpty(categoryId))
                {
                    currentItem = list.Find(delegate(Model.Category model) { return(model.NumberID == categoryId); });
                }
                if ((currentItem != null))
                {
                    string navMap = currentItem.CategoryName;
                    List <Model.Category> parentList    = new List <Model.Category>();
                    List <Model.Category> lastChildList = new List <Model.Category>();
                    List <Model.Category> childList     = new List <Model.Category>();
                    GetParent(list, currentItem, ref parentList);
                    GetLastChildAll(list, currentItem, ref lastChildList);
                    GetChild(list, currentItem, ref childList);
                    int parentCount = 0;
                    if (parentList != null && parentList.Count > 0)
                    {
                        parentCount = parentList.Count;
                        int n = 0;
                        foreach (Model.Category model in parentList)
                        {
                            if (model != null)
                            {
                                n++;
                                navMap = string.Format("<a href='/Shares/SearchProduct.aspx?c={1}'>{0}</a>", model.CategoryName, model.NumberID) + "&nbsp;&gt;&nbsp;" + navMap;
                                if (parentCount == 2)
                                {
                                    if (n == 2)
                                    {
                                        categoryAppend = string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ab\"><i class=\"aba\"></i><span class=\"abb\">{0}</span></a>", model.CategoryName, model.NumberID) + categoryAppend;
                                    }
                                    else
                                    {
                                        categoryAppend = string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ad ad-1\"><i class=\"ada\"></i><span class=\"adb\">{0}</span></a>", model.CategoryName, model.NumberID);
                                    }
                                }
                                else
                                {
                                    categoryAppend = string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ab\"><i class=\"aba\"></i><span class=\"abb\">{0}</span></a>", model.CategoryName, model.NumberID);
                                }
                            }
                        }
                    }
                    if (parentCount == 0)
                    {
                        categoryAppend += string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ab\"><i class=\"aba\"></i><span class=\"abb\">{0}</span></a>", currentItem.CategoryName, currentItem.NumberID);
                    }
                    else if (parentCount == 1)
                    {
                        categoryAppend += string.Format("<div class=\"ad ad-current ad-1\"><i class=\"ada\"></i><span class=\"adb\">{0}</span></div>", currentItem.CategoryName);
                    }
                    else
                    {
                        categoryAppend += string.Format("<div class=\"ad ad-current ad-2\"><i class=\"ada\"></i><span class=\"adb\">{0}</span></div>", currentItem.CategoryName);
                    }
                    cad.InnerHtml = navMap;

                    if (childList != null && childList.Count > 0)
                    {
                        foreach (Model.Category model in childList)
                        {
                            if (parentCount == 0)
                            {
                                categoryAppend += string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ad ad-1\"><i class=\"ada\"></i><span class=\"adb\">{0}<span class=\"adc\"></span></span></a>", model.CategoryName, model.NumberID);
                            }
                            else if (parentCount == 1)
                            {
                                categoryAppend += string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ad ad-2\"><i class=\"ada\"></i><span class=\"adb\">{0}<span class=\"adc\">(19.5万)</span></span></a>", model.CategoryName, model.NumberID);
                            }
                        }
                    }

                    if (lastChildList != null && lastChildList.Count() > 0)
                    {
                        foreach (Model.Category model in lastChildList)
                        {
                            if (model != null)
                            {
                                cIdAppend += string.Format("'{0}',", model.NumberID);
                            }
                        }
                        cIdAppend = cIdAppend.Trim(',');
                    }
                }
                else
                {
                    Model.Category rootItem = list.Find(delegate(Model.Category model) { return(model.CategoryName == "所有分类"); });
                    if (rootItem != null)
                    {
                        cad.InnerHtml   = string.Format("<a href='/Shares/SearchProduct.aspx?c={1}'>{0}</a>", rootItem.CategoryName, rootItem.NumberID);
                        categoryAppend += string.Format("<a href=\"/Shares/SearchProduct.aspx?c={0}\" class=\"ab\"><i class=\"aba\"></i><span class=\"abb\">所有分类</span></a>", rootItem.NumberID);
                        List <Model.Category> list1 = list.FindAll(delegate(Model.Category model) { return(model.ParentID == rootItem.NumberID); });
                        if (list1 != null && list1.Count > 0)
                        {
                            foreach (Model.Category model1 in list1)
                            {
                                categoryAppend += string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ad ad-1\"><i class=\"ada\"></i><span class=\"adb\">{0}</span></a>", model1.CategoryName, model1.NumberID);
                                List <Model.Category> list2 = list.FindAll(delegate(Model.Category model2) { return(model2.ParentID == model1.NumberID); });
                                if (list2 != null && list2.Count > 0)
                                {
                                    foreach (Model.Category model2 in list2)
                                    {
                                        categoryAppend += string.Format("<a href=\"/Shares/SearchProduct.aspx?c={1}\" class=\"ad ad-2\"><i class=\"ada\"></i><span class=\"adb\">{0}</span></a>", model2.CategoryName, model2.NumberID);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            ltrCategory.Text = categoryAppend;
        }
Пример #18
0
        public static void Initialize(IServiceProvider serviceProvider, bool development)
        {
            using (var context = new WorldbuilderContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <WorldbuilderContext> >()))
            {
                if (context.Categories.Any() || context.Bricks.Any())
                {
                    return;
                }

                #region Category Types

                var geography = new CategoryType()
                {
                    Name = "geography"
                };

                var beliefs = new CategoryType()
                {
                    Name = "beliefs, religion, spirituality"
                };

                var cosmology = new CategoryType()
                {
                    Name = "cosmology"
                };

                var biology = new CategoryType()
                {
                    Name = "biology"
                };

                var something = new CategoryType()
                {
                    Name = "something"
                };

                var beings = new CategoryType()
                {
                    Name = "beings"
                };
                var itemsOfCommonUse = new CategoryType()
                {
                    Name = "items of common use"
                };
                var technology = new CategoryType()
                {
                    Name = "technology"
                };
                var roleInSociety = new CategoryType()
                {
                    Name = "role in society"
                };
                var astronomy = new CategoryType()
                {
                    Name = "astronomy"
                };

                #endregion

                var catTypes = new[] { geography, beliefs, cosmology, biology, something, beings, itemsOfCommonUse, technology, roleInSociety, astronomy };

                #region Categories
                var ocean = new Model.Category
                {
                    Name         = "Ocean",
                    Description  = "Vast and a continuous frame of salty water, often taking a large part of planet's surface.",
                    CategoryType = geography
                };
                var sea = new Model.Category
                {
                    Name         = "Sea",
                    Description  = "Body of salt water, smaller and shallower than ocean.",
                    CategoryType = geography
                };

                var continent = new Model.Category
                {
                    Name         = "Continent",
                    Description  = "Any of a world's main continuous expanses of land.",
                    CategoryType = geography
                };
                var world = new Model.Category
                {
                    Name        = "World",
                    Description = "Place in the universe or the multiverse characterized by connected set of culture or history." +
                                  "Usually one planet with the surrounding area.",
                    CategoryType = cosmology
                };
                var river = new Model.Category
                {
                    Name         = "River",
                    Description  = "A large natural stream of water flowing in a channel to the sea, a lake, or another river.",
                    CategoryType = geography
                };
                var city = new Model.Category
                {
                    Name         = "City",
                    Description  = "A built-up area with a name, defined boundaries, and local government, that is larger than a town and a village.",
                    CategoryType = geography
                };
                var person = new Model.Category
                {
                    Name         = "Person",
                    Description  = "A conscious being regarded as an individual.",
                    CategoryType = beings
                };
                var race = new Model.Category
                {
                    Name         = "Race",
                    Description  = "A group or set of beings or things with a common feature or features.",
                    CategoryType = beings
                };
                var country = new Model.Category
                {
                    Name         = "Country",
                    Description  = "A nation with its own government, occupying a particular territory.",
                    CategoryType = geography
                };
                var capital = new Category
                {
                    Name         = "Capital",
                    Description  = "The municipality exercising primary status in a country, state, province, or other administrative region, usually as its seat of government.",
                    CategoryType = geography
                };
                var animal = new Model.Category
                {
                    Name         = "Animal",
                    Description  = "Multicellular eukaryotic organisms that form the biological kingdom Animalia.",
                    CategoryType = beings
                };
                var furniture = new Model.Category
                {
                    Name         = "Furniture",
                    Description  = "Furniture refers to movable objects intended to support various human activities such as seating (e.g., chairs, stools, and sofas), eating (tables), and sleeping (e.g., beds).",
                    CategoryType = itemsOfCommonUse
                };
                var transport = new Model.Category
                {
                    Name         = "Transport",
                    Description  = "Transport or transportation is the movement of humans, animals and goods from one location to another. In other words, the action of transport is defined as a particular movement of an organism or thing from a point A to a Point B.",
                    CategoryType = itemsOfCommonUse
                };
                var machine = new Model.Category
                {
                    Name         = "Machine",
                    Description  = "A machine (or mechanical device) is a mechanical structure that uses power to apply forces and control movement to perform an intended action.",
                    CategoryType = technology
                };
                var inventor = new Model.Category
                {
                    Name         = "Inventor",
                    Description  = "An inventor is a person who creates or discovers a new method, form, device or other useful means that becomes known as an invention.",
                    CategoryType = roleInSociety
                };
                var scientist = new Model.Category
                {
                    Name         = "Scientist",
                    Description  = "A scientist is someone who conducts scientific research to advance knowledge in an area of interest.",
                    CategoryType = roleInSociety
                };
                var planet = new Model.Category
                {
                    Name         = "Planet",
                    Description  = "A planet is an astronomical body orbiting a star or stellar remnant that is massive enough to be rounded by its own gravity, is not massive enough to cause thermonuclear fusion, and has cleared its neighbouring region of planetesimals.",
                    CategoryType = astronomy
                };
                #endregion

                var categories = new[]
                { world, ocean, continent, sea, country, city, river, race, person, capital, animal, furniture, transport, machine, inventor, scientist };

                #region Sample bricks

                var sampleWorld = new Model.Brick
                {
                    Name      = "Sample world",
                    ShortDesc = "Just a sample world"
                };
                var sampleContinent = new Model.Brick
                {
                    Name      = "Sample continent",
                    ShortDesc = "Just a sample continent"
                };
                var secondContinent = new Model.Brick
                {
                    Name      = "Second continent",
                    ShortDesc = "Just another sample continent"
                };
                var cityState = new Model.Brick
                {
                    Name      = "Sample city-state",
                    ShortDesc = "Just a sample that has more than 1 category assigned"
                };

                var london = new Model.Brick
                {
                    Name      = "London",
                    ShortDesc = "Capital of the United Kingdom.",
                    LongDesc  = @"London is the capital and largest city of England and of the United Kingdom.Standing on the River Thames in the south-east of England, at the head of its 50-mile (80 km) estuary leading to the North Sea, London has been a major settlement for two millennia. Londinium was founded by the Romans.[9] The City of London, London's ancient core − an area of just 1.12 square miles (2.9 km2) and colloquially known as the Square Mile − retains boundaries that closely follow its medieval limits. The City of Westminster is also an Inner London borough holding city status. Greater London is governed by the Mayor of London and the London Assembly.

  London is considered to be one of the world's most important global cities and has been termed the world's most powerful, most desirable, most influential, most visited, most expensive, innovative, sustainable, most investment friendly, and most popular for work[29] city. London exerts a considerable impact upon the arts, commerce, education, entertainment, fashion, finance, healthcare, media, professional services, research and development, tourism and transportation.[30][31] London ranks 26th out of 300 major cities for economic performance.[32] It is one of the largest financial centres[33] and has either the fifth or the sixth largest metropolitan area GDP.[note 3][34][35][36][37][38] It is the most-visited city as measured by international arrivals[39] and has the busiest city airport system as measured by passenger traffic.[40] It is the leading investment destination,[41][42][43][44] hosting more international retailers[45][46] and ultra high-net-worth individuals[47][48] than any other city. London's universities form the largest concentration of higher education institutes in Europe,[49] and London is home to highly ranked institutions such as Imperial College London in natural and applied sciences, the London School of Economics in social sciences, and the comprehensive University College London.[50][51][52] In 2012, London became the first city to have hosted three modern Summer Olympic Games.[53]

  London has a diverse range of people and cultures, and more than 300 languages are spoken in the region.[54] Its estimated mid-2018 municipal population (corresponding to Greater London) was 8,908,081,[4] the third most populous of any city in Europe[55] and accounts for 13.4% of the UK population.[56] London's urban area is the third most populous in Europe, after Paris and Istanbul, with 9,787,426 inhabitants at the 2011 census.[57] The population within the London commuter belt is the most populous in Europe with 14,040,163 inhabitants in 2016.[note 4][3][58] London was the world's most populous city from c. 1831 to 1925.[59]

  London contains four World Heritage Sites: the Tower of London; Kew Gardens; the site comprising the Palace of Westminster, Westminster Abbey, and St Margaret's Church; and the historic settlement in Greenwich where the Royal Observatory, Greenwich defines the Prime Meridian (0° longitude) and Greenwich Mean Time.[60] Other landmarks include Buckingham Palace, the London Eye, Piccadilly Circus, St Paul's Cathedral, Tower Bridge, Trafalgar Square and The Shard. London has numerous museums, galleries, libraries and sporting events. These include the British Museum, National Gallery, Natural History Museum, Tate Modern, British Library and West End theatres.[61] The London Underground is the oldest underground railway network in the world."
                };

                var newYork = new Model.Brick
                {
                    Name      = "New York City",
                    ShortDesc = "The most populous city in the United States",
                    LongDesc  = @"New York City (NYC), also known as the City of New York or simply New York (NY), is the most populous city in the United States. With an estimated 2018 population of 8,398,748 distributed over a land area of about 302.6 square miles (784 km2), New York is also the most densely populated major city in the United States.[10] Located at the southern tip of the state of New York, the city is the center of the New York metropolitan area, the largest metropolitan area in the world by urban landmass[11] and one of the world's most populous megacities,[12][13] with an estimated 19,979,477 people in its 2018 Metropolitan Statistical Area and 22,679,948 residents in its Combined Statistical Area.[3][4] A global power city,[14] New York City has been described as the cultural,[15][16][17][18][19] financial,[20][21][22] and media capital of the world,[23][24] and exerts a significant impact upon commerce,[22] entertainment, research, technology, education, politics, tourism, art, fashion, and sports. The city's fast pace[25][26][27] has inspired the term New York minute.[28] Home to the headquarters of the United Nations,[29] New York is an important center for international diplomacy.[30][31]

Situated on one of the world's largest natural harbors,[32][33] New York City consists of five boroughs, each of which is a separate county of the State of New York.[34] The five boroughs – Brooklyn, Queens, Manhattan, The Bronx, and Staten Island – were consolidated into a single city in 1898.[35] The city and its metropolitan area constitute the premier gateway for legal immigration to the United States.[36] As many as 800 languages are spoken in New York,[37][38][39][40] making it the most linguistically diverse city in the world.[39][41][42] New York City is home to 3.2 million residents born outside the United States,[43] the largest foreign born population of any city in the world as of 2016.[44] As of 2019, the New York metropolitan area is estimated to produce a gross metropolitan product (GMP) of US$1.9 trillion.[8] If greater New York City were a sovereign state, it would have the 12th highest GDP in the world.[45] New York is home to the highest number of billionaires of any city in the world.[46]

New York City traces its origins to a trading post founded by colonists from the Dutch Republic in 1624 on Lower Manhattan; the post was named New Amsterdam in 1626.[47] The city and its surroundings came under English control in 1664[47] and were renamed New York after King Charles II of England granted the lands to his brother, the Duke of York.[48] New York was the capital of the United States from 1785 until 1790,[49] and has been the largest US city since 1790.[50] The Statue of Liberty greeted millions of immigrants as they came to the U.S. by ship in the late 19th and early 20th centuries[51] and is an international symbol of the U.S. and its ideals of liberty and peace.[52] In the 21st century, New York has emerged as a global node of creativity and entrepreneurship,[53] social tolerance,[54] and environmental sustainability,[55][56] and as a symbol of freedom and cultural diversity.[57] In 2019, New York was voted the greatest city in the world per a survey of over 30,000 people from 48 cities worldwide, citing its cultural diversity.[15]

Many districts and landmarks in New York City are well known, including three of the world's ten most visited tourist attractions in 2013;[58] a record 62.8 million tourists visited in 2017.[59] Several sources have ranked New York the most photographed city in the world.[60][61] Times Square, iconic as the world's 'heart'[62] and 'crossroads',[63] is the brightly illuminated hub of the Broadway Theater District,[64] one of the world's busiest pedestrian intersections,[65][66] and a major center of the world's entertainment industry.[67] The names of many of the city's landmarks, skyscrapers,[68] and parks are known internationally. Manhattan's real estate market is among the most expensive in the world.[69][70] New York is home to the largest ethnic Chinese population outside of Asia,[71][72] with multiple distinct Chinatowns across the city.[73][74][75] Providing continuous 24/7 service,[76] the New York City Subway is the largest single-operator rapid transit system worldwide, with 472 rail stations.[77][78][79] The city has over 120 colleges and universities, including Columbia University, New York University, and Rockefeller University, ranked among the top universities in the world.[80][81] Anchored by Wall Street in the Financial District of Lower Manhattan, New York has been called both the most economically powerful city and world's leading financial center,[22][82][83][84] and is home to the world's two largest stock exchanges by total market capitalization, the New York Stock Exchange and NASDAQ.[85][86]"
                };
                var dog = new Model.Brick
                {
                    Name      = "Dog",
                    ShortDesc = "Domestic animal, a best friend for some, food for others.",
                    LongDesc  = @"The domestic dog (Canis lupus familiaris when considered a subspecies of the wolf or Canis familiaris when considered a distinct species)[5] is a member of the genus Canis (canines), which forms part of the wolf-like canids,[6] and is the most widely abundant terrestrial carnivore.[7][8][9][10][11] The dog and the extant gray wolf are sister taxa[12][13][14] as modern wolves are not closely related to the wolves that were first domesticated,[13][14] which implies that the direct ancestor of the dog is extinct.[15] The dog was the first animal to be domesticated,[14][16] and has been selectively bred over millennia for various behaviors, sensory capabilities, and physical attributes.[17]

      Their long association with humans has led dogs to be uniquely attuned to human behavior[18] and they are able to thrive on a starch-rich diet that would be inadequate for other canids.[19] Dogs vary widely in shape, size and colors.[20] They perform many roles for humans, such as hunting, herding, pulling loads, protection, assisting police and military, companionship and, more recently, aiding disabled people and therapeutic roles. This influence on human society has given them the sobriquet of 'man's best friend'."
                };
                var train = new Model.Brick
                {
                    Name      = "Train",
                    ShortDesc = "A form of rail transport consisting of a series of connected vehicles"
                };
                var table = new Model.Brick
                {
                    Name      = "Table",
                    ShortDesc = "An item of furniture with a flat top and one or more legs"
                };
                var tesla = new Model.Brick
                {
                    Name      = "Nikola Tesla",
                    ShortDesc = "a Serbian-American inventor"
                };
                var einstein = new Model.Brick
                {
                    Name      = "Albert Einstein",
                    ShortDesc = "A German-born theoretical physicist"
                };
                var uk = new Model.Brick
                {
                    Name      = "United Kingdom",
                    ShortDesc = "The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom (abbreviated to UK or U.K.) or Britain, is a sovereign country located off the north­western coast of the European mainland."
                };
                var europe = new Model.Brick
                {
                    Name      = "Europe",
                    ShortDesc = "Europe is a continent located entirely in the Northern Hemisphere and mostly in the Eastern Hemisphere."
                };
                var australia = new Model.Brick
                {
                    Name      = "Australia",
                    ShortDesc = "Australia, officially the Commonwealth of Australia, is a sovereign country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands."
                };
                var earth = new Model.Brick
                {
                    Name      = "Earth",
                    ShortDesc = "Earth is the third planet from the Sun and the only astronomical object known to harbor life."
                };
                #endregion

                var bricks = new[]
                { sampleWorld, sampleContinent, secondContinent, cityState, london, newYork, dog, train, table, tesla, einstein, uk, europe, australia, earth };



                var brickCats = new[]
                {
                    new BrickCategory {
                        Brick = sampleWorld, Category = world
                    },
                    new BrickCategory {
                        Brick = sampleContinent, Category = continent
                    },
                    new BrickCategory {
                        Brick = secondContinent, Category = continent
                    },
                    new BrickCategory {
                        Brick = cityState, Category = city
                    },
                    new BrickCategory {
                        Brick = cityState, Category = country
                    },
                    new BrickCategory {
                        Brick = london, Category = city
                    },
                    new BrickCategory {
                        Brick = london, Category = capital
                    },

                    new BrickCategory {
                        Brick = uk, Category = country
                    },
                    new BrickCategory {
                        Brick = europe, Category = continent
                    },

                    new BrickCategory {
                        Brick = australia, Category = continent
                    },

                    new BrickCategory {
                        Brick = australia, Category = country
                    },
                    new BrickCategory {
                        Brick = newYork, Category = city
                    },
                    new BrickCategory {
                        Brick = dog, Category = animal
                    },
                    new BrickCategory {
                        Brick = table, Category = furniture
                    },
                    new BrickCategory {
                        Brick = train, Category = transport
                    },
                    new BrickCategory {
                        Brick = train, Category = machine
                    },
                    new BrickCategory {
                        Brick = tesla, Category = person
                    },
                    new BrickCategory {
                        Brick = tesla, Category = inventor
                    },
                    new BrickCategory {
                        Brick = einstein, Category = person
                    },
                    new BrickCategory {
                        Brick = einstein, Category = scientist
                    },

                    new BrickCategory {
                        Brick = earth, Category = planet
                    }
                };

                var brToBr = new[]
                {
                    new BrickToBrick {
                        Brick = sampleWorld, Child = sampleContinent
                    },
                    new BrickToBrick {
                        Brick = sampleWorld, Child = secondContinent
                    },

                    new BrickToBrick {
                        Brick = europe, Child = uk
                    },
                    new BrickToBrick {
                        Brick = uk, Child = london
                    },
                    new BrickToBrick {
                        Brick = sampleContinent, Child = cityState
                    },

                    new BrickToBrick {
                        Brick = earth, Child = europe
                    },

                    new BrickToBrick {
                        Brick = earth, Child = australia
                    },
                };



                if (development)
                {
                    foreach (var item in catTypes)
                    {
                        context.CategoryTypes.Add(item);
                        context.SaveChanges();
                    }
                    foreach (var item in categories)
                    {
                        context.Categories.Add(item);
                        context.SaveChanges();
                    }
                    foreach (var item in bricks)
                    {
                        context.Bricks.Add(item);
                        context.SaveChanges();
                    }
                    foreach (var item in brickCats)
                    {
                        context.BrickCategories.Add(item);
                        context.SaveChanges();
                    }
                    foreach (var item in brToBr)
                    {
                        context.BrickToBrick.Add(item);
                        context.SaveChanges();
                    }
                }
                else
                {
                    context.CategoryTypes.AddRange(catTypes);
                    context.Categories.AddRange(categories);
                    context.Bricks.AddRange(bricks);
                    context.BrickCategories.AddRange(brickCats);
                    context.BrickToBrick.AddRange(brToBr);

                    context.SaveChanges();
                }
            }
        }
Пример #19
0
        private void ShowInfo(int _id)
        {
            Model.Category model = new Model.Category();

            model = bll.GetModel(_id, -1, "", -1, 1, 1);

            if (null != model && model.CategoryID > 0)
            {
                title.Text = model.CategoryName;
                txtCategoryIcon.Text = model.CategoryIcon;
                txtIntro.Text = model.Intro;
                ddlCategoryId.SelectedValue = model.ParentID.ToString();
                status.SelectedValue = model.Status.ToString();
            }
        }
Пример #20
0
 /// <summary>
 /// 添加数据到数据库
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Insert(Model.Category model)
 {
     return(dal.Insert(model));
 }
Пример #21
0
 public void AddCategory(Model.Category C)
 {
     _dbContext.Categories.Add(C);
     _dbContext.SaveChanges();
     MainWindow.catDict.Add(C.CategoryId, C.CategoryName);
 }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            int er = 0;

            ep.Clear();
            if (nameTextBox.Text == "")
            {
                er++;
                ep.SetError(nameTextBox, "Required");
            }

            if (er > 0)
            {
                return;
            }

            Model.Category _category = new Model.Category();
            _category.Name = nameTextBox.Text;
            if (hiddenIdTextBox.Text != "")
            {
                _category.Id = Convert.ToInt64(hiddenIdTextBox.Text);
            }

            string checkOrUpdate = SaveButton.Text;

            if (checkOrUpdate == "Save")
            {
                string QueryDuplicate = @"SELECT COUNT(*) FROM Categories where Name='" + _category.Name + "' ";

                SqlCommand     commandDuplicateCheck = new SqlCommand(QueryDuplicate, _con);
                DataTable      ds = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(commandDuplicateCheck);
                da.Fill(ds);
                if (ds.Rows[0][0].ToString() == "1")
                {
                    string msg = "Duplicate Entry not Allowed.";
                    MessageBox.Show(msg);
                }
                else
                {
                    bool isAdded = _CategoryManager.Add(category: _category);
                    if (isAdded)
                    {
                        MessageBox.Show("Successfuly Saved.");
                        nameTextBox.Clear();
                        CategoryLode();
                        return;
                    }
                    MessageBox.Show("Sorry! failed.");
                }
            }
            if (checkOrUpdate == "Update")
            {
                bool isUpdated = _CategoryManager.Update(category: _category);
                if (isUpdated)
                {
                    MessageBox.Show("Saved Changed Successfully!");
                    nameTextBox.Clear();
                    hiddenIdTextBox.Clear();
                    CategoryLode();
                    SaveButton.Text = "Save";
                    return;
                }
            }
        }
Пример #23
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Category GetModel(long AutoID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  AutoID,CategoryName,ParentCategoryID,Orders,LastModifyTime,IsValid,Memo from Category");
            strSql.Append(" where AutoID=@AutoID limit 1");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@AutoID", MySqlDbType.Int64)
            };
            parameters[0].Value = AutoID;

            Model.Category model=new Model.Category();
            DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Пример #24
0
 public bool DelCategory(Model.Category category)
 {
     return(db.DelCategory(category));
 }
Пример #25
0
        void AssignCategory(int postID, string category)
        {
            var hanaCat = Hana.Model.Category.SingleOrDefault(x => x.Description == category);
            if (hanaCat == null) {
                hanaCat = new Model.Category();
                hanaCat.Description = category;
                hanaCat.Slug = category.CreateSlug();
                hanaCat.Add();
            }

            var rel = new Hana.Model.Categories_Post();
            rel.PostID = postID;
            rel.CategoryID = hanaCat.CategoryID;
            rel.Add();
        }
Пример #26
0
 public CategoryVM()
 {
     this.category = new Model.Category();
 }
        public bool Add(Model.Category category)
        {
            bool isAdded = _CategoryRepository.Add(category);

            return(isAdded);
        }
Пример #28
0
 public CategoryVM(Model.Category category)
 {
     // TODO: Complete member initialization
     this.category = category;
 }
        public void ReadBetRadarDataFromXml()
        {
            FileSearchHelper fileHelper = new FileSearchHelper(FilePath);
            var files = fileHelper.AllFilesFromFolder();

            if (files.Length != 0)
            {
                foreach (var file in files)
                {
                    var fileName = Path.GetFileName(file);
                    Console.WriteLine("Reading file....: " + file);
                    if (file != null)
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(BetradarBetData));
                        using (FileStream fileStream = new FileStream(file, FileMode.Open))
                        {
                            BetradarBetData betData = (BetradarBetData)serializer.Deserialize(fileStream);
                            //var sports = betData.Sports.Sport;

                            if (betData.Sports.Sport != null)
                            {
                                foreach (var s in betData.Sports.Sport)
                                {
                                    Model.Sport sportToAdd = new Model.Sport();
                                    sportToAdd.SportID = Convert.ToInt32(s.BetradarSportID);
                                    foreach (var sTexts in s.Texts.Text)
                                    {
                                        if (sTexts.Language.ToLower() == "bet")
                                        {
                                            sportToAdd.SportName = sTexts.Value;
                                        }
                                    }
                                    dapperLogic.AddSport(sportToAdd);

                                    if (s.Category != null)
                                    {
                                        //watch.Start();
                                        foreach (var c in s.Category)
                                        {
                                            Model.Category categoryToAdd = new Model.Category();
                                            categoryToAdd.CategoryID = Convert.ToInt32(c.BetradarCategoryID);
                                            if (c.Texts.Text != null)
                                            {
                                                foreach (var ct in c.Texts.Text)
                                                {
                                                    if (ct.Language.ToLower() == "bet")
                                                    {
                                                        categoryToAdd.CategoryName = ct.Value;
                                                    }
                                                    dapperLogic.AddCategory(categoryToAdd);

                                                    if (c.Tournament != null)
                                                    {
                                                        Model.Tournament tournamentToAdd = new Model.Tournament();
                                                        tournamentToAdd.TournamentID = Convert.ToInt32(c.Tournament.BetradarTournamentID);
                                                        tournamentToAdd.SportID      = sportToAdd.SportID;
                                                        tournamentToAdd.CategoryID   = categoryToAdd.CategoryID;
                                                        if (c.Tournament.Texts.Text != null)
                                                        {
                                                            foreach (var tourn in c.Tournament.Texts.Text)
                                                            {
                                                                if (tourn.Language.ToLower() == "bet")
                                                                {
                                                                    tournamentToAdd.TournamentName = tourn.Value;
                                                                }
                                                                dapperLogic.AddTournament(tournamentToAdd);
                                                            }

                                                            if (c.Tournament.Match != null)
                                                            {
                                                                foreach (var tmatch in c.Tournament.Match)
                                                                {
                                                                    Model.Event matchEventToAdd = new Model.Event();
                                                                    matchEventToAdd.EventID      = Convert.ToInt32(tmatch.BetradarMatchID);
                                                                    matchEventToAdd.SportID      = sportToAdd.SportID;
                                                                    matchEventToAdd.TournamentID = tournamentToAdd.TournamentID;

                                                                    if (tmatch.Fixture.DateInfo != null)
                                                                    {
                                                                        matchEventToAdd.EventDate = tmatch.Fixture.DateInfo.MatchDate;
                                                                    }
                                                                    if (tmatch.Fixture.StatusInfo != null)
                                                                    {
                                                                        matchEventToAdd.EventStatusInfo = Convert.ToInt32(tmatch.Fixture.StatusInfo.Off);
                                                                    }
                                                                    if (tmatch.Fixture.NeutralGround != null)
                                                                    {
                                                                        matchEventToAdd.NeutralGround = Convert.ToInt32(tmatch.Fixture.NeutralGround);
                                                                    }
                                                                    if (tmatch.Fixture.RoundInfo != null)
                                                                    {
                                                                        if (tmatch.Fixture.RoundInfo.Round != null)
                                                                        {
                                                                            matchEventToAdd.RoundInfo = Convert.ToInt32(tmatch.Fixture.RoundInfo.Round);
                                                                        }
                                                                    }

                                                                    dapperLogic.AddEvent(matchEventToAdd);

                                                                    if (tmatch.Fixture != null)
                                                                    {
                                                                        if (tmatch.Fixture.Competitors != null)
                                                                        {
                                                                            if (tmatch.Fixture.Competitors.Texts != null)
                                                                            {
                                                                                foreach (var comp in tmatch.Fixture.Competitors.Texts)
                                                                                {
                                                                                    foreach (var cT in comp.Text)
                                                                                    {
                                                                                        foreach (var ctttt in cT.TextProperty)
                                                                                        {
                                                                                            if (ctttt.Language.ToLower() == "bet")
                                                                                            {
                                                                                                Model.Competitor competitorToAdd = new Model.Competitor();
                                                                                                competitorToAdd.CompetitorName = ctttt.Value;
                                                                                                competitorToAdd.EventID        = matchEventToAdd.EventID;
                                                                                                dapperLogic.AddCompetitor(competitorToAdd);
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }

                                                                    if (tmatch.MatchOdds != null)
                                                                    {
                                                                        if (tmatch.MatchOdds.Bet != null)
                                                                        {
                                                                            foreach (var mo in tmatch.MatchOdds.Bet)
                                                                            {
                                                                                Model.BetType betType = new Model.BetType();
                                                                                betType.BetTypeValue = Convert.ToInt32(mo.OddsType);
                                                                                betType.EventID      = matchEventToAdd.EventID;
                                                                                dapperLogic.AddBetType(betType);
                                                                                if (mo.Odds != null)
                                                                                {
                                                                                    foreach (var odds in mo.Odds)
                                                                                    {
                                                                                        decimal       d            = 0;
                                                                                        Model.Markets marketsToAdd = new Model.Markets();
                                                                                        marketsToAdd.MarketOutcome = Convert.ToString(odds.OutCome);
                                                                                        Decimal.TryParse(odds.Text, out d);
                                                                                        if (d != 0)
                                                                                        {
                                                                                            marketsToAdd.MarketOdds = d;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            Decimal.TryParse(odds.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out d);
                                                                                            marketsToAdd.MarketOdds = d;
                                                                                        }
                                                                                        marketsToAdd.BetType = betType.BetTypeValue;
                                                                                        dapperLogic.AddMarket(marketsToAdd);
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        //watch.Stop();
                                    }
                                }
                            }
                        }
                    }
                    Console.WriteLine("File has been Read");
                    //File.Move(file, FilePathToMove + fileName);
                }
                Console.WriteLine("Successfully Read All BetRadarBetData XML Files");
                Console.WriteLine("Amount of time (): " + watch.ElapsedMilliseconds);
            }
            else
            {
                Console.WriteLine("No Files to read");
            }
        }