예제 #1
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            DbDto dbdto = new DbDto
            {
                DataSource     = cb_DataSource.Text,
                InitialCatalog = (string)cb_dblist.SelectedValue,
                UserID         = t_user.Text,
                Password       = t_pwd.Text
            };

            CrawlerPro.Common.XmlHelper.CreateConfig(dbdto);
            Visible = false;
            Invoke(new MethodInvoker(delegate() { load.Visible = false; }));
            new MainForm().Show();
        }
예제 #2
0
        public static void CreateConfig(DbDto dto)
        {
            XmlDocument    xmldoc = new XmlDocument();
            XmlDeclaration xmldecl;

            xmldecl = xmldoc.CreateXmlDeclaration("1.0", "utf-8", null);
            xmldoc.AppendChild(xmldecl);

            XmlElement xmlelem = xmldoc.CreateElement("", "configuration", "");

            xmldoc.AppendChild(xmlelem);

            XmlNode    root = xmldoc.SelectSingleNode("configuration");
            XmlElement xe1  = xmldoc.CreateElement("Setting");

            XmlElement xesub1 = xmldoc.CreateElement("DBConn");

            xesub1.SetAttribute("value", string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", dto.DataSource, dto.InitialCatalog, dto.UserID, dto.Password));
            xe1.AppendChild(xesub1);

            root.AppendChild(xe1);
            xmldoc.Save(AppDomain.CurrentDomain.BaseDirectory + "\\App.config");
        }
예제 #3
0
        public JsonResult GetField([FromBody] DbDto loadDbDto)
        {
            var res = _generateService.GetField(loadDbDto);

            return(Json(new { code = 0, msg = "success", count = res.Count, data = res }));
        }
예제 #4
0
 public ApiResult <List <string> > GetTable([FromBody] DbDto loadDbDto)
 {
     return(_generateService.GetTable(loadDbDto));
 }