Exemple #1
0
 public ActionResult Save(SubCatagory subCatagory)
 {
     ViewBag.SubCatagoryList = subCatagoryManager.GetSubCatagoryList();
     ViewBag.ListOfCatagori  = catagoryManager.GetCatagoryList();
     ViewBag.Message         = subCatagoryManager.InsertSubCatagory(subCatagory);
     return(View());
 }
    // Use this for initialization
    void Start()
    {
        //topTitle.Text = categoryConstant.MainCategoryName;
        notFoundPanel.IsVisible = false;
        dfScrollPanel categoryPanel = GetComponent <dfScrollPanel> ();

        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "second_categories.php?parent_id=" + CategoryConstant.MainCategoryId)
        .OnReply((reply) => {
            SubCatagoryReply catReply = JsonConvert.DeserializeObject <SubCatagoryReply>(reply.DataAsString);
            if (catReply.success == 1)
            {
                foreach (SubCatagoryData data in catReply.data)
                {
                    SubCatagory instance = categoryPanel.AddPrefab(Prefab.gameObject).GetComponent <SubCatagory>();

                    //MainCatagory instance = Instantiate(Prefab) as MainCatagory;
                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                //	notFoundPanel.IsVisible = true;
                //	loaderPanel.IsVisible = false;

                CategoryConstant.SubCategoryId   = 0;
                CategoryConstant.GrandCategoryId = 0;
                SceneManager.LoadScene("TriviaGameSponsor");
            }
        })
        .Send();
    }
        public List <SubCatagory> BindSubCatagoryAccordingToSelectedMainCatagory(string selectedMainCatagoryID)
        {
            List <SubCatagory> subCatagoryListObj = new List <SubCatagory>();

            using (SqlConnection)
            {
                SqlCmd.CommandText = "select SubCatagoryID, SubCatagoryName from Table_SubCatagory where MainCatagoryID = '" + selectedMainCatagoryID + "'";
                SqlConnection.Open();
                SqlDataReader sqlDataReaderObj = SqlCmd.ExecuteReader();

                if (sqlDataReaderObj.HasRows)
                {
                    while (sqlDataReaderObj.Read())
                    {
                        SubCatagory subCatagoryObj = new SubCatagory();

                        subCatagoryObj.SubCatagoryID   = sqlDataReaderObj["SubCatagoryID"].ToString();
                        subCatagoryObj.SubCatagoryName = sqlDataReaderObj["SubCatagoryName"].ToString();

                        subCatagoryListObj.Add(subCatagoryObj);
                    }
                }
                sqlDataReaderObj.Close();
            }
            return(subCatagoryListObj);
        }
Exemple #4
0
        public override global::System.Data.DataSet Clone()
        {
            SubCatagory cln = ((SubCatagory)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public ActionResult DelSubCatagories(int id)
        {
            DemoContext _context = new DemoContext();
            SubCatagory sCat     = _context.SubCatagories.Where(x => x.ID.Equals(id)).FirstOrDefault();

            _context.SubCatagories.Remove(sCat);
            _context.SaveChanges();
            return(RedirectToAction("ShowAllSubCatagories"));
        }
        public int InsertSubCatagory(SubCatagory subCatagory)
        {
            Query = "INSERT INTO SubCatagory VALUES('" + subCatagory.SubCatagoryName + "'," + subCatagory.CatagoryId + ") ";
            Command.CommandText = Query;
            Connection.Open();
            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowAffected);
        }
Exemple #7
0
        public ActionResult Index(FormCollection data)
        {
            SubCatagory sCatagoryObj = new SubCatagory();

            sCatagoryObj.Name     = data["sbCName"];
            sCatagoryObj.Catagory = new Catagory {
                Id = Convert.ToInt32(data["CatagoryId"])
            };

            ViewBag.Catagory = new CatagoriesHandler().GetCatagories().ToSelectList();
            return(View());
        }
Exemple #8
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            SubCatagory ds = new SubCatagory();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Exemple #9
0
        public string InsertSubCatagory(SubCatagory subCatagory)
        {
            int rowAffected = subCatagoryGateway.InsertSubCatagory(subCatagory);

            if (rowAffected != 0)
            {
                return("Save Successfull,");
            }
            else
            {
                return("Sory! Save Fail.");
            }
        }
        public ActionResult EditSubCatagories(SubCatagory obj)
        {
            DemoContext _context = new DemoContext();
            SubCatagory sCat     = _context.SubCatagories.Where(x => x.ID.Equals(obj.ID)).FirstOrDefault();

            sCat.Name     = obj.Name;
            sCat.Catagory = new Catagory {
                ID = Convert.ToInt32(obj.Catagory.ID)
            };
            _context.Entry(sCat.Catagory).State = System.Data.Entity.EntityState.Unchanged;

            _context.SaveChanges();
            return(RedirectToAction("ShowAllSubCatagories"));
        }
 public ActionResult AddSubCatagory(FormCollection data)
 {
     using (DemoContext _Context = new DemoContext())
     {
         SubCatagory sCat = new SubCatagory();
         sCat.Name     = data["sCataName"];
         sCat.Catagory = new Catagory {
             ID = Convert.ToInt32(data["catagoryList"])
         };
         _Context.Entry(sCat.Catagory).State = System.Data.Entity.EntityState.Unchanged;
         _Context.SubCatagories.Add(sCat);
         _Context.SaveChanges();
         return(RedirectToAction("AddSubCatagory"));
     }
 }
Exemple #12
0
 private static void PopulateIncome(ref SubCatagory dtsSubCatagory)
 {
     if (!File.Exists(Model.ModelBusinessRules.GetSubCatagoryFileLocation()))
     {
         string subCatagoryFileLocation = Utils.PathUtils.FindXMLDialog(Model.ModelBusinessRules.SUBCATAGORYXMLBASE);
         Model.ModelBusinessRules.subCatagoryXMLFileName = subCatagoryFileLocation;
     }
     try
     {
         dtsSubCatagory.ReadXml(Model.ModelBusinessRules.GetSubCatagoryFileLocation());
     } catch (System.IO.DirectoryNotFoundException e)
     {
         MessageBox.Show("ERROR file not found: " + e.Message);
     }
     Controller.ConfigurationReader.WriteConfigurationFile();
 }
        public List <SubCatagory> GetSubCatagoryList()
        {
            List <SubCatagory> subCatagories = new List <SubCatagory>();

            Query = "SELECT * FROM SubCatagory";
            Command.CommandText = Query;
            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                SubCatagory subCatagory = new SubCatagory();
                subCatagory.Id = Convert.ToInt32(Reader["Id"]);
                subCatagory.SubCatagoryName = Reader["SubCatagoryName"].ToString();
                subCatagory.CatagoryId      = Convert.ToInt32(Reader["CatagoryId"]);
                subCatagories.Add(subCatagory);
            }

            Reader.Close();
            Connection.Close();
            return(subCatagories);
        }
