예제 #1
0
        private void buttonAddNew_Click(object sender, EventArgs e)
        {
            this.context.Dispose();
            this.context = new ArtflexDbContext();

            this.context.waybills.Load();
            BindingList<waybills> _waybills = context.waybills.Local.ToBindingList();
            this.waybillsBindingSource.DataSource = _waybills;

            this.waybillsBindingSource.AddNew();
            this.waybillsBindingSource.MoveLast();

            waybills waybillsObj = waybillsBindingSource.Current as waybills;
            this.context.supplies.Where<supplies>(s => s.waybill_id == waybillsObj.waybill_id).Load();
            BindingList<supplies> _supplies = context.supplies.Local.ToBindingList();
            this.suppliesBindingSource.DataSource = _supplies;

            this.context.categories.Load();
            BindingList<categories> _categories = context.categories.Local.ToBindingList();
            this.categoriesBindingSource.DataSource = _categories;

            this.context.materials.Where<materials>(b => b.category_id == 1).Load();
            BindingList<materials> _materials = context.materials.Local.ToBindingList();
            this.materialsBindingSource.DataSource = _materials;
        }
예제 #2
0
 private void frmjob_titles_Load(object sender, EventArgs e)
 {
     context = new ArtflexDbContext();
     context.job_titles.Load();
     BindingList<job_titles> _entities = context.job_titles.Local.ToBindingList();
     job_titlesBindingSource.DataSource = _entities;
     this.jobtitle_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.job_titlesBindingSource, "jobtitle_id", true ));
     this.jobtitle_nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.job_titlesBindingSource, "jobtitle_name", true ));
     this.jobtitle_descriptTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.job_titlesBindingSource, "jobtitle_descript", true ));
 }
예제 #3
0
 private void frmrests_Load(object sender, EventArgs e)
 {
     context = new ArtflexDbContext();
     context.rests.Load();
     BindingList<rests> _entities = context.rests.Local.ToBindingList();
     restsBindingSource.DataSource = _entities;
     this.rest_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.restsBindingSource, "rest_id", true ));
     this.supply_id_comboBox.DataSource = context.supplies.ToList();
     this.supply_id_comboBox.DisplayMember = "supply_id";
     this.supply_id_comboBox.ValueMember = "supply_id";
     this.supply_id_comboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.restsBindingSource, "supply_id", true));
     this.material_id_comboBox.DataSource = context.materials.ToList();
     this.material_id_comboBox.DisplayMember = "material_id";
     this.material_id_comboBox.ValueMember = "material_id";
     this.material_id_comboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.restsBindingSource, "material_id", true));
     this.rest_quantityTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.restsBindingSource, "rest_quantity", true ));
     this.rest_summTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.restsBindingSource, "rest_summ", true ));
     this.rest_date_dateTimePicker.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.restsBindingSource, "rest_date", true ));
     this.rest_createtimeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.restsBindingSource, "rest_createtime", true ));
 }
예제 #4
0
        private void supplierComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            suppliers _supplierObj = supplierComboBox.SelectedItem as suppliers;
            if (_supplierObj == null)
               this.supplier = -1;

            this.context.Dispose();
            this.context = new ArtflexDbContext();
            this.context.waybills.Where<waybills>(w => w.supplier_id == _supplierObj.supplier_id).Load();
            BindingList<waybills> _waybills = this.context.waybills.Local.ToBindingList();
            waybillsBindingSource.DataSource = _waybills;
            dataGridViewWaybills.Refresh();
        }
