private void GetTANIds_AssignToTANTxtBox_AutoComplete() { try { int userID = Classes.Generic_PepsiLite.UserID; DataTable dtTanIDs = PepsiLiteDataAccess.DataOperations.RetrieveTANIDS(userID); if (dtTanIDs != null) { if (dtTanIDs.Rows.Count > 0) { AutoCompleteStringCollection tancollection = new AutoCompleteStringCollection(); for (int i = 0; i < dtTanIDs.Rows.Count; i++) { if (dtTanIDs.Rows[i][0] != null) { tancollection.Add(dtTanIDs.Rows[i][0].ToString()); } } Generic.AutoCompleteCol.TANcollection = tancollection; txtTANNumber_Qry.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtTANNumber_Qry.AutoCompleteSource = AutoCompleteSource.CustomSource; txtTANNumber_Qry.AutoCompleteCustomSource = tancollection; } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private void GetStructureFromImage() { try { IDataObject clipData = Clipboard.GetDataObject(); if (clipData.GetDataPresent(DataFormats.Bitmap)) { Cursor = Cursors.WaitCursor; Image imgChemistry = Clipboard.GetImage(); string strMol_out = ""; bool blIsChiral_out = false; string strErrMsg_out = ""; if (ImageToStructure.GetStructureFromImage(imgChemistry, out strMol_out, out blIsChiral_out, out strErrMsg_out)) { chemRenditor.MolfileString = strMol_out; Cursor = Cursors.Default; } else { Cursor = Cursors.Default; MessageBox.Show(strErrMsg_out); } } Clipboard.Clear(); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } Cursor = Cursors.Default; }
private bool ValidateUserInputs(out string errmsg_out) { bool blValStatus = false; string strErrMsg = ""; try { if (chemRenditor_Trgt.MolfileString != null) { if (txtPageNo.Text.Trim() != "") { blValStatus = true; } else { strErrMsg = "Please enter Page Number"; } } else { strErrMsg = "Structure can not be null"; } errmsg_out = strErrMsg; return(blValStatus); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } errmsg_out = strErrMsg; return(blValStatus); }
private void btnSearch_Click(object sender, EventArgs e) { try { if (txtTANNumber_Qry.Text.Trim() != "") { if (Validations.IsValidTanNumber(txtTANNumber_Qry.Text.Trim())) { TANNumber = txtTANNumber_Qry.Text.Trim(); int intTAN_ID = PepsiLiteDataAccess.DataOperations.RetrieveTANID_ForTAN(txtTANNumber_Qry.Text.Trim()); string strSearchQry = GetSearchQuery(intTAN_ID); int intTotalRecCnt = PepsiLiteDataAccess.DataOperations.GetRecordCount_ForTAN(intTAN_ID); DataTable dtSrchRes = PepsiLiteDataAccess.DataOperations.RetrieveSearchResults(strSearchQry); if (dtSrchRes != null) { if (dtSrchRes.Rows.Count > 0) { pnlDups.Enabled = true; SearchResults = dtSrchRes; ToTalRecCnt = intTotalRecCnt; MaxRecCnt = dtSrchRes.Rows.Count; lblRecCnt.Text = dtSrchRes.Rows.Count.ToString() + " records out of " + ToTalRecCnt + " records"; currRecIndex = 1; //ReadMoleculeFromTable(currRecIndex - 1); numGoToRec.Minimum = 1; numGoToRec.Maximum = MaxRecCnt; numGoToRec.Value = 1; numGoToRec.Value = currRecIndex; } else { ClearUserInputs(); pnlDups.Enabled = false; MessageBox.Show("No records found for the search query", "No Records", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("Invalid TAN number", "Invalid TAN", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please enter TAN", "TAN is required", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private bool UpdateRecordInTable(int recindex, string molstring, double molweight, string molformula, int pagenum, string pagelabel, string examplenum, string iupacname, string enname, string inchikey) { bool blStatus = false; try { if (SearchResults != null) { if (recindex < SearchResults.Rows.Count) { SearchResults.Rows[recindex]["structure"] = molstring; SearchResults.Rows[recindex]["mol_weight"] = molweight; SearchResults.Rows[recindex]["mol_formula"] = molformula; SearchResults.Rows[recindex]["iupac_name"] = iupacname; SearchResults.Rows[recindex]["page_number"] = pagenum; SearchResults.Rows[recindex]["page_label"] = pagelabel; SearchResults.Rows[recindex]["example_number"] = examplenum; SearchResults.Rows[recindex]["table_number"] = examplenum; SearchResults.Rows[recindex]["en_name"] = enname; SearchResults.Rows[recindex]["inchi_key"] = inchikey; SearchResults.AcceptChanges(); blStatus = true; return(blStatus); } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(blStatus); }
private string GetSearchOperator(ComboBox _qryoperator, TextBox _qrytext, string _qrylabel) { string strSrchQry = ""; try { if (_qrytext.Text.Trim() != "") { string strCmbText = _qryoperator.SelectedItem.ToString(); switch (strCmbText.ToUpper()) { case "=": strSrchQry = _qrylabel + " = " + _qrytext.Text.Trim() + ""; break; case "!=": strSrchQry = _qrylabel + " != " + _qrytext.Text.Trim() + ""; break; case ">": strSrchQry = _qrylabel + " > " + _qrytext.Text.Trim() + ""; break; case ">=": strSrchQry = _qrylabel + " >= " + _qrytext.Text.Trim() + ""; break; case "<": strSrchQry = _qrylabel + " < " + _qrytext.Text.Trim() + ""; break; case "<=": strSrchQry = _qrylabel + " <= " + _qrytext.Text.Trim() + ""; break; case "EQUAL TO": strSrchQry = _qrylabel + " = '" + _qrytext.Text.Trim() + "'"; break; case "NOT EQUAL TO": strSrchQry = _qrylabel + " != '" + _qrytext.Text.Trim() + "'"; break; case "LIKE": strSrchQry = _qrylabel + " like '" + _qrytext.Text.Trim() + "%'"; break; case "NOT LIKE": strSrchQry = _qrylabel + " not like '" + _qrytext.Text.Trim() + "%'"; break; } return(strSrchQry); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(strSrchQry); }
private bool DeleteStructFromSearchResultTable(int tandtlsid, int currecindex) { bool blStatus = false; try { if (SearchResults != null) { if (SearchResults.Rows.Count > 0) { if (Convert.ToInt32(SearchResults.Rows[currecindex]["tan_dtl_id"]) == tandtlsid) { SearchResults.Rows[currecindex].Delete(); SearchResults.AcceptChanges(); blStatus = true; return(blStatus); } } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(blStatus); }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtNewSmiles.Text.Trim() != "") { if (txtCompName.Text.Trim() != "") { if (PepsiLiteDataAccess.DataOperations.UpdateDictCompSmilesDetails(txtCompName.Text.Trim(), txtNewSmiles.Text.Trim(), DateTime.Now, Classes.Generic_PepsiLite.UserID)) { MessageBox.Show("Record updated successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Record not updated", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please enter compound name", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please enter SMILES", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private static int GetRgroupNumFromRGroupName(string _rgrpname) { int rgrpNum = 0; try { if (_rgrpname.Trim() != "") { string[] splitter = { "R" }; string[] strVals = _rgrpname.Trim().Split(splitter, StringSplitOptions.RemoveEmptyEntries); if (strVals != null) { if (strVals.Length > 0) { rgrpNum = Convert.ToInt16(strVals[0]); return(rgrpNum); } } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(rgrpNum); }
private void btnAddToTable_Click(object sender, EventArgs e) { try { string strErrMsg = ""; if (ValidateUserInputs_TableLevel(out strErrMsg)) { //Convert Text Data to Data Table dtRgrpEnum = ConvertTextAndAddToTable(rtxtOCRData.Text, txtIdentifier.Text.Trim(), txtRGroups.Text.Trim()); dtGridTable.DataSource = dtRgrpEnum; DataTable dtSmiles = Enumeration.RgroupEnum.ConvertChemicalNameToSMILES_ChemDraw(dtRgrpEnum); dtGridSmiles.DataSource = dtSmiles; SMILESDataTbl = dtSmiles; tbCntrl_Data.TabPages[1].Show(); tbCntrl_Data.SelectedIndex = 1; } else { MessageBox.Show(strErrMsg, "Invalid user inputs", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (txtCompName.Text.Trim() != "") { if (PepsiLiteDataAccess.DataOperations.DeleteDictCompDetails(txtCompName.Text.Trim())) { MessageBox.Show("Record deleted successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No record found", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please enter compund name", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
public static DataTable CreateRGroupEnumTable(string _indetifier, string[] _rgrparr) { try { DataTable dtRgrpTbl = new DataTable(); if (_rgrparr != null) { if (_rgrparr.Length > 0) { dtRgrpTbl.Columns.Add(_indetifier, typeof(string)); for (int i = 0; i < _rgrparr.Length; i++) { dtRgrpTbl.Columns.Add(_rgrparr[i], typeof(string)); } } } return(dtRgrpTbl); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(null); }
private bool ValidateUserInputs(out string errmsg_out) { bool blValStatus = false; string strErrMsg = ""; try { if (txtCompName.Text.Trim() != "") { if (txtSmiles.Text.Trim() != "") { blValStatus = true; } else { strErrMsg = "Please enter SMILES"; } } else { strErrMsg = "Please enter compound name"; } errmsg_out = strErrMsg; return(blValStatus); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } errmsg_out = strErrMsg; return(blValStatus); }
private void btnRetrieve_Click(object sender, EventArgs e) { try { if (txtCompName.Text.Trim() != "") { string strSmiles = PepsiLiteDataAccess.DataOperations.RetrieveDictSmilesOnCompName(txtCompName.Text.Trim()); if (strSmiles != "") { txtSmiles.Text = strSmiles; } else { MessageBox.Show("No record found", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please enter compound name", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private void frmExportOpts_Load(object sender, EventArgs e) { try { if (AvailProps != null) { if (AvailProps.Count > 0) { for (int i = 0; i < AvailProps.Count; i++) { lstAvailProp.Items.Add(AvailProps[i].ToString()); } availList = AvailProps; selList.Add("Structure"); lstSelProp.Items.Add("Structure"); } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private void btnWriteXml_Click(object sender, EventArgs e) { try { if (lstSelTANs.SelectedItems.Count > 0) { if (txtFolderPath.Text.Trim() != "") { FolderName = txtFolderPath.Text.Trim(); SelectedTANs = selList; this.Close(); } else { MessageBox.Show("Please specify folder path"); } } else { MessageBox.Show("Please select atleast one TAN"); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private ArrayList GetRgroupsFromCoreMolecule(string _rCoreMol) { ArrayList lstRGroups = new ArrayList(); try { if (_rCoreMol != "") { MolHandler mHandler = new MolHandler(_rCoreMol); Molecule objMol = mHandler.getMolecule(); MolAtom mAtom = null; int intRgrpId = 0; for (int i = 0; i < objMol.getAtomCount(); i++) { mAtom = objMol.getAtom(i); intRgrpId = mAtom.getRgroup(); if (intRgrpId > 0) { if (!lstRGroups.Contains("R" + intRgrpId)) { lstRGroups.Add("R" + intRgrpId); } } } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(lstRGroups); }
private void btnSelAll_Click(object sender, EventArgs e) { try { if (lstAvailProp.Items.Count > 0) { for (int i = 0; i < lstAvailProp.Items.Count; i++) { if (lstAvailProp.Items[i].ToString() != "Structure") { AddItem(lstAvailProp.Items[i].ToString()); } } lstAvailProp.DataSource = null; lstAvailProp.DataSource = availList; lstSelProp.DataSource = null; lstSelProp.DataSource = selList; } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private void btnSubmit_Click(object sender, EventArgs e) { try { string strErrMsg = ""; if (ValidateUserInputs(out strErrMsg)) { if (PepsiLiteDataAccess.DataOperations.UpdateUserDetails(txtUserName.Text.Trim(), txtPassword.Text.Trim(), txtnewPassword.Text.Trim(), Classes.Generic_PepsiLite.UserRole)) { if (MessageBox.Show("Password updated successfully") == DialogResult.OK) { this.Close(); } } else { MessageBox.Show("Error in update"); } } else { MessageBox.Show(strErrMsg, "Invalid user inputs", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private bool DelelteRecordFromTable(int recindex) { bool blStatus = false; try { if (MolDataTbl != null) { if (MolDataTbl.Rows.Count > 0) { if (recindex < MolDataTbl.Rows.Count) { MolDataTbl.Rows[recindex].Delete(); MolDataTbl.AcceptChanges(); blStatus = true; return(blStatus); } } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(blStatus); }
public bool ReadMoleculeFromTable(int recindex) { bool blStatus = false; try { if (EnumResultsTbl != null) { if (EnumResultsTbl.Rows.Count > 0 && (recindex < EnumResultsTbl.Rows.Count)) { chemRenditor_Results.MolfileString = EnumResultsTbl.Rows[recindex]["structure"].ToString(); txtMolFileNo.Text = (recindex + 1).ToString(); blStatus = true; return(blStatus); } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(blStatus); }
private void OpenPdfFile() { try { openFileDialog1.Filter = "PDF|*.pdf"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string strFileName = openFileDialog1.FileName; if (strFileName.Trim() != "") { txtFileName.Text = strFileName; pnlPdf.Enabled = true; pdfDocBrow.IsAccessible = true; pdfDocBrow.LoadFile(strFileName); pdfDocBrow.Visible = true; } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
public static Molecule AddRGrpMolToCoreMolecule(RgMolecule _rgMol, Molecule _coreMol, int _rgrpNum) { try { //Get RGroup position int rgrpPos = GetRGroupPosition(_coreMol, _rgrpNum); //Get Radical position int radPos = GetRadicalPosition(_rgMol); //Add Rgroup Molecule to Core Molecule AddRGroupToCore(ref _coreMol, _rgMol); _coreMol.add(new MolBond(_coreMol.getAtom(rgrpPos).getBond(0).getAtom1(), _rgMol.getAtom(radPos))); _coreMol.removeNode(_coreMol.getNode(rgrpPos), CGraph.RMCLEANUP_ALL); _coreMol.clean(2, null, null); rgrpPos = GetRGroupPosition(_coreMol, _rgrpNum); _coreMol.removeNode(_coreMol.getNode(rgrpPos), CGraph.RMCLEANUP_ALL); _coreMol.clean(2, null, null); return(_coreMol); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(null); }
private ArrayList GetRGroupsFromDefinedTable(string _defRgrps) { ArrayList lstDefRgrps = new ArrayList(); try { if (_defRgrps.Trim() != "") { string[] splitter = { "," }; string[] strValArr = _defRgrps.Trim().Split(splitter, StringSplitOptions.RemoveEmptyEntries); if (strValArr != null) { if (strValArr.Length > 0) { for (int i = 0; i < strValArr.Length; i++) { if (!lstDefRgrps.Contains(strValArr[i])) { lstDefRgrps.Add(strValArr[i]); } } } } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(lstDefRgrps); }
private bool UpdateRecordInTable(int recindex, string molstring, string molweight, string molformula, string pagenum, string pagelabel, string examplenum, string iupacname, string enname) { bool blStatus = false; try { if (MolDataTbl != null) { if (recindex < MolDataTbl.Rows.Count) { MolDataTbl.Rows[recindex]["Structure"] = molstring; MolDataTbl.Rows[recindex]["MolWeight"] = molweight; MolDataTbl.Rows[recindex]["MolFormula"] = molformula; MolDataTbl.Rows[recindex]["IupacName"] = iupacname; MolDataTbl.Rows[recindex]["PageNumber"] = pagenum; MolDataTbl.Rows[recindex]["PageLabel"] = pagelabel; MolDataTbl.Rows[recindex]["ExampleNumber"] = examplenum; MolDataTbl.Rows[recindex]["EnName"] = enname; MolDataTbl.AcceptChanges(); blStatus = true; return(blStatus); } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } return(blStatus); }
private void btnSelOne_Click(object sender, EventArgs e) { try { if (lstAvailProp.Items.Count > 0) { if (lstAvailProp.SelectedItem != null) { if (lstAvailProp.SelectedItem.ToString() != "Structure") { AddItem(lstAvailProp.SelectedItem.ToString()); lstAvailProp.DataSource = null; lstAvailProp.DataSource = availList; lstSelProp.DataSource = null; lstSelProp.DataSource = selList; } } } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private void btnRunEnum_Click(object sender, EventArgs e) { try { string strErrMsg_out = ""; if (ValidateUserInputs(out strErrMsg_out)) { Cursor = Cursors.WaitCursor; //Generate R-Group Enumeration Results DataTable dtEnumData = Enumeration.RgroupEnum.GetRGroupEnumerationResults(SMILESDataTbl, chemRenditor.MolfileString); if (dtEnumData != null) { if (dtEnumData.Rows.Count > 0) { pnlEnumResults.Enabled = true; tbCntrl_Main.TabPages[1].Show(); tbCntrl_Main.SelectedIndex = 1; EnumResultsTbl = dtEnumData; numGoToRec.Minimum = 0; numGoToRec.Value = 0; numGoToRec.Maximum = 0; numGoToRec.Minimum = 1; numGoToRec.Maximum = dtEnumData.Rows.Count; numGoToRec.Value = 1; MaxRecCount = dtEnumData.Rows.Count; Cursor = Cursors.Default; } else { Cursor = Cursors.Default; MessageBox.Show("No Enumeration results"); } } else { Cursor = Cursors.Default; MessageBox.Show("No Enumeration results"); } } else { MessageBox.Show(strErrMsg_out, "In-valid user inputs", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }
private bool ValidateUserInputs(out string errmsg_out) { bool blValStatus = false; string strErrMsg = ""; try { if (chemRenditor.MolfileString != null) { if (txtIdentifier.Text.Trim() != "") { if (txtRGroups.Text.Trim() != "") { if (SMILESDataTbl != null) { if (SMILESDataTbl.Rows.Count > 0) { //Validate Drawn R-Groups and defined R-Groups if (ValidateDrawnAndDefinedRGroups(out strErrMsg)) { blValStatus = true; } } else { strErrMsg = "No Smiles Data table"; } } else { strErrMsg = "No Smiles Data table"; } } else { strErrMsg = "Please enter R-Groups"; } } else { strErrMsg = "Please enter Identifier"; } } else { strErrMsg = "Please draw R-Core structure"; } errmsg_out = strErrMsg; return(blValStatus); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } errmsg_out = strErrMsg; return(blValStatus); }
private bool ValidateUserInputs(out string errmsg_out) { bool blValStatus = false; string strErrMsg = ""; try { if (chemRenditor.MolfileString != null) { if (txtPageNo.Text.Trim() != "") { if (txtTANNo.Text.Trim() != "") { if (Validations.IsValidTanNumber(txtTANNo.Text.Trim())) { if (txtMolFileNo.Text.Trim() != "") { blValStatus = true; } else { strErrMsg = "Please enter Molfile number"; } } else { strErrMsg = "Not a Valid TAN number\r\nTAN format is 12345678A"; } } else { strErrMsg = "Please enter TAN Number"; } } else { strErrMsg = "Please enter Page Number"; } } else { strErrMsg = "Structure can not be a null"; } errmsg_out = strErrMsg; return(blValStatus); } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } errmsg_out = strErrMsg; return(blValStatus); }
private void frmQryDuplicates_Load(object sender, EventArgs e) { try { ucCheckDuplicates1.pnlDups.Enabled = false; } catch (Exception ex) { ErrorHandling_NTS.WriteErrorLog(ex.ToString()); } }