private void SetAdisyon(Table vTable) { var ucSlips = new ucSaleSlip(vTable); tabPage2.Controls.Clear(); tabPage2.Controls.Add(ucSlips); //tabControl1.SelectedIndex = 1; }
public static Table GetTableById(int pId) { Table list = new Table(); DataTable dt = DAL.GetTableById(pId); foreach (DataRow row in dt.Rows) { Table item = new Table() { Id = row.Field<int>("Id"), TableName = row.Field<string>("Name"), Active = row.Field<bool>("Active"), RecordDate = row.Field<DateTime>("RecordDate") }; list = item; } return list; }
public static List<Table> GetAllTables() { List<Table> list = new List<Table>(); DataTable dt = DAL.GetAllTables(); foreach (DataRow row in dt.Rows) { Table item = new Table() { Id = row.Field<int>("Id"), TableName = row.Field<string>("Name"), Active = row.Field<bool>("Active"), RecordDate = row.Field<DateTime>("RecordDate") }; list.Add(item); } return list; }
private void btnSaveTable_Click(object sender, EventArgs e) { if (tbTableName.Text.Replace(" ", "") != string.Empty) { Table table = new Table() { TableName = tbTableName.Text.Replace(" ", "") }; bool result = table.Save(); if (result) MessageBox.Show("Masa ekleme işleminiz gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("İşlemde hata gerçekleşti.", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error); LoadTables(); tbTableName.Text = string.Empty; } else { MessageBox.Show("Lütfen masa adı giriniz", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadInitializeValues(Table pTable) { gComeMainForm = true; var vGroups = ProductGroup.GetAllProductGroups(); var ucProductGroups = new ucProductGroups(); ucProductGroups.SetGroups(vGroups, GroupClick); gbGroups.Controls.Add(ucProductGroups); cmbTables.ValueMember = "Id"; cmbTables.DisplayMember = "TableName"; tables = Table.GetAllTables(); tables.Insert(0, new Table { Id = -1, TableName = "Seçiniz" }); cmbTables.DataSource = tables; if (pTable != null) { cmbTables.SelectedValue = pTable.Id; gTable = pTable; if (pTable.Active) { LoadGrid(pTable.Id); } } gComeMainForm = false; }
void LoadGrid(int pTableId) { vBasket = Basket.GetBasketList(pTableId); if (vBasket.Count == 0) { dgvProducts.DataSource = null; return; } gChelner = vBasket[0].Chelner; dgvProducts.DataSource = vBasket; gTable = tables.First(z => z.Id == pTableId);// Table.GetTableById(pTableId); total = vBasket.Sum(t => t.Total); lblTotal.Text = total.ToString("N2"); }
public ucSaleSlip(Table pTable) { InitializeComponent(); LoadInitializeValues(pTable); }
private void dtTables_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 46) { DialogResult dialogResult = MessageBox.Show("Silmek istediğinize emin misiniz ? ", "Dikkat", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { int Id = Convert.ToInt32(dtTables.SelectedRows[0].Cells[0].Value); Table t = new Table() { Id = Id }; t.Delete(); } LoadTables(); } }
private void dtTables_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string value = dtTables.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); int Id = Convert.ToInt32(dtTables.Rows[e.RowIndex].Cells[0].Value); DialogResult dialogResult = MessageBox.Show("Güncellemek istediğinize emin misiniz ? ", "Dikkat", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { Table t = new Table() { Id = Id, TableName = value }; t.Update(); MessageBox.Show("Masa güncelleme işleminiz gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { LoadTables(); } }
void tbl_Click(object sender, EventArgs e) { if (sender == null) { MessageBox.Show("Lütfen Masa Seçiniz", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var vucTable = ((sender as PictureBox).Parent as ucTable); vTable = new Table { Active = vucTable.TableActive, TableName = vucTable.TableName, Id = vucTable.TableID }; //SetAdisyon(vTable); tabControl1.SelectedIndex = 1; }