コード例 #1
0
ファイル: AddingForm.cs プロジェクト: Pandanom/DB
        public AddingForm()
        {
            InitializeComponent();
            DataContext db = new DataContext(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            msr = new ManagerSqlRepository(db);
            Reset();

            //  ManagersLB.DataSource = db.GetTable<>
        }
コード例 #2
0
ファイル: CustomersForm.cs プロジェクト: Pandanom/DB
        public CustomersForm()
        {
            InitializeComponent();

            connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            checkColls       = new List <CheckBox>();

            db       = new DataContext(connectionString);
            mnr      = new ManagerSqlRepository(db);
            managers = mnr.GetList().ToList();
            List <string> logins = new List <string>();

            foreach (var m in managers)
            {
                logins.Add(m.login);
            }
            LoginBox.DataSource = logins;

            bool waterMarkActive = true;

            PassWBox.ForeColor = Color.Gray;
            PassWBox.GotFocus += (s, e) =>
            {
                if (waterMarkActive)
                {
                    waterMarkActive    = false;
                    PassWBox.Text      = "";
                    PassWBox.ForeColor = Color.Black;
                }
            };



            LoginBox.SelectedIndexChanged += (s, e) =>
            {
                checkTry();
            };



            int x = 30;

            foreach (var c in coll)
            {
                CheckBox cb = new CheckBox();
                cb.Text     = c;
                cb.Location = new Point(x, 25);
                x          += cb.Size.Width;
                cb.Checked  = true;

                cb.Visible = false;
                checkColls.Add(cb);
                this.Controls.Add(cb);
                cb.CheckedChanged += (s, e) => {
                    CustTable.Columns.Clear();
                    ShowDb();
                };
            }

            ShowDb();
        }