Ejemplo n.º 1
0
        public Orders()
        {
            InitializeComponent();
            this.context = new BarbershopDBContext();
            var orders = (from order in context.Orders
                          where order.IsCanceled == false
                          join client in context.Clients on order.ClientId equals client.Id
                          join orderDetail in context.OrderDetails on order.Id equals orderDetail.OrderId
                          join master in context.Masters on orderDetail.MasterId equals master.Id
                          select  new
            {
                orderId = order.Id,
                clientName = client.Name,
                clientPhone = client.Phone,
                masterName = master.Name,
                orderDate = order.Date
            }).Distinct().ToList();

            this.dataGridView1.Columns.Add("0", "ID Записи");
            this.dataGridView1.Columns.Add("1", "Клиент");
            this.dataGridView1.Columns.Add("2", "Телефон клиента");
            this.dataGridView1.Columns.Add("3", "Мастер");
            this.dataGridView1.Columns.Add("4", "Дата записи");
            for (int i = 0; i < orders.Count; i++)
            {
                this.dataGridView1.Rows.Add();
                this.dataGridView1.Rows[i].Cells[0].Value = orders[i].orderId;
                this.dataGridView1.Rows[i].Cells[1].Value = orders[i].clientName;
                this.dataGridView1.Rows[i].Cells[2].Value = orders[i].clientPhone;
                this.dataGridView1.Rows[i].Cells[3].Value = orders[i].masterName;
                this.dataGridView1.Rows[i].Cells[4].Value = orders[i].orderDate;
            }
        }
Ejemplo n.º 2
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            if (this.loginBox.Text == "" || this.passwordBox.Text == "")
            {
                MessageBox.Show("Введите все данные");
            }
            BarbershopDBContext context = new BarbershopDBContext();
            var administartor           = context.Administrators.FirstOrDefault(admin => admin.Login == this.loginBox.Text);

            if (administartor == null)
            {
                MessageBox.Show("Неверные данные");
            }
            else
            {
                if (GetPasswordHash(this.passwordBox.Text, administartor.Salt) == administartor.Password)
                {
                    this.Hide();
                    Form form = Application.OpenForms.Cast <Form>().Where <Form>((Func <Form, bool>)(x => x.Name == "Menu")).FirstOrDefault <Form>();
                    (!(form is Menu) ? (Control) new Menu(administartor) : (Control)form).Show();
                }
                else
                {
                    MessageBox.Show("Неверные данные");
                }
            }
        }
Ejemplo n.º 3
0
 public ChangeShedule()
 {
     InitializeComponent();
     this.context = new BarbershopDBContext();
     this.dataGridView1.DataSource = context.Masters.ToList();
     this.dataGridView1.Columns.GetLastColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.None).Visible = false;
     for (int i = 0; i < 3; i++)
     {
         this.dataGridView1.Columns[i].ReadOnly = true;
     }
 }
Ejemplo n.º 4
0
        public Records(DateTime start, DateTime end)
        {
            InitializeComponent();
            string[] records = { "Общий", "Мастера", "Услуги" };
            this.comboBox1.Items.AddRange(records);
            this.comboBox1.SelectedItem          = this.comboBox1.Items[0];
            this.comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;

            this.start = start;
            this.end   = end;

            context = new BarbershopDBContext();
            LoadMainRecord();
        }
Ejemplo n.º 5
0
        public CreateOrder()
        {
            InitializeComponent();
            this.context = new BarbershopDBContext();
            var clients = context.Clients.ToList();

            this.comboBox1.DataSource         = clients;
            this.comboBox1.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;

            dateTimePicker1.Format       = DateTimePickerFormat.Custom;
            dateTimePicker1.CustomFormat = "dd/MM/yyyy HH:mm";
            dateTimePicker1.MinDate      = DateTime.Today;

            var masters = context.Masters.ToList();

            this.listBox1.DataSource = masters;

            var services = context.Services.ToList();

            this.checkedListBox1.DataSource = services;
        }
Ejemplo n.º 6
0
 public CreateRecordData()
 {
     InitializeComponent();
     var context = new BarbershopDBContext();
 }