Exemplo n.º 1
0
        private void AdminSaleOrder_Load(object sender, EventArgs e)
        {
            int region = new ConfigJson().SubsidiaryCompaniesRegion();

            listEmp.DataSource = db.Employees.Where(s => (s.User_access.type == "продавец" &&
                                                          s.id_subsidiary_companies_region == region)
                                                    ).Select(s => new { id = s.User_access.id, fio = s.first_name + " " + s.middle_name + " " + s.last_name }).ToList();
            listEmp.DisplayMember = "fio";
            listEmp.ValueMember   = "id";

            listGoods.DataSource    = db.Goods.Select(g => new { id = g.id, title = g.Goods_category.title + " / " + g.title }).ToList();
            listGoods.DisplayMember = "title";
            listGoods.ValueMember   = "id";


            if (interval.Checked)
            {
                end.Enabled = true;
            }
            if (allEmp.Checked)
            {
                listEmp.Enabled = false;
            }
            if (allGoods.Checked)
            {
                listGoods.Enabled = false;
            }
        }
Exemplo n.º 2
0
        public string StringConnecting()
        {
            ConfigJson res = (new ConfigJson()).jsonRead();

            this.server   = res.server;
            this.user     = res.user;
            this.password = res.password;
            this.db       = res.db;
            string strConnect = @"data source=" + this.server + ";initial catalog=" + this.db + ";user id=" + this.user + ";password="******"; MultipleActiveResultSets=True;App=EntityFramework";

            return(strConnect);
        }
Exemplo n.º 3
0
        private void Configuration_Load(object sender, EventArgs e)
        {
            ConfigJson res = (new ConfigJson()).jsonRead();

            if (res != null)
            {
                server.Text   = res.server;
                user.Text     = res.user;
                password.Text = res.password;
                db.Text       = res.db;
            }
        }
Exemplo n.º 4
0
        public ConfigJson jsonRead()
        {
            // path = Application.StartupPath + "\\" + path;

            if (File.Exists(path))
            {
                DataContractJsonSerializer jsonFormatter = new DataContractJsonSerializer(typeof(ConfigJson));

                using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
                {
                    ConfigJson config = (ConfigJson)jsonFormatter.ReadObject(fs);
                    return(config);
                }
            }
            else
            {
                return(null);
            }
        }