Esempio n. 1
0
    void initiLocal()
    {
        GetXML gxml = new GetXML();

        gxml.Run();
        sy_Mark.table_name       = gxml.tableGroup.ToArray();
        sy_Mark.field_name       = gxml.fieldGroup.ToArray();
        sy_Mark.field_contents   = gxml.fieldContents;
        sy_Mark.coordinate       = gxml.markCoordinate;
        sy_CurrentStatus.isReady = true;
    }
Esempio n. 2
0
        public JsonResult XML(string file)
        {
            int           count    = 0;
            int           final    = 0;
            String        conexion = "data source=195.192.2.249;initial catalog=Medinet 20170721;user id=sa;password=t0m$0nl@t1n@";
            SqlConnection cnn      = new SqlConnection(conexion);

            cnn.Open();
            try
            {
                List <GetXML> GetXML_Result = new List <GetXML>();

                String     consulta = "select * from FXML where XMLContent is not null";
                SqlCommand cmd      = new SqlCommand(consulta, cnn);


                SqlDataReader read  = cmd.ExecuteReader();
                String        PathP = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString();


                if (read.HasRows == true)
                {
                    while (read.Read())
                    {
                        GetXML GetXML = new GetXML();
                        GetXML.NameXML    = read.GetValue(9).ToString();
                        GetXML.XMLContent = read.GetValue(10).ToString();
                        GetXML_Result.Add(GetXML);
                        var root = Path.Combine(PathP, "XML");


                        GetXML.NameXML = ReplaceContent(GetXML.NameXML);

                        if (System.IO.File.Exists(root + @"\" + GetXML.NameXML))
                        {
                            GetXML.NameXML = GetXML.NameXML + "_1";
                        }


                        StreamWriter SW;
                        SW = System.IO.File.CreateText(root + @"\" + GetXML.NameXML);

                        root = Path.Combine(root, GetXML.NameXML);
                        SW.Write(GetXML.XMLContent);
                        SW.Close();
                        SW.Dispose();
                        count = count + 1;
                    }
                }

                else
                {
                    string men = "No hay datos";
                }
                //return View(GetClient_Result);

                final = count;
                return(Json(true, JsonRequestBehavior.AllowGet));
            }

            catch (Exception e)
            {
                string message = e.Message;
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }