private void Login() { string tmpHolder = "SELECT Username, Password FROM tblSysUsers WHERE Username = '******' AND Password ='******'"; if (globalData.AlreadyExist(tmpHolder) == true) { string tmpHolderAuth = "SELECT * FROM tblServerAuth WHERE MacAddress='" + GlobalData.GetMACAddress() + "'"; if (globalData.AlreadyExist(tmpHolderAuth) == true) { DateTime tmpSDate = Convert.ToDateTime(globalData.GetValue(tmpHolderAuth, "StartDate")); DateTime tmpEDate = Convert.ToDateTime(globalData.GetValue(tmpHolderAuth, "EndDate")); var Different = tmpEDate - DateTime.Now; double tmpDays = Different.TotalDays; if (tmpDays == 0 || tmpDays < 0) { MessageBox.Show("Your Software License is Upto Date, Please Purchase License ", "Authendication Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { getUserInfo(); getCompanyInfo(); GlobalData.GCompName = globalData.GetValue("SELECT * FROM tblCompany WHERE CustID=" + GlobalData.GCompID + "", "NameOF"); GlobalData.GUserGroup = globalData.GetValue("SELECT * FROM tblUserGroup WHERE CustID=" + gUserGroupID + "", "NameOF"); string stockRommID = globalData.GetValue("SELECT * FROM tblSetCompStockRoom WHERE CompID = " + GlobalData.GCompID + "", "StockRoomID"); if (string.IsNullOrEmpty(stockRommID)) { GlobalData.GStockRoomID = 0; } else { GlobalData.GStockRoomID = Convert.ToInt32(stockRommID); } this.Hide(); frmIPMain f = new frmIPMain(); f.ShowDialog(); } } else { MessageBox.Show("Sorry.. This PC don't have license ", "Authendication Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { LoginAttempts += 1; MessageBox.Show("Sorry.. Username/ Password is incorrect", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Information); if (LoginAttempts == 3) { Environment.Exit(0); } return; } }
private void txtCusCode_Validating(object sender, CancelEventArgs e) { if (txtCusCode.Text == "") { lblCustomer.Text = ""; return; } gSB.Clear(); gSB.Append("SELECT Code FROM tblCustomer WHERE Code = '" + txtCusCode.Text.Trim() + "' "); if (!GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Sorry.. This Customer does not exist", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCusCode.Focus(); return; } }
private bool IsRequired() { if (txtPassword.Text == "") { MessageBox.Show("Empty Password", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPassword.Focus(); return(false); } if (txtPassword.Text != txtRetypePassword.Text) { MessageBox.Show("Passwords are mismatch", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRetypePassword.Clear(); txtPassword.Focus(); return(false); } if (txtCode.Text == "") { MessageBox.Show("Empty Code", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCode.Focus(); return(false); } if (txtUserName.Text == "") { MessageBox.Show("Empty UserName", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUserName.Focus(); return(false); } if (txtOldPassword.Text != gPassword) { MessageBox.Show("Old Password is wrong..", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtOldPassword.Focus(); return(false); } gSB.Clear(); gSB.Append("SELECT Password FROM tblSysUsers WHERE Password = '******' "); if (GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Sorry... This Password Aleady Exist", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPassword.Focus(); return(false); } return(true); }
private void txtCode_Validating(object sender, CancelEventArgs e) { if (txtCode.Text == "") { return; } gSB.Clear(); gSB.Append("SELECT * FROM tblItem WHERE Code = '" + txtCode.Text.Trim() + "' AND IsActive = 'Y'"); if (GlbData.AlreadyExist(gSB.ToString())) { fillProduct(); } else { MessageBox.Show("Sorry.. This Product does not Exist", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCode.Focus(); return; } }
private void txtCode_Validating(object sender, CancelEventArgs e) { if (txtCode.Text == "") { ClearLocal(); txtCode.Clear(); return; } gSB.Clear(); gSB.Append("SELECT * FROM tblSysUsers WHERE Code = '" + txtCode.Text.Trim() + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { FillSysUsers(); } else { MessageBox.Show("Sorry.. This user does not exist", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCode.Focus(); return; } }
private void txtSuppCode_Validating(object sender, CancelEventArgs e) { if (txtSuppCode.Text == "") { txtSuppCode.Clear(); lblSupplier.Text = ""; return; } gSB.Clear(); gSB.Append("SELECT * FROM tblSupplier WHERE Code = '" + txtSuppCode.Text.Trim() + "' AND IsActive = 'Y' "); if (GlbData.AlreadyExist(gSB.ToString()) == false) { MessageBox.Show("Sorry.. This Supplier does not exist", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtSuppCode.Focus(); return; } else { gSupplierID = Convert.ToInt32(GlbData.GetValue(gSB.ToString(), "CustID")); lblSupplier.Text = GlbData.GetValue(gSB.ToString(), "NameOF"); } }
private void txtCusCode_Validating(object sender, CancelEventArgs e) { if (txtCusCode.Text == "") { return; } gSB.Clear(); gSB.Append("SELECT * FROM tblSaleBrief WHERE BillNo = '" + txtCusCode.Text.Trim() + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { return; } else { MessageBox.Show("Sorry.. This Invoice No does not exist", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCusCode.Focus(); return; } }
private void txtCode_TextChanged(object sender, EventArgs e) { if (txtCode.Text == "") { ClearLocal(); txtCode.Clear(); return; } gSB.Clear(); gSB.Append("SELECT * FROM tblItem WHERE Code = '" + txtCode.Text.Trim() + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { fillProduct(); FillPrice(); } else { MessageBox.Show("Sorry.. This item does not exist", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
private void txtCode_Validating(object sender, CancelEventArgs e) { if (txtCode.Text == "") { ClearLocal(); txtCode.Clear(); return; } gSB.Clear(); gSB.Append("SELECT Code FROM tblSupplier WHERE Code = '" + txtCode.Text.Trim() + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { gEditFlag = true; fillSupplier(); btnDelete.Enabled = true; } else { gEditFlag = false; } }
private void txtCode_Validating(object sender, CancelEventArgs e) { if (txtCode.Text == "") { txtCode.Clear(); txtName.Clear(); return; } gSB.Clear(); gSB.Append("SELECT Code FROM " + gTableName + " WHERE Code = '" + txtCode.Text.Trim() + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { gEditFalg = true; FillCommon(); btnDelete.Enabled = true; } else { gEditFalg = false; } }
private void txtRefNo_Validating(object sender, CancelEventArgs e) { if (txtRefNo.Text == "") { dgvBills.DataSource = null; return; } gSB.Clear(); gSB.Append(" SELECT * FROM tblSaleBrief " + " WHERE BillNo = '" + txtRefNo.Text.Trim() + "' AND IsActive = 'Y' AND CompId = " + GlobalData.GCompID + " "); if (!GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Sorry... This Receipt No Does not Exist", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtRefNo.Focus(); return; } else { DisplayBills(); DisplayMOP(); } }
private bool IsRequired() { if (Convert.ToDateTime(dtpEnd.Text) < Convert.ToDateTime(dtpStart.Text)) { MessageBox.Show("Invalid Date Range", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); dtpEnd.Focus(); return(false); } gSB.Clear(); gSB.Append("SELECT * FROM tblSetPromotion WHERE StartOn <= CONVERT(date, '" + dtpEnd.Text + "') AND EndOn >= CONVERT(date, '" + dtpStart.Text + "') "); if (GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Invalid Date Range", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } if (dgvPrice.Rows.Count == 0) { MessageBox.Show("Empty Grid", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); dgvPrice.Focus(); return(false); } return(true); }
private void txtSuppCode_Validating(object sender, CancelEventArgs e) { if (txtSuppCode.Text == "") { lblSupplier.Text = ""; ClearLocal(); return; } gSB.Clear(); gSB.Append("SELECT Code FROM tblSupplier WHERE Code = '" + txtSuppCode.Text.Trim() + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { fillSupplier(); LoadOutstanding(); LoadPRNBills(); } else { MessageBox.Show("Sorry.. This Supplier does not exist", "INVALID", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtSuppCode.Focus(); return; } }
private bool IsRequired() { if (txtCode.Text == "") { MessageBox.Show("Empty Code", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCode.Focus(); return(false); } if (txtUserName.Text == "") { MessageBox.Show("Empty UserName", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUserName.Focus(); return(false); } if (cmbUserGroup.Text == "") { MessageBox.Show("Empty User Group", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbUserGroup.Focus(); return(false); } if (cmbCompany.Text == "") { MessageBox.Show("Empty Company Name", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbCompany.Focus(); return(false); } if (txtPassword.Text == "") { MessageBox.Show("Empty Password", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPassword.Focus(); return(false); } if (txtEmail.Text == "") { MessageBox.Show("Empty Email", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtEmail.Focus(); return(false); } if (txtBackCode.Text == "") { MessageBox.Show("Empty Backup Code", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtBackCode.Focus(); return(false); } if (txtPassword.Text != txtRetypePassword.Text) { MessageBox.Show("Passwords are mismatch", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRetypePassword.Clear(); txtPassword.Focus(); return(false); } gSB.Clear(); gSB.Append("SELECT UserName FROM tblSysUsers WHERE UserName = '******' "); if (GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Sorry... This Username Aleady Exist", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUserName.Focus(); return(false); } gSB.Clear(); gSB.Append("SELECT Password FROM tblSysUsers WHERE Password = '******' "); if (GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Sorry... This Password Aleady Exist", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPassword.Focus(); return(false); } gSB.Clear(); gSB.Append("SELECT PinCode FROM tblSysUsers WHERE PinCode = '" + HashCode(txtBackCode.Text.Trim()) + "' "); if (GlbData.AlreadyExist(gSB.ToString())) { MessageBox.Show("Sorry... This PinCode Aleady Exist", "Empty Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtBackCode.Focus(); return(false); } return(true); }