private void btnRejectOut_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridView1.Rows) { Boolean CheckRow = Convert.ToBoolean(row.Cells["Select"].Value); if (CheckRow) { string SoBB = row.Cells["So_Bien_Ban"].Value.ToString(); string DELBB2 = "delete from Xuat_kho where Ma_TS = " + Convert.ToInt32(row.Cells["Ma_TS"].Value) + " and So_BB_Xuat = '" + SoBB + "'"; OracleCommand cmdel2 = new OracleCommand(DELBB2, con); con.Open(); cmdel2.ExecuteNonQuery(); con.Close(); AutoTask.BUFFERtoLuuKho(Convert.ToInt32(row.Cells["Ma_TS"].Value)); AntiDuplicated.DeleteDuplicatedRow("Luu_Kho", "Ma_TS"); } } OutStorageLoad(); }
private void btnApproveRepair_Click(object sender, EventArgs e) { try { AutoStickDuplicatedMTS(); foreach (DataGridViewRow row in dataGridView2.Rows) { Boolean CheckRow = Convert.ToBoolean(row.Cells["SelectRepair"].Value); if (CheckRow) { AutoTask.UpdateApprovedOfBB(row.Cells["So_Bien_Ban"].Value.ToString()); AutoTask.BufferClear(Convert.ToInt32(row.Cells["Ma_TS"].Value)); if (row.Cells["vat_tu_xuat"].Value.ToString() != "") { AutoTask.BufferClear(Convert.ToInt32(row.Cells["vat_tu_xuat"].Value)); } else if (row.Cells["vat_tu_xuat"].Value.ToString() == "") { } string strUpdate = "UPDATE Sua_chua SET Approved = 1 WHERE Ma_TS = '" + row.Cells["Ma_TS"].Value.ToString() + "'"; OracleCommand cmdUpdate = new OracleCommand(); cmdUpdate.CommandType = CommandType.Text; cmdUpdate.CommandText = strUpdate; cmdUpdate.Connection = con; con.Open(); cmdUpdate.ExecuteNonQuery(); con.Close(); } } foreach (DataGridViewRow row in dataGridView2.Rows) { Boolean ChkRow = Convert.ToBoolean(row.Cells["SelectRepair"].Value); if (ChkRow == true) { string VTX = row.Cells["Vat_tu_xuat"].Value.ToString(); if (VTX != "") { string strRepair = "INSERT INTO Ngoai_Kho (Ma_TS, ID_User, Latest_Day_Out, So_BB) VALUES (:Ma_TS, :ID_User, CURRENT_DATE, :SoBB)"; OracleCommand cmdRepair = new OracleCommand(); cmdRepair.Connection = con; cmdRepair.CommandType = CommandType.Text; cmdRepair.CommandText = strRepair; cmdRepair.Parameters.Add(new OracleParameter("Ma_TS", row.Cells["Vat_tu_xuat"].Value.ToString())); cmdRepair.Parameters.Add(new OracleParameter("ID_User", row.Cells["USER_ID"].Value.ToString())); cmdRepair.Parameters.Add(new OracleParameter("SoBB", row.Cells["So_Bien_Ban"].Value.ToString())); //cmdRepair.Parameters.Add(new OracleParameter("clDate", row.Cells["Ngay_update"].Value.ToString())); con.Open(); cmdRepair.ExecuteNonQuery(); con.Close(); } else if (VTX == "") { } } } foreach (DataGridViewRow row in dataGridView2.Rows) { Boolean ChkRow = Convert.ToBoolean(row.Cells["SelectRepair"].Value); if (ChkRow) { string strRepair2 = "INSERT INTO Ngoai_Kho (Ma_TS, ID_User, Latest_Day_Out, So_BB) VALUES (:Ma_TS, :ID_User, CURRENT_DATE, :So_BB)"; OracleCommand cmdRepair2 = new OracleCommand(); cmdRepair2.Connection = con; cmdRepair2.CommandType = CommandType.Text; cmdRepair2.CommandText = strRepair2; cmdRepair2.Parameters.Add(new OracleParameter("Ma_TS", row.Cells["Ma_TS"].Value.ToString())); cmdRepair2.Parameters.Add(new OracleParameter("ID_User", row.Cells["USER_ID"].Value.ToString())); //cmdRepair2.Parameters.Add("clDate", row.Cells["Ngay_update"].Value.ToString()); cmdRepair2.Parameters.Add(new OracleParameter("So_BB", row.Cells["So_Bien_Ban"].Value.ToString())); con.Open(); cmdRepair2.ExecuteNonQuery(); con.Close(); } } string tableName = "NGOAI_KHO"; string fieldName = "MA_TS"; AntiDuplicated antiDuplicated = new AntiDuplicated(); antiDuplicated.DeleteDuplicatedRow(tableName, fieldName); OutStorageLoad(); } catch (Exception ex) { MessageBox.Show(ex.Message); //throw; } }