Exemple #14
0
        private List <SubCatagory> ParseSubCatagory(string url)
        {
            List <SubCatagory> subCatagoryList = new List <SubCatagory>();

            #region [URL Scraping]
            //var getHtmlWeb1 = new HtmlWeb();
            //var doc1 = getHtmlWeb1.Load(url);
            //var doc1 = Cache.GetUrl(url);
            browser.Url = url;
            browser.Url = url;
            var doc1 = browser.GetWebRequest();
            #endregion

            HtmlNode node = doc1.DocumentNode.SelectSingleNode("//div[@class='categories']");
            node = node.SelectSingleNode("//ul[@class='subCategory toplvls']");

            var hoteleWebsiteDoc = (from element in node.Descendants("a")
                                    where element.ParentNode.Name.Equals("li") &&
                                    element.Attributes.Contains("href")
                                    select new
            {
                URL = element.Attributes["href"].Value,
                Desc = element.InnerText
            }).ToList();

            foreach (var obj in hoteleWebsiteDoc)
            {
                SubCatagory oSubCatagory = new SubCatagory();
                oSubCatagory.subCategoriesUrl   = "http://adiglobal.us" + obj.URL.Replace("amp;", "");;
                oSubCatagory.subCategoriesName  = RemoveHtmlCharacters(obj.Desc);
                oSubCatagory.subSubCatagoryList = ParseSubSubCatagory(oSubCatagory.subCategoriesUrl);
                subCatagoryList.Add(oSubCatagory);
            }

            return(subCatagoryList);
        }
Exemple #15
0
 internal static void GetData(ref SubCatagory dtsSubCatagory)
 {
     dtsSubCatagory.Clear();
     PopulateIncome(ref dtsSubCatagory);
 }
Exemple #16
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                SubCatagory ds = new SubCatagory();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "tttSubCatagoryDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Exemple #17
0
 internal static void SaveData(ref SubCatagory dtsSubCatagory)
 {
     Model.SubCatagoryFormModel.SaveData(dtsSubCatagory);
 }
Exemple #18
0
 internal static void SaveData(SubCatagory dtsSubCatagory)
 {
     Model.ModelBusinessRules.subCatagoryXMLFileName = DataUtils.BuildXMLFileName(Model.ModelBusinessRules.SUBCATAGORYXMLBASE);
     dtsSubCatagory.WriteXml(Model.ModelBusinessRules.GetSubCatagoryFileLocation());
     Controller.ConfigurationReader.WriteConfigurationFile();
 }
Exemple #19
0
 internal static void GetData(ref SubCatagory dtsSubCatagory)
 {
     Model.SubCatagoryFormModel.GetData(ref dtsSubCatagory);
 }