예제 #5
0
        private void frmwaybills_Load(object sender, EventArgs e)
        {
            supplier = -1;
            context = new ArtflexDbContext();
            context.waybills.Where(s => s.supplier_id == supplier).Load();
            BindingList<waybills> _entities = context.waybills.Local.ToBindingList();
            waybillsBindingSource.CurrentChanged += waybillsBindingSource_CurrentChanged;
            waybillsBindingSource.DataSource = _entities;

            System.Windows.Forms.DataGridViewTextBoxColumn col_waybill_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_waybill_id.DataPropertyName = "waybill_id";
            col_waybill_id.HeaderText = "ID";
            col_waybill_id.Name = "col_waybill_id";
            dataGridViewWaybills.Columns.Add(col_waybill_id);

            System.Windows.Forms.DataGridViewTextBoxColumn col_waybill_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_waybill_name.DataPropertyName = "waybill_name";
            col_waybill_name.HeaderText = "Накладная";
            col_waybill_name.Name = "col_waybill_name";
            dataGridViewWaybills.Columns.Add(col_waybill_name);

            System.Windows.Forms.DataGridViewComboBoxColumn col_supplier_name = new System.Windows.Forms.DataGridViewComboBoxColumn();
            col_supplier_name.DataSource = context.suppliers.ToList();
            col_supplier_name.DataPropertyName = "supplier_id";
            col_supplier_name.DisplayMember = "supplier_name";
            col_supplier_name.ValueMember = "supplier_id";
            col_supplier_name.HeaderText = "Поставщик";
            col_supplier_name.Name = "col_supplier_id";
            col_supplier_name.ToolTipText = "Pick the column from the foreign table to use as friendly value for this lookup.";
            col_supplier_name.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            dataGridViewWaybills.Columns.Add(col_supplier_name);

            System.Windows.Forms.DataGridViewTextBoxColumn col_waybill_date = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_waybill_date.DataPropertyName = "waybill_date";
            col_waybill_date.HeaderText = "Дата поставки";
            col_waybill_date.Name = "col_waybill_date";
            dataGridViewWaybills.Columns.Add(col_waybill_date);

            this.dataGridViewWaybills.AutoGenerateColumns = false;
            this.dataGridViewWaybills.DataSource = this.waybillsBindingSource;

            // dataGridViewSupplies
            System.Windows.Forms.DataGridViewTextBoxColumn colsupply_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colsupply_id.DataPropertyName = "supply_id";
            colsupply_id.HeaderText = "supply_id";
            colsupply_id.Name = "colsupply_id";
            dataGridViewSupplies.Columns.Add(colsupply_id);

            System.Windows.Forms.DataGridViewTextBoxColumn colsupply_quantity = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colsupply_quantity.DataPropertyName = "supply_quantity";
            colsupply_quantity.HeaderText = "supply_quantity";
            colsupply_quantity.Name = "colsupply_quantity";
            dataGridViewSupplies.Columns.Add(colsupply_quantity);

            System.Windows.Forms.DataGridViewComboBoxColumn colmaterial_id = new System.Windows.Forms.DataGridViewComboBoxColumn();
            colmaterial_id.DataSource = context.materials.ToList();
            colmaterial_id.DataPropertyName = "material_id";
            colmaterial_id.DisplayMember = "material_name";
            colmaterial_id.ValueMember = "material_id";
            colmaterial_id.HeaderText = "material_id";
            colmaterial_id.Name = "colmaterial_id";
            colmaterial_id.ToolTipText = "Pick the column from the foreign table to use as friendly value for this lookup.";
            colmaterial_id.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            dataGridViewSupplies.Columns.Add(colmaterial_id);

            System.Windows.Forms.DataGridViewTextBoxColumn colsupply_summ = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colsupply_summ.DataPropertyName = "supply_summ";
            colsupply_summ.HeaderText = "supply_summ";
            colsupply_summ.Name = "colsupply_summ";
            dataGridViewSupplies.Columns.Add(colsupply_summ);

            System.Windows.Forms.DataGridViewTextBoxColumn colsupply_costunit = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colsupply_costunit.DataPropertyName = "supply_costunit";
            colsupply_costunit.HeaderText = "supply_costunit";
            colsupply_costunit.Name = "colsupply_costunit";
            dataGridViewSupplies.Columns.Add(colsupply_costunit);

            System.Windows.Forms.DataGridViewTextBoxColumn colsupply_description = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colsupply_description.DataPropertyName = "supply_description";
            colsupply_description.HeaderText = "supply_description";
            colsupply_description.Name = "colsupply_description";
            dataGridViewSupplies.Columns.Add(colsupply_description);

            System.Windows.Forms.DataGridViewComboBoxColumn colwaybill_id = new System.Windows.Forms.DataGridViewComboBoxColumn();
            colwaybill_id.DataSource = context.waybills.ToList();
            colwaybill_id.DataPropertyName = "waybill_id";
            colwaybill_id.DisplayMember = "waybill_name";
            colwaybill_id.ValueMember = "waybill_id";
            colwaybill_id.HeaderText = "waybill_id";
            colwaybill_id.Name = "colwaybill_id";
            colwaybill_id.ToolTipText = "Pick the column from the foreign table to use as friendly value for this lookup.";
            colwaybill_id.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            dataGridViewSupplies.Columns.Add(colwaybill_id);

            System.Windows.Forms.DataGridViewTextBoxColumn colsupply_createtime = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colsupply_createtime.DataPropertyName = "supply_createtime";
            colsupply_createtime.HeaderText = "supply_createtime";
            colsupply_createtime.Name = "colsupply_createtime";
            colsupply_createtime.ReadOnly = true;
            colsupply_createtime.DefaultCellStyle.BackColor = Color.LightGray;
            dataGridViewSupplies.Columns.Add(colsupply_createtime);

            suppliesBindingSource.DataSource = waybillsBindingSource;
            suppliesBindingSource.DataMember = "supplies";
            dataGridViewSupplies.AutoGenerateColumns = false;

            dataGridViewSupplies.DataSource = suppliesBindingSource;

            // Supplier selector
            this.supplierComboBox.DataSource = context.suppliers.ToList();
            this.supplierComboBox.DisplayMember = "supplier_name";
            this.supplierComboBox.ValueMember = "supplier_id";
        }
