private bool checkInsertedReleaseEntry(List <Tuple <string, string> > dataList) { bool isError = false; try { for (int i = 0; i < dataList.Count; i++) { switch (dataList[i].Item1) { case "comment": if (!VALIDATION.isEmptyTextBox(dataList[i].Item2)) { if (VALIDATION.isSpecialChars(dataList[i].Item2)) { COM_MESSAGE.validationMessage("comment should not contains special characters !!!"); isError = true; } } break; case "destination": if (VALIDATION.isEmptyTextBox(dataList[i].Item2)) { COM_MESSAGE.validationMessage("Destination Cannot Be Empty !!!"); isError = true; } break; case "stockEntryId": if (VALIDATION.isEmptyTextBox(dataList[i].Item2)) { COM_MESSAGE.validationMessage("stock Id Cannot Be Empty !!!"); isError = true; } break; default: break; } } } catch (Exception ex) { throw ex; } return(isError); }
private void btnLogin_Click(object sender, EventArgs e) { lbl_userNameEmpty.Visible = false; lbl_passwdEmpty.Visible = false; lbl_invalidUser.Visible = false; pnl_userName.BackgroundImage = null; pnl_pass.BackgroundImage = null; bool isError = false; try { //validate userName if (VALIDATION.isEmptyTextBox(txtUserName.Text)) { lbl_userNameEmpty.Visible = true; lbl_userNameEmpty.Text = "User Name is empty"; lbl_userNameEmpty.ForeColor = Color.Red; pnl_userName.BackgroundImage = (Image)CommonControls.Properties.Resources.ng; txtUserName.Focus(); isError = true; } else { if (VALIDATION.isSpecialChars(txtUserName.Text)) { lbl_userNameEmpty.Visible = true; lbl_userNameEmpty.Text = "User Name Cannot contains special characters"; lbl_userNameEmpty.ForeColor = Color.Red; pnl_userName.BackgroundImage = (Image)CommonControls.Properties.Resources.ng; txtUserName.Focus(); isError = true; } } if (VALIDATION.isEmptyTextBox(txtPassword.Text)) { lbl_passwdEmpty.Visible = true; lbl_passwdEmpty.Text = "Password is empty"; lbl_passwdEmpty.ForeColor = Color.Red; pnl_pass.BackgroundImage = (Image)CommonControls.Properties.Resources.ng; txtPassword.Focus(); isError = true; } else { if (VALIDATION.isSpecialChars(txtPassword.Text)) { lbl_passwdEmpty.Visible = true; lbl_passwdEmpty.Text = "Password cannot contains special characters"; lbl_passwdEmpty.ForeColor = Color.Red; pnl_pass.BackgroundImage = (Image)CommonControls.Properties.Resources.ng; txtPassword.Focus(); isError = true; } } if (!isError) { if (isValidUser()) { USERNAME = txtUserName.Text; this.Hide(); Frm_Main MainForm = new Frm_Main(); MainForm.Show(); } else { lbl_invalidUser.Visible = true; lbl_invalidUser.Text = "Invalid userName or Password"; lbl_invalidUser.ForeColor = Color.Red; txtPassword.Text = String.Empty; txtUserName.Text = String.Empty; txtUserName.Focus(); } } } catch (Exception ex) { COMM_MESSAGE.exceptionMessage(ex.Message); } }
private bool checkInsertedItemData(List <Tuple <string, string> > userData) { bool isError = false; try { for (int i = 0; i < userData.Count; i++) { switch (userData[i].Item1) { case "itemCode": if (VALIDATION.isEmptyTextBox(userData[i].Item2)) { COM_MESSAGE.validationMessage("Item Code Cannot be Empty !!!"); isError = true; } else { if (!VALIDATION.isLetterAndNumberOnly(userData[i].Item2)) { COM_MESSAGE.validationMessage("Item Code should contains only Numbers !!!"); isError = true; } } break; case "itemName": if (VALIDATION.isEmptyTextBox(userData[i].Item2)) { COM_MESSAGE.validationMessage("Item Name Cannot be Empty !!!"); isError = true; } else { if (VALIDATION.isSpecialChars(userData[i].Item2)) { COM_MESSAGE.validationMessage("Item Name should not contains special characters !!!"); isError = true; } } break; case "altName": if (!VALIDATION.isEmptyTextBox(userData[i].Item2)) { if (VALIDATION.isSpecialChars(userData[i].Item2)) { COM_MESSAGE.validationMessage("Alternative Name should not contains special characters !!!"); isError = true; } } break; case "itemType": if (VALIDATION.isEmptyTextBox(userData[i].Item2)) { COM_MESSAGE.validationMessage("Item Type Cannot be Empty !!!"); isError = true; } break; default: isError = true; break; } } } catch (Exception ex) { throw ex; } return(isError); }