Beispiel #1
0
        public static string getusername()
        {
            String current = System.IO.Directory.GetCurrentDirectory();

            string fileName = current + "\\Connectstring.txt";
            //       const Int32 BufferSize = 128;

            //using (var fileStream = File.OpenRead(fileName))
            //using (var streamReader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize))
            //{
            string line;
            string st4;

            //while ((line = streamReader.ReadLine()) != null)

            //{

            Model.SercurityFucntion bm2 = new Model.SercurityFucntion();
            line = bm2.Readtextfromfile(fileName);
            string line2 = bm2.Decryption(line);


            string[] parts = line2.Split(';');
            if (parts.Count() >= 4)
            {
                st4 = parts[3].Trim();
            }
            else
            {
                st4 = "";
            }
            //       string st1 = parts[0].Trim();
            //       string st2 = parts[1].Trim();
            //  string st3 = parts[2].Trim();


            string username = st4;

            return(username);



            //  }

            //      return "";

            // }
        }
Beispiel #2
0
        public static string getConnectionstr()
        {
            String current = System.IO.Directory.GetCurrentDirectory();

            string fileName          = current + "\\Connectstring.txt";
            string connection_string = "";
            //      const Int32 BufferSize = 128;

            //using (var fileStream = File.OpenRead(fileName))
            //using (var streamReader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize))
            //{
            string line;

            //while ((line = streamReader.ReadLine()) != null)

            //{



            Model.SercurityFucntion bm2 = new Model.SercurityFucntion();
            line = bm2.Readtextfromfile(fileName);
            string line2 = bm2.Decryption(line);



            string[] parts = line2.Split(';');

            string st1 = parts[0].Trim();
            string st2 = parts[1].Trim();
            string st3 = parts[2].Trim();

            //        string st4 = parts[3].Trim();

            connection_string = ("Data Source =" + st1 + "; Initial Catalog = KAmanagement; User Id =" + st2 + "; Password ="******"";


            //}
        }