public AdminCatalogModel GetCatalogItemList(string cateId)
        {
            var tmpCat = new DZoft.dBug.TCS.DL.Catalogs(cateId);

            var xmlSerializer = new XmlSerializer(typeof(DataSet));
            DataSet tmpDS = tmpCat.Read();
            var memoryStream = new MemoryStream();
            TextWriter streamWriter = new StreamWriter(memoryStream);
            xmlSerializer.Serialize(streamWriter, tmpDS);
            var strPickDataReturn = Encoding.UTF8.GetString(memoryStream.ToArray());

            var doc = new XmlDocument();

            doc.LoadXml(strPickDataReturn);

            //Parsing the xml
            XElement xmlCatalogs = XElement.Parse(strPickDataReturn);

            //Reading the xml and filling model
            AdminCatalogModel adminCatalogsModels = (from adminCatalogs in xmlCatalogs.Descendants("DETAIL")

                                                     select new AdminCatalogModel()
                                                                {
                                                                    Key = adminCatalogs.Element("KEY") != null ? adminCatalogs.Element("KEY").Value : "",
                                                                    Comment = adminCatalogs.Element("COMMENTS") != null ? adminCatalogs.Element("COMMENTS").Value : "",
                                                                    Description = adminCatalogs.Element("DESC") != null ? adminCatalogs.Element("DESC").Value : "",
                                                                    DisplayTumbnail = Convert.ToBoolean(adminCatalogs.Element("THUMBNAIL") != null ? adminCatalogs.Element("THUMBNAIL").Value :"false"),
                                                                    StartDate = adminCatalogs.Element("START") != null ? adminCatalogs.Element("START").Value : "",
                                                                    EndDate = adminCatalogs.Element("END") != null ? adminCatalogs.Element("END").Value : "",
                                                                    SortSquence = adminCatalogs.Element("SORT") != null ? adminCatalogs.Element("SORT").Value : "",
                                                                    Webcolumn = adminCatalogs.Element("COLUMNS") != null ? adminCatalogs.Element("COLUMNS").Value : "",
                                                                    AdminCatalogItemModels = (from catalogItems in xmlCatalogs.Descendants("ITEMS") select  new AdminCatalogItemModel
                                                                                                                                                                {
                                                                                                                                                                    Mod =  catalogItems.Element("SOURCE") != null ? catalogItems.Element("SOURCE").Value : "",
                                                                                                                                                                    Sku =  catalogItems.Element("SKU") != null ? catalogItems.Element("SKU").Value : "",
                                                                                                                                                                    Price =  catalogItems.Element("PRICE") != null ? catalogItems.Element("PRICE").Value : "",
                                                                                                                                                                    SalesPrice = catalogItems.Element("LIST") != null ? catalogItems.Element("LIST").Value : "",
                                                                                                                                                                    Title = catalogItems.Element("TITLE") != null ? catalogItems.Element("TITLE").Value : "",

                                                                                                                                                                })

                                                                }).SingleOrDefault();

            return adminCatalogsModels;
        }
        public void UpdateCatalogData(int index,string cateId, DZoft.dBug.TCS.DL.PickBase.openMode opMode,IEnumerable<AdminCatalogItemModel>models )
        {
            DZoft.dBug.TCS.DL.Catalogs t = new DZoft.dBug.TCS.DL.Catalogs(cateId);
              //t.AddVariable("CATALOG", ddlCats.SelectedValue);
              foreach (var model in models)
              {
              t.SKUS = model.Sku;
              t.Sources = model.Mod;
              t.Titles = model.Title;
              t.Prices = model.Price;
              t.SalePrices = model.SalesPrice;

              }
              t.AddVariable("UPDATETYPE", "ITEMS");
              t.Write();
        }
        public void AddCatalogItem(string cateId,string sku, string source, string title, string price, string saleprice,IEnumerable<AdminCatalogItemModel>models )
        {
            var t = new DZoft.dBug.TCS.DL.Catalogs(cateId);

              source = source.ToLower();
               if (source.Equals("textbook"))
               {

               source = "TX";

               }
               else
               {
               source = source.Equals("Tradebook") ? "TR" : "GM";
               }
              foreach (var model in models)
              {

              t.SKUS = model.Sku;
              t.Sources = model.Mod;

              t.Titles = model.Title;
              t.Prices = model.Price;
              t.SalePrices = model.SalesPrice;
              }
             //Value to insert
              t.AddVariable("UPDATETYPE", "ITEMS");
              //t.AddVariable("CATALOG", ddlCats.SelectedValue);
              t.SKUS = sku;
              t.Sources = source;
              t.Titles = title;
              t.Prices = price;
              t.SalePrices = saleprice;
              t.Write();
        }