private void btnExit_Click(object sender, EventArgs e) { if (!Convert.ToBoolean(this.bView)) { if ((this.dsPR.Tables[0].Rows.Count > 0) || (this.groupPR.Enabled == false)) { if (NP.MSGB("The GI list will be cancel , Do you agree with this ?") == DialogResult.Yes) { // Cancel NP_Cls.SqlDel = "DELETE FROM t_GI WHERE (GINumber = '" + this.txtGI.Text.Trim() + "')"; string strErr = string.Empty; if (!NP.SqlCmd(NP_Cls.SqlDel, ref strErr)) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Delete : " + strErr); return; } else { NP_Cls.SqlDel = "DELETE FROM t_GIDetail WHERE (GINumber = '" + this.txtGI.Text.Trim() + "')"; if (!NP.SqlCmd(NP_Cls.SqlDel, ref strErr)) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Delete Detail : " + strErr); return; } } this.Close(); return; } else { return; } } else { if (NP.MSGB("Do you want to exit this screen ?") == DialogResult.Yes) { this.Close(); return; } else { return; } } } if (NP.MSGB("Do you want to exit this screen ?") == DialogResult.Yes) { this.Close(); } else { return; } }
private bool ChkDup(ref byte bRe) { try { bRe = 0; NP_Cls.SqlSelect = "SELECT UnitCode FROM m_Unit WHERE (UnitCode = '" + this.txtCode.Text.Trim().Replace("'", string.Empty) + "') AND (FileStatus = '1')"; if (NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0].Rows.Count > 0) { return(true); } else { //TODO New 03/02/2012 Reverse filestatus = 0 NP_Cls.SqlSelect = "SELECT UnitCode FROM m_Unit WHERE (UnitCode = '" + this.txtCode.Text.Trim().Replace("'", string.Empty) + "') AND (FileStatus = '0')"; if (NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0].Rows.Count > 0) { if (NP.MSGB("This Code. is unused, Do you want to re-used this Code. ? ") == DialogResult.Yes) { NP_Cls.sqlUpdate = "UPDATE m_Unit SET filestatus = '1' WHERE (UnitCode = '" + this.txtCode.Text.Trim().Replace("'", string.Empty) + "')"; string strErr = string.Empty; if (NP.SqlCmd(NP_Cls.sqlUpdate, ref strErr)) { bRe = 1; return(false); } else { throw new Exception(strErr); } } else { return(false); } } else { return(false); } } } catch (Exception) { throw; } }
private void btnCancelPR_Click(object sender, EventArgs e) { try { if (NP.MSGB("Do you to cancel Purchase Order ?") == DialogResult.Yes) { NP_Cls.SqlDel = "DELETE FROM t_PO WHERE (PONumber = '" + this.txtPR.Text.Trim() + "')"; string strErr = string.Empty; if (!NP.SqlCmd(NP_Cls.SqlDel, ref strErr)) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Delete : " + strErr); return; } else { NP_Cls.SqlDel = "DELETE FROM t_PODetail WHERE (PONumber = '" + this.txtPR.Text.Trim() + "')"; if (!NP.SqlCmd(NP_Cls.SqlDel, ref strErr)) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Delete Detail : " + strErr); return; } } Clear(); this.groupPR.Enabled = true; this.cbMaterial.Text = string.Empty; if (this.dsPR.Tables.Count > 0) { this.dsPR.Tables.Clear(); this.MyGrid(this.dgvView); } this.cbMaterial.DataSource = null; this.btnAddPR.Visible = true; this.btnSave.Visible = false; BindVendor(); this.cbVendor.Text = string.Empty; this.cbVendor.Select(); } else { return; } } catch (Exception ex) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Cancel : " + ex.Message); return; } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (NP.MSGB("Do you want to delete ?") == DialogResult.Yes) { if (this.dgvView.RowCount == 0) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Data Not Found !!"); return; } NP_Cls.SqlDel = "DELETE FROM t_StockOverview WHERE (MaterialCode = '" + this.dgvView["clnMaterialCode", this.dgvView.CurrentRow.Index].Value.ToString() + "') AND (BatchNumber = '" + this.dgvView["clnBatch", this.dgvView.CurrentRow.Index].Value.ToString() + "')"; string strErr = string.Empty; NP.SqlCmd(NP_Cls.SqlDel, ref strErr); Clear(); DGV(); this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.txtCode.Enabled = true; this.txtBatch.Enabled = true; NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Delete Completed !!"); } else { return; } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (this.dgvView.RowCount == 0) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Data Not Found !!"); return; } if (NP.MSGB("Do you want to delete user ?") == DialogResult.Yes) { NP_Cls.SqlDel = "UPDATE s_User SET FileStatus = 'D', UserChange = '" + NP_Cls.strUsr + "', DateChange = GETDATE() WHERE (EmployeeCode = '" + this.dgvView["clnEmployeeCode", this.dgvView.CurrentRow.Index].Value.ToString() + "')"; string strErr = string.Empty; NP.SqlCmd(NP_Cls.SqlDel, ref strErr); Clear(); DGV(); this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.txtConf.Enabled = true; this.txtPass.Enabled = true; this.txtEmpCode.Enabled = true; this.txtUserName.Enabled = true; NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Delete user Completed !!"); } else { return; } }
private void GenBCode() { try { NP_Cls.SqlSelect = "SELECT TmpBOMCode FROM tmp_GenCode"; Int64 iCode = Convert.ToInt64(NP.GetClientDataSet(NP_Cls.SqlSelect).Tables[0].Rows[0][0].ToString()); iCode += 1; string strErr = string.Empty; if (NP.SqlCmd("UPDATE tmp_GenCode SET TmpBOMCode = " + iCode, ref strErr)) { NP_Cls.strBOMCode = iCode.ToString(); } else { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, strErr); return; } } catch (Exception ex) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, ex.Message); return; } }