예제 #6
0
        private void frmsupply_Load(object sender, EventArgs e)
        {
            this.context = new ArtflexDbContext();
            //context.Configuration.ProxyCreationEnabled = false;

            this.context.waybills.Load();
            BindingList<waybills> _waybills = context.waybills.Local.ToBindingList();
            this.waybillsBindingSource.DataSource = _waybills;

            this.waybillsBindingSource.AddNew();
            this.waybillsBindingSource.MoveLast();

            waybills waybillsObj = waybillsBindingSource.Current as waybills;
            this.context.supplies.Where<supplies>(s => s.waybill_id == waybillsObj.waybill_id).Load();
            BindingList<supplies> _supplies = context.supplies.Local.ToBindingList();
            this.suppliesBindingSource.DataSource = _supplies;

            this.context.categories.Load();
            BindingList<categories> _categories = context.categories.Local.ToBindingList();
            this.categoriesBindingSource.DataSource = _categories;

            this.context.materials.Where<materials>(b => b.category_id == 1).Load();
            BindingList<materials> _materials = context.materials.Local.ToBindingList();
            this.materialsBindingSource.DataSource = _materials;

            this.waybill_nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.waybillsBindingSource, "waybill_name", true));
            this.waybill_date_dateTimePicker.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.waybillsBindingSource, "waybill_date", true));

            // Supplier selector
            this.supplierComboBox.DataSource = context.suppliers.ToList();
            this.supplierComboBox.DisplayMember = "supplier_name";
            this.supplierComboBox.ValueMember = "supplier_id";

            // Categories selector
            this.categoriesComboBox.DataSource = categoriesBindingSource;
            this.categoriesComboBox.DisplayMember = "category_name";
            this.categoriesComboBox.ValueMember = "category_id";

            #region dataGridViewSupplies Columns
            // dataGridViewSupplies Columns
            System.Windows.Forms.DataGridViewTextBoxColumn col_supply_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_supply_id.DataPropertyName = "supply_id";
            col_supply_id.HeaderText = "ID";
            col_supply_id.Name = "col_supply_id";
            col_supply_id.ReadOnly = true;
            this.dataGridViewSupplies.Columns.Add(col_supply_id);

            System.Windows.Forms.DataGridViewComboBoxColumn col_material = new System.Windows.Forms.DataGridViewComboBoxColumn();
            col_material.DataSource = context.materials.ToList();
            col_material.DataPropertyName = "material_id";
            col_material.DisplayMember = "material_name";
            col_material.ValueMember = "material_id";
            col_material.HeaderText = "Материал";
            col_material.Name = "col_material";
            col_material.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            col_material.ReadOnly = true;
            this.dataGridViewSupplies.Columns.Add(col_material);

            System.Windows.Forms.DataGridViewTextBoxColumn col_supply_quantity = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_supply_quantity.DataPropertyName = "supply_quantity";
            col_supply_quantity.HeaderText = "Кличество";
            col_supply_quantity.Name = "col_supply_quantity";
            col_supply_quantity.ReadOnly = false;
            this.dataGridViewSupplies.Columns.Add(col_supply_quantity);

            System.Windows.Forms.DataGridViewTextBoxColumn col_supply_summ = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_supply_summ.Name = "col_supply_summ";
            col_supply_summ.HeaderText = "Сумма";
            col_supply_summ.DataPropertyName = "supply_summ";
            this.dataGridViewSupplies.Columns.Add(col_supply_summ);

            System.Windows.Forms.DataGridViewTextBoxColumn col_supply_costunit = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_supply_costunit.Name = "col_supply_costunit";
            col_supply_costunit.HeaderText = "Цена за единицу";
            col_supply_costunit.DataPropertyName = "supply_costunit";
            this.dataGridViewSupplies.Columns.Add(col_supply_costunit);

            System.Windows.Forms.DataGridViewTextBoxColumn col_supply_description = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_supply_description.Name = "col_supply_description";
            col_supply_description.HeaderText = "Описание";
            col_supply_description.DataPropertyName = "supply_description";
            col_supply_description.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.dataGridViewSupplies.Columns.Add(col_supply_description);
            #endregion

            this.dataGridViewSupplies.AutoGenerateColumns = false;
            this.dataGridViewSupplies.DataSource = this.suppliesBindingSource;

            #region dataGridViewMaterials Columns
            // dataGridViewMaterials Columns
            System.Windows.Forms.DataGridViewTextBoxColumn col_material_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_id.DataPropertyName = "material_id";
            col_material_id.HeaderText = "ID";
            col_material_id.Name = "col_material_id";
            this.dataGridViewMaterials.Columns.Add(col_material_id);

            System.Windows.Forms.DataGridViewComboBoxColumn col_category_id = new System.Windows.Forms.DataGridViewComboBoxColumn();
            col_category_id.DataSource = context.categories.ToList();
            col_category_id.DataPropertyName = "category_id";
            col_category_id.DisplayMember = "category_name";
            col_category_id.ValueMember = "category_id";
            col_category_id.HeaderText = "Тип";
            col_category_id.Name = "col_category_id";
            col_category_id.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            this.dataGridViewMaterials.Columns.Add(col_category_id);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_name.DataPropertyName = "material_name";
            col_material_name.HeaderText = "Название материала";
            col_material_name.Name = "col_material_name";
            this.dataGridViewMaterials.Columns.Add(col_material_name);

            System.Windows.Forms.DataGridViewComboBoxColumn col_units_id = new DataGridViewComboBoxColumn();
            col_units_id.DataSource = context.units.ToList();
            col_units_id.DataPropertyName = "unit_id";
            col_units_id.DisplayMember = "unit_shortname";
            col_units_id.ValueMember = "unit_id";
            col_units_id.HeaderText = "Ед. изм.";
            col_units_id.Name = "col_units_id";
            col_units_id.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            this.dataGridViewMaterials.Columns.Add(col_units_id);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_size = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_size.Name = "col_material_size";
            col_material_size.HeaderText = "Размер";
            col_material_size.DataPropertyName = "material_size";
            this.dataGridViewMaterials.Columns.Add(col_material_size);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_rollwidth = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_rollwidth.DataPropertyName = "material_rollwidth";
            col_material_rollwidth.HeaderText = "Ширина рулона";
            col_material_rollwidth.Name = "col_material_rollwidth";
            this.dataGridViewMaterials.Columns.Add(col_material_rollwidth);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_createtime = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_createtime.Name = "col_material_createtime";
            col_material_createtime.HeaderText = "Дата добавления";
            col_material_createtime.DataPropertyName = "material_createtime";
            col_material_createtime.ReadOnly = true;
            this.dataGridViewMaterials.Columns.Add(col_material_createtime);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_description = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_description.Name = "col_material_description";
            col_material_description.HeaderText = "Описание";
            col_material_description.DataPropertyName = "material_description";
            col_material_description.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.dataGridViewMaterials.Columns.Add(col_material_description);
            #endregion

            this.dataGridViewMaterials.AutoGenerateColumns = false;
            this.dataGridViewMaterials.DataSource = this.materialsBindingSource;

            // DoubleBuffered
            SetDoubleBuffered(dataGridViewSupplies, true);
            SetDoubleBuffered(dataGridViewMaterials, true);

            this.buttonCancel.CausesValidation = false;

            this.waybill_date_dateTimePicker.Value = DateTime.Now;
        }
