Esempio n. 1
0
        public void frm_MainService_Load(object sender, EventArgs e)
        {
            this.ContextMenuStrip = ContextMenuStrip1;
            btOrder.Enabled       = false;
            btStart.Enabled       = false;
            btCheckBill.Enabled   = false;
            btCalculate.Enabled   = false;
            btPaid.Enabled        = false;


            mnPaid.Visible  = false;
            mnorder.Visible = false;
            mnPrint.Visible = false;
            mnCal.Visible   = false;
            mnPaid.Visible  = false;
            mnStart.Visible = false;
            classDatabaseConnection connect = new classDatabaseConnection();

            show.ShowData("select * from v_Selling", connect.DatabaseConnection(ConstVar.constr), dgvOrder);
            show.ShowData("select * from v_SellDetail", connect.DatabaseConnection(ConstVar.constr), dgvOrderDetail);


            lbSellID.BackColor = Color.FromArgb(70, Color.Black);
            Panel4.BackColor   = Color.FromArgb(70, Color.Black);

            dgvOrder.Columns[8].DefaultCellStyle.Format = "HH:mm:ss";
            dgvOrder.Columns[9].DefaultCellStyle.Format = "HH:mm:ss";
            //  dgvOrder.Columns(0).Width = 150
            //  dgvOrderDetail.Columns(6).Width = 1
            setRowColor();
            dgvOrder.CurrentCell = dgvOrder.Rows[dgvOrder.RowCount - 1].Cells[0];
        }
Esempio n. 2
0
 public void frm_FoodType_Load(object sender, EventArgs e)
 {
     // TabControl1.BackColor = Color.FromArgb(70, Color.Black)
     //  TabPage1.BackColor = Color.FromArgb(70, Color.Black)
     //TabPage2.BackColor = Color.FromArgb(70, Color.Black)
     show.ShowData(sqlshow, connect.DatabaseConnection(constr), dgvFoodType);
     //    txtID.Text = autoID.SetID(constr, "FoodtypeID", "tb_FoodType", "FT00", 2, 3)
     txtID.Text = autoID.SetID(constr, "foodTypeID", "tb_foodType", "FT", 2, 3, 3, "000");
 }
Esempio n. 3
0
 public void frm_Food_Load(object sender, EventArgs e)
 {
     this.UseWaitCursor = true;
     show.ShowData(sqlshow, connect.DatabaseConnection(constr), dgvEmployee);
     Panel2.Height = 0;
     show.ShowDataInCombobox("Select FoodTypeID, FoodTypeName From tb_FoodType", connect.DatabaseConnection(constr), cbFoodType, "FoodTypeID", "FoodTypeName");
     show.ShowDataInCombobox("Select FoodGroupID, FoodGroupName From tb_FoodGroup", connect.DatabaseConnection(constr), cbfoodGroup, "FoodGroupID", "FoodGroupName");
     show.ShowDataInCombobox("Select UnitID, UnitName From tb_Unit", connect.DatabaseConnection(constr), cbUnit, "UnitID", "UnitName");
     txtID1.Text    = autoID.SetID(constr, "FoodID", "tb_FoodAndDrink", "FD00", 2, 3);
     pnbt.BackColor = Color.FromArgb(70, Color.Black);
     //  pndata.BackColor = Color.FromArgb(70, Color.Black)
     Panel3.BackColor = Color.FromArgb(70, Color.Black);
 }
