Пример #1
0
        void getCnnStr()
        {
#if DEBUG
            m_db = ConfigMng.CfgRead("zDb") as string;
#else
            m_db = ConfigMng.FindTmpl("PTXX_NB.accdb");
#endif
            if (m_db != null)
            {
                var cnnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<zDb>;";
                m_cnnStr = cnnStr.Replace("<zDb>", m_db);
            }
            else
            {
                OpenDbDlg();
                #if DEBUG
                ConfigMng.CfgWrite("zDb", m_db);
                #endif
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Dictionary <string, MyUser> userD;
            var content = new lOleDbContentProvider();

            ConfigMng.CfgRead("zDb");
            var zDb    = ConfigMng.CfgRead("zDb") as string;
            var cnnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<zDb>;";

            content.initCnn(cnnStr.Replace("<zDb>", zDb));
            var userLst = content.GetAllUsers();

            userD = new Dictionary <string, MyUser>();
            foreach (MyUser tuser in userLst)
            {
                userD.Add(tuser.zFb, tuser);
            }

            var arr = optTxt.Lines;
            int s   = 0;

            for (int i = 0; i < arr.Length; i++)
            {
                string line = arr[i];
                switch (s)
                {
                case 0:
                    if (userD.ContainsKey(line))
                    {
                        s = 1;
                    }
                    else
                    {
                        s = -1;
                    }
                    break;
                }
            }
        }