예제 #7
0
 private void frmorders_Load(object sender, EventArgs e)
 {
     context = new ArtflexDbContext();
     context.orders.Load();
     BindingList<orders> _entities = context.orders.Local.ToBindingList();
     ordersBindingSource.DataSource = _entities;
     this.order_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.ordersBindingSource, "order_id", true ));
     this.client_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.ordersBindingSource, "client_id", true ));
     this.order_statusTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.ordersBindingSource, "order_status", true ));
     this.employee_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.ordersBindingSource, "employee_id", true ));
     this.order_createtimeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.ordersBindingSource, "order_createtime", true ));
 }
예제 #8
0
        private void Save_Click(object sender, EventArgs e)
        {
            foreach (Control control in this.splitContainer1.Panel1.Controls)
            {
                control.Focus();
                if (!Validate()) { return; }
            }

            using (var _context = new ArtflexDbContext())
            {
                var zeroIdObj = clientsBindingSource.OfType<clients>().ToList().Find(f => f.client_id == 0);
                var obj = _context.clients.ToList().Find(b => b.client_name == this.client_nameTextBox.Text);
                if (obj != null && zeroIdObj != null)
                {
                    errorProvider1.SetError(client_nameTextBox, "Такое имя клиента уже существует");
                    return;
                }
                errorProvider1.SetError(client_nameTextBox, "");
            }

            clientsBindingSource.EndEdit();
            context.SaveChanges();
            this.buttonAddNew.Enabled = true;
            this.dataGridViewClients.Refresh();
        }
