private void button12_Click(object sender, EventArgs e) { if (textBox1.Text != "" && comboBox1.Text != "") { //check tabel is open or closed //SELECT COUNT(orders.id) AS activeOrders FROM `orders` WHERE orders.active =1 and orders.tabel = 'G1' AND date(orders.created) = '2017-08-23' db con = new db(); DataTable activeTables; con.MysqlQuery("SELECT COUNT(orders.id) AS activeOrders FROM `orders` WHERE orders.active =1 and orders.tabel = '" + comboBox1.Text + "' AND date(orders.created) = CURDATE()"); activeTables = con.QueryEx(); con.conClose(); if (int.Parse(activeTables.Rows[0][0].ToString()) != 0) { //error message table not available string msg = "Table " + comboBox1.Text + " is not available. please close the order first! or select another table."; FormMessage frmmsg = new FormMessage(msg); frmmsg.ShowDialog(); } else { Form_display.tabelStatus = true; SessionData.SetTabelDetails(comboBox1.Text); SessionData.SetGuest(int.Parse(textBox1.Text)); this.Close(); } } }
private void btn_login_Click(object sender, EventArgs e) { if (CheckUserAvailabel() == 1) { Form_display frmdisplay = new Form_display(); this.WindowState = FormWindowState.Minimized; this.Hide(); frmdisplay.ShowDialog(); if (switcheUser) { //MessageBox.Show(switcheUser.ToString()); SessionData.SetUserAuth(false); SessionData.SetUserId(""); SessionData.setauthType(""); SessionData.setUser(""); this.Show(); this.WindowState = FormWindowState.Normal; } else { //genarate z report getTotalSale(); getCardwiseSale(); getVoidItems(); getCategorySale(); getGuestCount(); getCardSaleShift(); getCashSaleShift(); getCashSale(); getTotaldiscount(); getTotalServicecharge(); if (zreportout) { Zreport zreport = new Zreport( _guestCount, _totalSale, _totalDiscount, _totalServiceCharge, _totalcardsale, _totalcashsale, _cardWiseSale, _cardSaleShift, _cashSaleShift, _voidItems, _categorySale ); zreport.print(SessionData._defaultPrinter); this.Close(); } } } else if (CheckUserAvailabel() == 0) { MessageBox.Show("Invalid Authentication!"); } else { FormMessage frmmsg = new FormMessage(errormsg); frmmsg.ShowDialog(); } }