private void logOffToolStripMenuItem_Click(object sender, EventArgs e) { try { DialogResult diaRes = MessageBox.Show("Do you want to log off?", GlobalVariables.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (diaRes == DialogResult.Yes) { //Form[] frmColl = this.MdiChildren; //foreach (Form frm in frmColl) //{ // if (frm != this) // { // frm.Close(); // } //} List <Form> openForms = new List <Form>(); foreach (Form f in Application.OpenForms) { openForms.Add(f); } //if (General.CheckFormIsOpenedORnot(typeof(FrmIndexingCuration).Name.ToUpper(), // objIndexingCur)) //{ // objIndexingCur.Close(); //} if (MdiChildren.Length == 0) { DisableMenu_SubMenuItems(); logInToolStripMenuItem.Enabled = true; logOffToolStripMenuItem.Enabled = false; //Reset User information tssLblUserNameValue.Text = ""; tsslRoleNameValue.Text = ""; tssLblDataBase.Text = ""; GlobalVariables.UserName = ""; GlobalVariables.RoleName = ""; GlobalVariables.UrId = 0; GlobalVariables.UserName = string.Empty; GlobalVariables.RoleName = string.Empty; GlobalVariables.RoleId = 0; GlobalVariables.UserID = 0; GlobalVariables.UrId = 0; GlobalVariables.IsLoginSuccess = false; //msMainMenu.Enabled = false; logInToolStripMenuItem_Click(null, null); } } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.Message); } }
private void btnCreateRxn_Click(object sender, EventArgs e) { try { DataTable dtReactions = null; int newRxnSNo = 0; if (cmbRxnNo.SelectedItem != null) { int selRxnNo = Convert.ToInt32(cmbRxnNo.Text); newRxnSNo = rbnAfter.Checked ? selRxnNo + 1 : selRxnNo; } else if (ReactionsTbl.Rows.Count == 0) { newRxnSNo = 1; } if (!chkDuplicateWithRxn.Checked)//New Reaction { ReactionInfo rxnInfo = new ReactionInfo(); rxnInfo.ShipmentRefID = ShipmentRefID; rxnInfo.ReactionSNo = newRxnSNo; rxnInfo.UR_ID = GlobalVariables.UR_ID; if (ReactionCurationDB.SaveReactionInfo(DmlOperations.INSERT, rxnInfo, out dtReactions)) { ReactionsTbl = dtReactions; DialogResult = System.Windows.Forms.DialogResult.OK; var query = from r in dtReactions.AsEnumerable() where r.Field <Int64>("REACTION_SNO") == newRxnSNo select new { NewRxn_Id = r["REACTION_ID"] }; if (query != null) { NewRxnID = Convert.ToInt32(query.ElementAt(0).NewRxn_Id); NewRxnSNo = newRxnSNo; } DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show("Error in adding new reaction", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else //Duplicate Reaction { DialogResult diaRes = MessageBox.Show("Do you want to duplicate the reaction?", GlobalVariables.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (diaRes == System.Windows.Forms.DialogResult.Yes) { int dupRxnID = cmbDuplicateWithRxn.SelectedItem != null?Convert.ToInt32(cmbDuplicateWithRxn.SelectedValue) : 0; int newRxnID = ReactionCurationDB.DuplicateReactionData(ShipmentRefID, dupRxnID, newRxnSNo, GlobalVariables.UR_ID); if (newRxnID > 0) { NewRxnID = newRxnID; NewRxnSNo = newRxnSNo; DuplicateRxn = true; DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show("Error in duplicating reaction", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }
private bool ValidateUserInputs(out string errMsg) { bool blStatus = true; string strErrMsg = ""; try { if (string.IsNullOrEmpty(cmbShipment.Text)) { strErrMsg = strErrMsg.Trim() + "\r\n" + "Please select shipment"; blStatus = false; } if (string.IsNullOrEmpty(txtFolderPath.Text)) { strErrMsg = strErrMsg.Trim() + "\r\n" + "Output files folder path can not be null"; blStatus = false; } if (dgvShipmentDocs.Rows.Count == 0) { strErrMsg = strErrMsg.Trim() + "\r\n" + "No TANs are available for export"; blStatus = false; } else { List <int> lstRefIds = GetSelectedReferencesFromGrid(); if (lstRefIds == null) { strErrMsg = strErrMsg.Trim() + "\r\n" + "No TANs selected for export"; blStatus = false; } else if (lstRefIds.Count == 0) { strErrMsg = strErrMsg.Trim() + "\r\n" + "No TANs selected for export"; blStatus = false; } //else if (lstSelTANs.Count == 0) //{ // strErrMsg = strErrMsg.Trim() + "\r\n" + "No TANs are selected for export"; // blStatus = false; //} else if (!ValidateSelectedDocsStatusForExport()) { strErrMsg = strErrMsg.Trim() + "\r\n" + "'NOT ASSIGNED' TANs are not eligible for export"; blStatus = false; } } if (string.IsNullOrEmpty(txtMDLNo.Text.Trim())) { strErrMsg = strErrMsg.Trim() + "\r\n" + "Strat MDL No. should be mentioned"; blStatus = false; } else { Int64 mdlNo = 0; if (!Int64.TryParse(txtMDLNo.Text.Trim(), out mdlNo)) { strErrMsg = strErrMsg.Trim() + "\r\n" + "Strat MDL No. should be integer"; blStatus = false; } } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } errMsg = strErrMsg.Trim(); return(blStatus); }