예제 #9
0
        private void frmclients_Load(object sender, EventArgs e)
        {
            context = new ArtflexDbContext();
            context.clients.Load();
            BindingList<clients> _entities = context.clients.Local.ToBindingList();
            clientsBindingSource.DataSource = _entities;
            this.client_nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_name", true ));
            this.client_emailTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_email", true ));
            this.client_wphoneTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_wphone", true ));
            this.client_faxTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_fax", true ));
            this.client_skipeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_skipe", true ));
            this.client_addressTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_address", true ));
            this.client_descriptionTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientsBindingSource, "client_description", true ));

            // DataGridView Collumns
            System.Windows.Forms.DataGridViewTextBoxColumn col_client_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_id.DataPropertyName = "client_id";
            col_client_id.HeaderText = "ID";
            col_client_id.Name = "col_material_id";
            dataGridViewClients.Columns.Add(col_client_id);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_name.DataPropertyName = "client_name";
            col_client_name.HeaderText = "Имя";
            col_client_name.Name = "col_client_name";
            dataGridViewClients.Columns.Add(col_client_name);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_email = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_email.DataPropertyName = "client_email";
            col_client_email.HeaderText = "e-mail";
            col_client_email.Name = "col_client_email";
            dataGridViewClients.Columns.Add(col_client_email);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_wphone = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_wphone.DataPropertyName = "client_wphone";
            col_client_wphone.HeaderText = "Телефон";
            col_client_wphone.Name = "col_client_wphone";
            dataGridViewClients.Columns.Add(col_client_wphone);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_fax = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_fax.DataPropertyName = "client_fax";
            col_client_fax.HeaderText = "Факс";
            col_client_fax.Name = "col_client_fax";
            dataGridViewClients.Columns.Add(col_client_fax);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_skipe = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_skipe.DataPropertyName = "client_skipe";
            col_client_skipe.HeaderText = "Скайп";
            col_client_skipe.Name = "col_client_skipe";
            dataGridViewClients.Columns.Add(col_client_skipe);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_address = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_address.DataPropertyName = "client_address";
            col_client_address.HeaderText = "Адрес";
            col_client_address.Name = "col_client_address";
            dataGridViewClients.Columns.Add(col_client_address);

            System.Windows.Forms.DataGridViewTextBoxColumn col_client_description = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_client_description.DataPropertyName = "client_description";
            col_client_description.HeaderText = "Описание";
            col_client_description.Name = "col_client_description";
            dataGridViewClients.Columns.Add(col_client_description);

            this.dataGridViewClients.AutoGenerateColumns = false;
            this.dataGridViewClients.DataSource = this.clientsBindingSource;

            SetDoubleBuffered(dataGridViewClients, true);

            this.splitContainer1.SplitterDistance = 120;

            this.buttonCancel.CausesValidation = false;
        }
