Пример #1
16
        /// <summary>
        /// luu vao xml
        /// </summary>
        private void Save()
        {
            try
            {
                Common.Utilities com = new Common.Utilities();
                string links = Application.StartupPath + @"\Config.xml";
                com.DeleteFile(links);
                if (com.CheckFile(links) == false)
                {
                    Boolean trave = com.Save(txtServerName.Text, txtTenDangNhap.Text, txtMatKhau.Text, txtDatabaseName.Text);
                    if (trave)
                    {
                        loginOK();
                    }
                    else
                    { MessageBox.Show("Chưa lưu lại"); }
                }
                else
                {
                    loginOK();
                }
            }
            catch
            {

            }
        }
Пример #2
0
 /// <summary>
 /// luu vao xml
 /// </summary>
 private void Save()
 {
     try
     {
         Common.Utilities com   = new Common.Utilities();
         string           links = Application.StartupPath + @"\Config.xml";
         com.DeleteFile(links);
         if (com.CheckFile(links) == false)
         {
             Boolean trave = com.Save(txtServerName.Text, txtTenDangNhap.Text, txtMatKhau.Text, txtDatabaseName.Text);
             if (trave)
             {
                 loginOK();
             }
             else
             {
                 MessageBox.Show("Chưa lưu lại");
             }
         }
         else
         {
             loginOK();
         }
     }
     catch
     {
     }
 }
Пример #3
0
        private void frmSQL_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                if (i == 0)
                {
                    i = 1;

                    if (Luu.Server == "server")
                    {
                        Common.Constants.Sql data = new Common.Constants.Sql();
                        string           Links    = Application.StartupPath.ToString() + data.ConfigXML;
                        Common.Utilities com      = new Common.Utilities();
                        if (com.CheckFile(Links) == true)
                        {
                            Entities.SQL sql = new SQL();
                            sql = com.ConnectionsName();
                            _connectionString = "Data Source=" + sql.ServerName
                                                + ";User ID=" + sql.UserName
                                                + ";password="******";Initial Catalog=" + sql.DatabaseName;

                            if (CheckDatabase("SupermarketManagementDHT") == true)
                            {
                                if (!Luu.KFULL)
                                {
                                    loginOK();
                                }
                            }
                            else
                            {
                                SelectServerName();
                            }
                        }
                        else
                        {
                            SelectServerName();
                        }
                    }
                    else
                    {
                        if (Luu.Server == "client")
                        {
                            loginOK();
                        }
                        else
                        {
                            MessageBox.Show("Kiểm tra lại file xml");
                        }
                    }
                }
            }
            catch
            { }
        }
Пример #4
0
        private void frmSQL_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                if (i == 0)
                {
                    i = 1;

                    if (Luu.Server == "server")
                    {
                        Common.Constants.Sql data = new Common.Constants.Sql();
                        string Links = Application.StartupPath.ToString() + data.ConfigXML;
                        Common.Utilities com = new Common.Utilities();
                        if (com.CheckFile(Links) == true)
                        {
                            Entities.SQL sql = new SQL();
                            sql = com.ConnectionsName();
                            _connectionString = "Data Source=" + sql.ServerName
                                + ";User ID=" + sql.UserName
                                + ";password="******";Initial Catalog=" + sql.DatabaseName;

                            if (CheckDatabase("SupermarketManagementDHT") == true)
                            {
                                if (!Luu.KFULL)
                                {
                                    loginOK();
                                }
                            }
                            else
                            {
                                SelectServerName();
                            }
                        }
                        else
                        { SelectServerName(); }
                    }
                    else
                    {

                        if (Luu.Server == "client")
                        {
                            loginOK();
                        }
                        else
                        { MessageBox.Show("Kiểm tra lại file xml"); }

                    }
                }
            }
            catch
            { }
        }
Пример #5
0
 /// <summary>
 /// hungvv ================luu lai file xml config==================
 /// </summary>
 /// <param name="TenServer"></param>
 /// <param name="TenDangNhap"></param>
 /// <param name="MatKhau"></param>
 /// <param name="TenCoSoDuLieu"></param>
 /// <returns></returns>
 public Boolean Save(string TenServer, string TenDangNhap, string MatKhau, string TenCoSoDuLieu)
 {
     Boolean check = false;
     try
     {
         Common.Utilities com = new Common.Utilities();
         string Links = Application.StartupPath.ToString() + @"\Config.xml";
         if (com.CheckFile(Links) == false)
         {
             XmlTextWriter txtwrite = new XmlTextWriter(Links, null);
             txtwrite.WriteStartDocument();
             txtwrite.WriteStartElement(constants.Connect);
             txtwrite.WriteElementString(constants.DataSource, MaHoa(constants.KeywordConfigXML, TenServer));
             txtwrite.WriteElementString(constants.UserID, MaHoa(constants.KeywordConfigXML, TenDangNhap));
             txtwrite.WriteElementString(constants.Password, MaHoa(constants.KeywordConfigXML, MatKhau));
             txtwrite.WriteElementString(constants.InitialCatalog, MaHoa(constants.KeywordConfigXML, TenCoSoDuLieu));
             txtwrite.WriteEndElement();
             txtwrite.WriteEndDocument();
             txtwrite.Close();
             check = true;
         }
         else
         {
             check = false;
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); check = false; }
     return check;
 }