Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        public void btSAve_Click(object sender, EventArgs e)
        {
            string      sqlInsert = "INSERT INTO tb_Unit values('" + txtUnitID.Text + "', N'" + txtUnitName.Text + "')";
            ClassInsert save      = new ClassInsert();

            save.Insert(sqlInsert, connect.DatabaseConnection(constr), "ຂໍ້ມູນຫົວໜ່ວຍລະຫັດ " + txtUnitID.Text + " ໄດ້ຖືກບັນທຶກລົງໃນຖານຂໍ້ມູນແລ້ວ");
            txtUnitID.Text = idauto.SetID(constr, "UnitID", "tb_Unit", "UN00", 2, 3);
            show.ShowData("SELECT * FROM v_Unit", connect.DatabaseConnection(constr), dgvUnit);
        }
        public void btSave_Click(object sender, EventArgs e)
        {
            string      sqlSave = "INSERT INTO tb_RateExchange VALUES('" + txtRateID.Text + "','" + txtCurrency.Text + "','" + txtRate.Text + "')";
            ClassInsert save    = new ClassInsert();

            save.Insert(sqlSave, connect.DatabaseConnection(constr), "ຂໍ້ມູນອັດຕາແລກປ່ຽນລະຫັດ " + txtRateID.Text + " ໄດ້ຖືກບັນທຶກລົງໃນຖານຂໍ້ມູນແລ້ວ");
            txtRateID.Text = idauto.SetID(constr, "RateID", "tb_RateExchange", "R000", 1, 4);
            show.ShowData("SELECT * FROM v_RateExchange", connect.DatabaseConnection(constr), dgvRate);
            txtCurrency.Text = "";
            txtRate.Clear();
            txtCurrency.Focus();
        }
        public void ButtonX1_Click(object sender, EventArgs e)
        {
            if (txtHour.Text == "")
            {
                MessageBox.Show("ກະລຸນາປ້ອນຊົ່ວໂມງ");
                return;
            }
            SqlCommand    cm1 = new SqlCommand("select employeeID from tb_employee where employeeName = '" + Frm_Main.Default.btUser.Text + "'", ConstVar.connect.DatabaseConnection(ConstVar.constr));
            SqlDataReader dr1 = default(SqlDataReader);

            dr1 = cm1.ExecuteReader();
            dr1.Read();
            ConstVar.emID = dr1[0].ToString();
            //   MsgBox(emID)

            string boatstate = "ບໍ່ວ່າງ";
            string id        = "";

            //    id = auto.SetID(constr, "SellID", "tb_Selling", "DLD", 3, 11, 11, "00000000000")

            id = Auto.SetID(ConstVar.constr, "SellID", "tb_Selling", "DLD", 3, 11, 11, "00000000000");
            //MsgBox(id)
            string ServiceStyle = "";

            if ((string)btRefresh.Tag == "ຈອງແລ້ວ")
            {
                ServiceStyle = System.Convert.ToString(1);
            }
            else if ((string)btRefresh.Tag == "ວ່າງ")
            {
                ServiceStyle = System.Convert.ToString(0);
            }
            string      sqlboatStatusUpdate = "Update tb_Boat SET boatStatus = N'" + boatstate + "' WHERE boatid = '" + txtBoatID.Text + "'";
            classUpdate up = new classUpdate();

            up.Update(sqlboatStatusUpdate, ConstVar.connect.DatabaseConnection(ConstVar.constr));
            var         sql  = "insert into tb_Selling(SellID, employeeID,boatID,dateCome, sellStatus,BoatSailHourInit, increase, discount, serveStyle) VALUES('" + id + "','" + ConstVar.emID + "','" + txtBoatID.Text.Trim() + "',getdate(),N'ຕຽມການ', '" + txtHour.Text + "',0,0, '" + ServiceStyle + "')";
            ClassInsert save = new ClassInsert();

            save.Insert(sql, ConstVar.connect.DatabaseConnection(ConstVar.constr));
            this.Close();
            show.ShowData("select * from v_Selling", ConstVar.connect.DatabaseConnection(ConstVar.constr), frm_MainService.Default.dgvOrder);
            show.ShowData("select * from v_SellDetail", ConstVar.connect.DatabaseConnection(ConstVar.constr), frm_MainService.Default.dgvOrderDetail);
            frm_MainService.Default.RadioButton3.Checked = true;
        }
Exemplo n.º 5
0
        public void ButtonX1_Click(object sender, EventArgs e)
        {
            var sqlScript = "select FoodID from tb_FoodAndDrink where FoodID = '" + txtID1.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 insert = new ClassInsert();
                insert.Insert("INSERT INTO tb_FoodAndDrink VALUES('" + txtID1.Text + "','" + System.Convert.ToString(cbfoodGroup.SelectedValue) + "','" + System.Convert.ToString(cbFoodType.SelectedValue) + "',N'" + txtName1.Text + "','" + System.Convert.ToString(cbUnit.SelectedValue) + "','" + txtPrice1.Text + "','" + txtPath1.Text + "')", connect.DatabaseConnection(constr), "ຂໍ້ມູນອາຫານລະຫັດ " + txtID1.Text + " ໄດ້ຖືກບັນທຶກລົງໃນຖານຂໍ້ມູນແລ້ວ");
                show.ShowData(sqlshow, connect.DatabaseConnection(constr), dgvEmployee);
                cleartxt();
            }
            SQL.SQLCon.Close();
        }
Exemplo n.º 6
0
        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();
            }
        }
Exemplo n.º 7
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();
        }
Exemplo n.º 8
0
        public void btSave_Click(object sender, EventArgs e)
        {
            var sqlScript = "select FoodTypeID from tb_FoodType where FoodTypeID = '" + txtID.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);
            }
            else
            {
                ClassInsert save1 = new ClassInsert();
                save1.Insert("INSERT INTO  tb_FoodType 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, "foodTypeID", "tb_foodType", "FT", 2, 3, 3, "000");
            }
            SQL.SQLCon.Close();
        }