예제 #10
0
 private void frmemployees_Load(object sender, EventArgs e)
 {
     context = new ArtflexDbContext();
     context.employees.Load();
     BindingList<employees> _entities = context.employees.Local.ToBindingList();
     employeesBindingSource.DataSource = _entities;
     this.employee_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_id", true ));
     this.employee_loginTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_login", true ));
     this.employee_passwordTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_password", true ));
     this.employee_nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_name", true ));
     this.employee_surnameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_surname", true ));
     this.employee_emailTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_email", true ));
     this.employee_displaynameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_displayname", true ));
     this.employee_phoneTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_phone", true ));
     this.employee_mphoneTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_mphone", true ));
     this.employee_wphoneTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_wphone", true ));
     this.employee_faxTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_fax", true ));
     this.employee_skypeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_skype", true ));
     this.employee_hphoneTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_hphone", true ));
     this.employee_addressTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_address", true ));
     this.employee_descriptionTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeesBindingSource, "employee_description", true ));
     this.jobtitle_id_comboBox.DataSource = context.job_titles.ToList();
     this.jobtitle_id_comboBox.DisplayMember = "jobtitle_id";
     this.jobtitle_id_comboBox.ValueMember = "jobtitle_id";
     this.jobtitle_id_comboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.employeesBindingSource, "jobtitle_id", true));
 }
예제 #11
0
        private void categoriesComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.buttonCancel.PerformClick();

            categories category = categoriesComboBox.SelectedItem as categories;

            if (category == null)
                return;
            this.context.Dispose();
            this.context = new ArtflexDbContext();
            this.context.materials.Where<materials>(b => b.category_id == category.category_id).Load();
            BindingList<materials> _materials = this.context.materials.Local.ToBindingList();
            materialsBindingSource.DataSource = _materials;
            dataGridViewMaterials.Refresh();
        }