Esempio n. 4
0
        public void btSave_Click(object sender, EventArgs e)
        {
            var sqlScript = "select boatID from tb_boat where boatID = '" + txtBoatID.Text + "'";

            //SQL.SQLCm = New SqlCommand(sqlScript, db.DatabaseConnection(constr))
            //db.SQLDr = db.SQLCm.ExecuteReader()
            // Timer1.Enabled = True
            SQL.SQLCmd = new System.Data.SqlClient.SqlCommand(sqlScript, SQL.SQLCon);
            SQL.SQLCon.Open();
            SQL.SQLDr = SQL.SQLCmd.ExecuteReader();
            if (SQL.SQLDr.HasRows)
            {
                MessageBox.Show("ລະຫັດນີ້ມີຢູ່ໃນຖານຂໍ້ມູນແລ້ວ", "ຄໍາເຕືອນ", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                // MsgBox("ລະຫັດ" 5)
            }
            else
            {
                sqlInsert = "INSERT INTO tb_boat(boatID, boatTypeID, Boatname, boatStatus, boatPicture) values('" + txtBoatID.Text + "','" + System.Convert.ToString(cbBoatType.SelectedValue) + "',N'" + txtBoatName.Text + "',N'" + ComboBox1.SelectedItem.ToString() + "', '" + txtpicture.Text + "')";
                ClassInsert save = new ClassInsert();
                save.Insert(sqlInsert, connect.DatabaseConnection(constr), "ຂໍ້ມູນເຮືອລະຫັດ " + txtBoatID.Text + " ໄດ້ຖືກບັນທຶກລົງໃນຖານຂໍ້ມູນແລ້ວ");
                txtBoatID.Text = autoID.SetID(constr, "BoatID", "tb_Boat", "B0", 1, 2);
                selectData.ShowData(sqlshow, connect.DatabaseConnection(constr), dgvboat);
                Clear();
            }
            SQL.SQLCon.Close();
        }
        public void btSave_Click(object sender, EventArgs e)
        {
            var sqlScript = "select FoodGroupID from tb_FoodGroup where FoodgroupID = '" + txtID.Text + "'";

            SQL.SQLCmd = new System.Data.SqlClient.SqlCommand(sqlScript, SQL.SQLCon);
            SQL.SQLCon.Open();
            SQL.SQLDr = SQL.SQLCmd.ExecuteReader();
            if (SQL.SQLDr.HasRows)
            {
                MessageBox.Show("ລະຫັດນີ້ມີຢູ່ໃນຖານຂໍ້ມູນແລ້ວ", "ຄໍາເຕືອນ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                ClassInsert save1 = new ClassInsert();
                save1.Insert("INSERT INTO  tb_FoodGroup VALUES('" + txtID.Text + "',N'" + txtName.Text + "',N'" + txtDEs.Text + "')", connect.DatabaseConnection(constr), "ຂໍ້ມູນກຸ່ມອາຫານລະຫັດ " + txtID.Text + " ໄດ້ຖືກບັນທຶກລົງໃນຖານຂໍ້ມູນແລ້ວ");
                show.ShowData(sqlshow, connect.DatabaseConnection(constr), dgvFoodType);
                txtID.Text = autoID.SetID(constr, "FoodGroupID", "tb_FoodGroup", "FG00", 2, 3);
                cleartxt();
            }
        }
Esempio n. 6
0
        public void btSave_Click(object sender, EventArgs e)
        {
            string sqlInsert = "";
            var    sqlscript = "SELECT EmployeeID FROM tb_Employee WHERE EmployeeID = '" + txtEmployeeID.Text + "'";

            SQL.SQLCmd = new System.Data.SqlClient.SqlCommand(sqlscript, SQL.SQLCon);
            SQL.SQLCon.Open();
            SQL.SQLDr = SQL.SQLCmd.ExecuteReader();
            if (SQL.SQLDr.HasRows)
            {
                MessageBox.Show("ລະຫັດນີ້ມີຢູ່ໃນຖານຂໍ້ມູນແລ້ວ", "ຄໍາເຕືອນ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                SQL.SQLDr.Close();
            }
            else
            {
                sqlInsert = "INSERT INTO tb_Employee VALUES('" + txtEmployeeID.Text + "','" + txtEmployeeName.Text + "','" + txtEmployeeLastName.Text + "','" + dtbDob.Text + "','" + txtEmployeePosition.Text + "','" + txtEmployeeTel.Text + "','" + txtEmployeeParentTel.Text + "','" + txtEmployeeEmail.Text + "','" + txtEmployeeVillage.Text + "','" + txtEmployeeDistrict.Text + "','" + cbProvince.SelectedValue.ToString() + "','" + txtEmployeeSalary.Text + "','" + txtPicturePath.Text + "')";
                ClassInsert save = new ClassInsert();
                save.Insert(sqlInsert, connect.DatabaseConnection(constr), "ຂໍ້ມູນຂອງພະນັກງານລະຫັດ " + txtEmployeeID.Text + " ໄດ້ຖືກບັນທຶກລົງໃນຖານຂໍ້ມູນແລ້ວ");
                txtEmployeeID.Text = idauto.SetID(constr, "EmployeeID", "tb_Employee", "EP00", 2, 3);
                show.ShowData("SELECT * FROM v_Employee", connect.DatabaseConnection(constr), dgvEmployee);
            }
            SQL.SQLCon.Close();
        }
        public void ButtonX1_Click(object sender, EventArgs e)
        {
            if ((string)btRefresh.Tag == "ວ່າງ")
            {
                serveStyle = System.Convert.ToString(0);
            }
            else if ((string)btRefresh.Tag == "ບໍ່ວ່າງ")
            {
                serveStyle = System.Convert.ToString(1);
            }
            else if ((string)btRefresh.Tag == "ຈອງແລ້ວ")
            {
                serveStyle = System.Convert.ToString(0);
            }



            DateTime      tt  = DateTime.Parse(txtTime.Text);
            string        tt2 = tt.ToShortTimeString();
            SqlCommand    cm3 = new SqlCommand("select convert(varchar(8),reserveComeTime, 108) from tb_reserveBoat where reserveComeTime ='" + tt2 + "' and reserveComeDate = '" + dtpDatecome.Text + "'", ConstVar.connect.DatabaseConnection(ConstVar.constr));
            SqlDataReader dr  = default(SqlDataReader);

            dr = cm3.ExecuteReader();
            //  dr.Read()
            if (dr.HasRows)
            {
                MessageBox.Show("ເວລານີ້ຖືກຈອງແລ້ວ!!!" + Constants.vbNewLine + "ແນະນໍາ: ກະລຸນາປ້ອນເວລາໃໝ່", "ຄໍາເຕືອນ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTime.Clear();
                txtTime.Focus();
                return;
            }
            else
            {
                SqlCommand    cm1 = new SqlCommand("select employeeID from tb_employee where employeeName = '" + frm_Login.Default.txtUsername.Text + "'", ConstVar.connect.DatabaseConnection(ConstVar.constr));              //''Problem
                SqlDataReader dr1 = default(SqlDataReader);
                dr1 = cm1.ExecuteReader();
                dr1.Read();
                ConstVar.emID = dr1[0].ToString();

                var sqlScript = "select CustomerID from tb_customer where customerID = '" + txtID.Text + "'";
                db.SQLCm = new SqlCommand(sqlScript, db.DatabaseConnection(ConstVar.constr));
                db.SQLDr = db.SQLCm.ExecuteReader();
                if (db.SQLDr.HasRows)
                {
                    //Dim sql = "insert into tb_Reserveboat(reserveID, reserveDate, reserveComeDate, reserveComeTime, reserveStatus, customerID, employeeID) VALUES('" & txtReservID.Text & "','" & dtvReserve.Value.ToString("MM/dd/yyyy") & "','" & dtpDatecome.Value.ToString("MM/dd/yyyy") & "','" & txtTimecome.Text & "',N'ຍັງບໍ່ມາ','" & txtID.Text & "','" & emID & "')"
                    var sql = "insert into tb_ReserveBoat VALUES('" + txtReservID.Text + "','" + ConstVar.emID + "','" + txtBoatID.Text + "','" + txtID.Text + "','" + dtvReserve.Value.ToString("MM/dd/yyyy") + "','" + dtpDatecome.Value.ToString("MM/dd/yyyy") + "','" + txtTime.Text + "','" + txtHour.Text + "',N'ຍັງບໍ່ມາ','" + serveStyle + "')";
                    ConstVar.sav.Insert(sql, ConstVar.connect.DatabaseConnection(ConstVar.constr));
                    txtID.Text       = ConstVar.au.SetID(ConstVar.constr, "CustomerID", "tb_Customer", "C", 1, 4, 4, "0000");
                    txtReservID.Text = ConstVar.au.SetID(ConstVar.constr, "reserveID", "tb_ReserveBoat", "RSB", 3, 5, 5, "00000");
                    txtName.Text     = "";
                    txtLastName.Text = "";
                    txtTel.Text      = "";
                    txtTel2.Text     = "";
                    txtTime.Text     = "";
                    // Dispose()

                    string sqlboat = "";
                    string sqlinsert;
                    sqlboat = "update tb_boat set boatStatus = N'ຈອງແລ້ວ' where boatID='" + txtBoatID.Text + "'";
                    ConstVar.upd.Update(sqlboat, ConstVar.connect.DatabaseConnection(ConstVar.constr));
                    ConstVar.sh.ShowData("select * from v_ReserveBoat", ConstVar.connect.DatabaseConnection(ConstVar.constr), frm_MainReserve.Default.dgvReserveBoat);
                    frm_MainReserve.Default.cbYet.Checked = true;
                }
                else
                {
                    string sqlCustomer = "Insert into tb_customer values('" + txtID.Text + "',N'" + txtName.Text + "',N'" + txtLastName.Text + "','" + txtTel.Text + "','" + txtTel2.Text + "')";
                    //   Dim sql = "insert into tb_Reserveboat(reserveID, reserveDate, reserveComeDate, reserveComeTime, reserveStatus, customerID, employeeID) VALUES('" & txtReservID.Text & "','" & dtvReserve.Value.ToString("MM/dd/yyyy") & "','" & dtpDatecome.Value.ToString("MM/dd/yyyy") & "','" & txtTime.Text & "',N'ຍັງບໍ່ມາ','" & txtID.Text & "','" & emID & "')"
                    var sql = "insert into tb_ReserveBoat VALUES('" + txtReservID.Text + "','" + ConstVar.emID + "','" + txtBoatID.Text + "','" + txtID.Text + "','" + dtvReserve.Value.ToString("MM/dd/yyyy") + "','" + dtpDatecome.Value.ToString("MM/dd/yyyy") + "','" + txtTime.Text + "','" + txtHour.Text + "',N'ຍັງບໍ່ມາ','" + serveStyle + "')";
                    ConstVar.sav.Insert(sqlCustomer, ConstVar.connect.DatabaseConnection(ConstVar.constr));
                    ConstVar.sav.Insert(sql, ConstVar.connect.DatabaseConnection(ConstVar.constr));
                    txtID.Text       = ConstVar.au.SetID(ConstVar.constr, "CustomerID", "tb_Customer", "C", 1, 4, 4, "0000");
                    txtReservID.Text = ConstVar.au.SetID(ConstVar.constr, "reserveID", "tb_ReserveBoat", "RSB", 3, 5, 5, "00000");
                    txtName.Text     = "";
                    txtLastName.Text = "";
                    txtTel.Text      = "";
                    txtTel2.Text     = "";
                    txtTime.Text     = "";
                    //   Dispose()
                    string sqlboat = "";
                    string sqlinsert;
                    sqlboat = "update tb_boat set boatStatus = N'ຈອງແລ້ວ' where boatID='" + txtBoatID.Text + "'";
                    ConstVar.upd.Update(sqlboat, ConstVar.connect.DatabaseConnection(ConstVar.constr));
                    ConstVar.sh.ShowData("select * from v_ReserveBoat", ConstVar.connect.DatabaseConnection(ConstVar.constr), frm_MainReserve.Default.dgvReserveBoat);
                    frm_MainReserve.Default.cbYet.Checked = true;
                }
            }
        }
 public void frm_RateExchange_Load(object sender, EventArgs e)
 {
     txtRateID.Text   = idauto.SetID(constr, "RateID", "tb_RateExchange", "R000", 1, 4);
     Panel1.BackColor = Color.FromArgb(80, Color.Black);
     show.ShowData("SELECT * FROM v_RateExchange", connect.DatabaseConnection(constr), dgvRate);
 }
Esempio n. 9
0
        public void Timer1_Tick(object sender, EventArgs e)
        {
            if (pgb.Value >= pgb.Maximum - 1)
            {
                Timer1.Stop();
                // Frm_Main.Show()

                if (txtUsername.Text == "")
                {
                    MessageBox.Show("Enter Username Please", "Username Require");
                    pgb.Visible  = false;
                    btLogin.Text = "ເຂົ້າສູ່ລະບົບ";
                    return;
                }
                if (txtPassword.Text == "")
                {
                    MessageBox.Show("Enter Passwore Please", "Password Require");
                    pgb.Visible  = false;
                    btLogin.Text = "ເຂົ້າສູ່ລະບົບ";
                    return;
                }
                if (txtUsername.Text == "" && txtPassword.Text == "")
                {
                    MessageBox.Show("Enter User and Password Please", "User Info Require");
                    pgb.Visible  = false;
                    btLogin.Text = "ເຂົ້າສູ່ລະບົບ";
                    return;
                }
                if (cbState.Text == "----ເລືອກສະຖານະ-----")
                {
                    MessageBox.Show("Select State Please", "State Require");
                    pgb.Visible  = false;
                    btLogin.Text = "ເຂົ້າສູ່ລະບົບ";
                    return;
                }
                var sqlScript = "select Username,userpassword, userState from tb_user where username = '******'  and Userpassword = '******' and userstate = '" + cbState.SelectedItem.ToString() + "'";
                db.SQLCm = new SqlCommand(sqlScript, db.DatabaseConnection(constr));
                db.SQLDr = db.SQLCm.ExecuteReader();
                if (db.SQLDr.HasRows)
                {
                    db.SQLDr.Close();
                    Frm_Main.Default.Show();
                    if (cbState.Text == "staff")
                    {
                        Frm_Main.Default.ButtonX6.Enabled       = false;
                        frm_OrderFood3.Default.txtprice.Enabled = false;
                    }
                    else if (cbState.Text == "admin")
                    {
                        Frm_Main.Default.ButtonX6.Enabled       = true;
                        frm_OrderFood3.Default.txtprice.Enabled = true;
                    }
                    //  Frm_Main.lbUsername.Text = Me.txtUsername.Text
                    this.Hide();
                    this.Hide();
                }
                else
                {
                    db.SQLDr.Close();
                    MessageBox.Show("ຊື່ ແລະລະຫັດຜູ້ໃຊ້ບໍຖຶກຕ້ອງ");
                    cbState.Text = "-----ເລືອກສະຖານະ-----";
                    txtUsername.Clear();
                    txtPassword.Clear();
                    txtUsername.Focus();
                }



                btLogin.Text = "ເຂົ້າສູ່ລະບົບ";
                pgb.Visible  = false;
            }
            else
            {
                pgb.Value = pgb.Value + 5;
            }
        }
Esempio n. 10
0
 public void frm_Unit_Load(object sender, EventArgs e)
 {
     txtUnitID.Text = idauto.SetID(constr, "UnitID", "tb_Unit", "UN00", 2, 3);
     show.ShowData("SELECT * FROM v_Unit", connect.DatabaseConnection(constr), dgvUnit);
 }