예제 #12
0
        private void Save_Click(object sender, EventArgs e)
        {
            foreach (Control control in this.splitContainer1.Panel1.Controls)
            {
                control.Focus();
                if (!Validate()) { return; }
            }

            using (var _context = new ArtflexDbContext())
            {
                char[] charsToTrim = { '*', ' ', '\'' };
                var zeroIdObj = materialsBindingSource.OfType<materials>().ToList().Find(f => f.material_id == 0);
                var obj = _context.materials.ToList().Find(b => b.material_name.ToLower().Trim(charsToTrim) == this.material_nameTextBox.Text.ToLower().Trim(charsToTrim));

                if (obj != null && zeroIdObj != null)
                {

                    errorProvider1.SetError(material_nameTextBox, "Такое имя материала уже существует");
                    return;
                }
                errorProvider1.SetError(material_nameTextBox, "");
            }

            materialsBindingSource.EndEdit();
            this.context.SaveChanges();
            this.buttonAddNew.Enabled = true;
            this.dataGridViewMaterials.Refresh();
        }
예제 #13
0
        private void frmmaterials_Load(object sender, EventArgs e)
        {
            context = new ArtflexDbContext();
            //context.Configuration.ProxyCreationEnabled = false;
            context.materials.Where<materials>(b => b.category_id == 1).Load();
            BindingList<materials> _materials = context.materials.Local.ToBindingList();
            materialsBindingSource.DataSource = _materials;

            context.categories.Load();
            BindingList<categories> _categories = context.categories.Local.ToBindingList();
            categoriesBindingSource.DataSource = _categories;

            this.material_nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.materialsBindingSource, "material_name", true));
            this.material_sizeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.materialsBindingSource, "material_size", true));
            this.material_rollwidthTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.materialsBindingSource, "material_rollwidth", true));
            this.material_descriptionTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.materialsBindingSource, "material_description", true));
            this.material_createtimeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.materialsBindingSource, "material_createtime", true));

            // Units selector
            this.material_UnitsComboBox.DataSource = context.units.ToList();
            this.material_UnitsComboBox.DisplayMember = "unit_shortname";
            this.material_UnitsComboBox.ValueMember = "unit_id";
            this.material_UnitsComboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.materialsBindingSource, "unit_id"));

            // Categories selector
            this.categoriesComboBox.DataSource = context.categories.ToList();
            this.categoriesComboBox.DisplayMember = "category_name";
            this.categoriesComboBox.ValueMember = "category_id";

            // DataGridView Collumns
            System.Windows.Forms.DataGridViewTextBoxColumn col_material_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_id.DataPropertyName = "material_id";
            col_material_id.HeaderText = "ID";
            col_material_id.Name = "col_material_id";
            dataGridViewMaterials.Columns.Add(col_material_id);

            System.Windows.Forms.DataGridViewComboBoxColumn col_category_id = new System.Windows.Forms.DataGridViewComboBoxColumn();
            col_category_id.DataSource = context.categories.ToList();
            col_category_id.DataPropertyName = "category_id";
            col_category_id.DisplayMember = "category_name";
            col_category_id.ValueMember = "category_id";
            col_category_id.HeaderText = "Тип";
            col_category_id.Name = "col_category_id";
            col_category_id.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            dataGridViewMaterials.Columns.Add(col_category_id);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_name.DataPropertyName = "material_name";
            col_material_name.HeaderText = "Название материала";
            col_material_name.Name = "col_material_name";
            dataGridViewMaterials.Columns.Add(col_material_name);

            System.Windows.Forms.DataGridViewComboBoxColumn col_units_id = new DataGridViewComboBoxColumn();
            col_units_id.DataSource = context.units.ToList();
            col_units_id.DataPropertyName = "unit_id";
            col_units_id.DisplayMember = "unit_shortname";
            col_units_id.ValueMember = "unit_id";
            col_units_id.HeaderText = "Ед. изм.";
            col_units_id.Name = "col_units_id";
            col_units_id.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
            dataGridViewMaterials.Columns.Add(col_units_id);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_size = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_size.Name = "col_material_size";
            col_material_size.HeaderText = "Размер";
            col_material_size.DataPropertyName = "material_size";
            dataGridViewMaterials.Columns.Add(col_material_size);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_rollwidth = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_rollwidth.DataPropertyName = "material_rollwidth";
            col_material_rollwidth.HeaderText = "Ширина рулона";
            col_material_rollwidth.Name = "col_material_rollwidth";
            dataGridViewMaterials.Columns.Add(col_material_rollwidth);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_description = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_description.Name = "col_material_description";
            col_material_description.HeaderText = "Описание";
            col_material_description.DataPropertyName = "material_description";
            col_material_description.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dataGridViewMaterials.Columns.Add(col_material_description);

            System.Windows.Forms.DataGridViewTextBoxColumn col_material_createtime = new System.Windows.Forms.DataGridViewTextBoxColumn();
            col_material_createtime.Name = "col_material_createtime";
            col_material_createtime.HeaderText = "Дата добавления";
            col_material_createtime.DataPropertyName = "material_createtime";
            col_material_createtime.ReadOnly = true;
            dataGridViewMaterials.Columns.Add(col_material_createtime);

            this.dataGridViewMaterials.AutoGenerateColumns = false;
            this.dataGridViewMaterials.DataSource = this.materialsBindingSource;

            SetDoubleBuffered(dataGridViewMaterials, true);

            this.splitContainer1.SplitterDistance = 120;

            this.buttonCancel.CausesValidation = false;
        }
예제 #14
0
        private void frmunits_Load(object sender, EventArgs e)
        {
            context = new ArtflexDbContext();
            context.units.Load();
            BindingList<units> _entities = context.units.Local.ToBindingList();
            unitsBindingSource.DataSource = _entities;
            bindingNavigatorAddNewItem.Enabled = false;
            bindingNavigatorCountItem.Enabled = false;
            bindingNavigatorDeleteItem.Enabled = false;
            bindingNavigatorMoveFirstItem.Enabled = false;
            bindingNavigatorMovePreviousItem.Enabled = false;
            bindingNavigatorPositionItem.Enabled = false;
            bindingNavigatorMoveNextItem.Enabled = false;
            bindingNavigatorMoveLastItem.Enabled = false;
            toolStripButton1.Enabled = true;
            dataGridView1.AutoGenerateColumns = false;

            System.Windows.Forms.DataGridViewTextBoxColumn colunit_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colunit_id.DataPropertyName = "unit_id";
            colunit_id.HeaderText = "unit_id";
            colunit_id.Name = "colunit_id";
            dataGridView1.Columns.Add(colunit_id);
            System.Windows.Forms.DataGridViewTextBoxColumn colunit_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colunit_name.DataPropertyName = "unit_name";
            colunit_name.HeaderText = "unit_name";
            colunit_name.Name = "colunit_name";
            dataGridView1.Columns.Add(colunit_name);
            System.Windows.Forms.DataGridViewTextBoxColumn colunit_shortname = new System.Windows.Forms.DataGridViewTextBoxColumn();
            colunit_shortname.DataPropertyName = "unit_shortname";
            colunit_shortname.HeaderText = "unit_shortname";
            colunit_shortname.Name = "colunit_shortname";
            dataGridView1.Columns.Add(colunit_shortname);
            dataGridView1.DataSource = _entities;
        }
예제 #15
0
 private void frmcategories_Load(object sender, EventArgs e)
 {
     context = new ArtflexDbContext();
     context.categories.Load();
     BindingList<categories> _entities = context.categories.Local.ToBindingList();
     categoriesBindingSource.DataSource = _entities;
     this.category_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.categoriesBindingSource, "category_id", true ));
     this.category_nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.categoriesBindingSource, "category_name", true ));
 }