public static string GetStructureInchiKey(string _molfilestring) { string strInchiKey = "Inchi Not generated"; try { MolHandler mHandler = new MolHandler(_molfilestring); Molecule mol = mHandler.getMolecule(); try { strInchiKey = mol.toFormat("inchi:key"); } catch //Exception is inchi not generated { // if inchi not generated SetMolAbsStereo_Inchi_NotGenerated(ref mol); strInchiKey = mol.toFormat("inchi:key"); } if (strInchiKey != "") { strInchiKey = Validations.GetInchiKeyFromInchiString(strInchiKey); } return(strInchiKey); } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(strInchiKey); }
private void cmbPhase_SelectedIndexChanged(object sender, EventArgs e) { try { //Shipment details if (cmbPhase.SelectedItem != null) { DataTable dtShipmentDetails = DataOperations.GetShipmentDetailsOnPhase(cmbPhase.SelectedItem.ToString()); if (dtShipmentDetails != null) { if (dtShipmentDetails.Rows.Count > 0) { ArrayList lstShipDtls = Validations.GetArrayListFromDataTable(dtShipmentDetails, 0); cmbShipment.DataSource = lstShipDtls; cmbShipment.SelectedIndex = 0; } } } GetTANsAndBindToControl(); } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(blStatus); }
private void frmCreateUser_Load(object sender, EventArgs e) { try { DataTable dtUserRoles = DataOperations.GetUserRoles(); if (dtUserRoles != null) { if (dtUserRoles.Rows.Count > 0) { cmbUserRoles.DataSource = Validations.GetArrayListFromDataTable(dtUserRoles, 1); cmbUserRoles.SelectedIndex = 1; } } DataTable dtUserDetails = PepsiLiteDataAccess.DataOperations.RetrieveUserDetails(); if (dtUserDetails != null) { if (dtUserDetails.Rows.Count > 0) { dtGrid_Users.DataSource = dtUserDetails; } } } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private void btnDelOne_Click(object sender, EventArgs e) { try { if (dtGridSelTANs.Rows.Count > 0) { if (dtGridSelTANs.SelectedRows.Count > 0) { DataTable dtAvailTans = AvailTANsTbl; int seltan_out = 0; for (int i = 0; i < dtGridSelTANs.SelectedRows.Count; i++) { dtAvailTans.ImportRow(GetSelectedRowFromSelectedTANSTable(dtGridSelTANs.SelectedRows[i].Cells[0].Value.ToString().ToString(), out seltan_out)); SelectedTANsTbl.Rows[seltan_out].Delete(); } SelectedTANsTbl.AcceptChanges(); AvailTANsTbl = dtAvailTans; dtGrid_TANs.DataSource = null; dtGrid_TANs.DataSource = AvailTANsTbl; dtGridSelTANs.DataSource = null; dtGridSelTANs.DataSource = SelectedTANsTbl; } } } catch (Exception ex) { PepsiLiteErrorHandling.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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(rgrpNum); }
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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
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) { PepsiLiteErrorHandling.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.GetTANRecordCount(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) { PepsiLiteErrorHandling.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) { PepsiLiteErrorHandling.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) { PepsiLiteErrorHandling.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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(blStatus); }
public static DataTable CreateTANDetailsTable() { DataTable dtStructData = new DataTable(); try { dtStructData.Columns.Add("tan_dtl_id", typeof(Int32)); dtStructData.Columns.Add("structure", typeof(object)); dtStructData.Columns.Add("mol_weight", typeof(double)); dtStructData.Columns.Add("mol_formula", typeof(string)); dtStructData.Columns.Add("iupac_name", typeof(string)); dtStructData.Columns.Add("page_number", typeof(int)); dtStructData.Columns.Add("page_label", typeof(string)); dtStructData.Columns.Add("example_number", typeof(string)); dtStructData.Columns.Add("en_name", typeof(string)); dtStructData.Columns.Add("table_number", typeof(string)); dtStructData.Columns.Add("inchi_key", typeof(string)); return(dtStructData); } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(dtStructData); }
private static void SetMolAbsStereo_Inchi_NotGenerated(ref Molecule _molobj) { try { int atno = 0; MolAtom ma = null; for (int i = 0; i < (_molobj.getAtomCount() - 1); i++) { atno = _molobj.getAtom(i).getAtno(); if (atno > 109) { ma = _molobj.getAtom(i); ma.setAtno(6); } } bool flag1 = _molobj.ungroupSgroups(); bool flag2 = _molobj.hydrogenize(false); if (_molobj.isAbsStereo()) { _molobj.setAbsStereo(true); } _molobj.aromatize(false); } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private string GetSearchQuery() { string strSrchQry = ""; try { strSrchQry = "select phase_date,phase_name,shipment_name,tan from pepsilite.phase_shipment_tan where phase_date = '" + dateTimePicker1.Value + "' "; //Phase Name if (txtPhaseName.Text.Trim() != "") { strSrchQry = strSrchQry + " and phase_name = '" + txtPhaseName.Text.Trim() + "' "; } //Shipment name if (txtShipment.Text.Trim() != "") { strSrchQry = strSrchQry + " and shipment_name = '" + txtShipment.Text.Trim() + "';"; } return(strSrchQry); } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(strSrchQry); }
private void GetTANIds_AssignToTANTxtBox_AutoComplete() { try { int userID = Generic.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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
//static Standardizer objStnd = new Standardizer(new File(@"C:\Documents and Settings\sairam.punyamantula\Desktop\stand.xml")); 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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(null); }
private void txyCompName_TextChanged(object sender, EventArgs e) { try { if (txyCompName.Text.Trim() != "") { if (_dtDictTbl != null) { if (_dtDictTbl.Rows.Count > 0) { DataView dtView = new DataView(_dtDictTbl); dtView.RowFilter = "Compound LIKE '" + txyCompName.Text.Trim() + "*'"; dtGridDict.DataSource = dtView; } } } else { dtGridDict.DataSource = _dtDictTbl; } } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private void cntMnuStrip_Opening(object sender, CancelEventArgs e) { try { DisableContextMenuItems(); string strUserRole = Generic.Generic_PepsiLite.UserRole.ToUpper(); switch (strUserRole) { case "CURATOR": curationCompletedToolStripMenuItem.Visible = true; break; case "REVIEWER": reviewCompletedToolStripMenuItem.Visible = true; break; case "TEAM LEAD": tANCompletedToolStripMenuItem.Visible = true; break; } } catch (Exception ex) { PepsiLiteErrorHandling.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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private void btnRetrieve_Click(object sender, EventArgs e) { try { if (txtCompName.Text.Trim() != "") { string strSmiles = PepsiLiteDataAccess.DataOperations.GetDictSmilesOnCompName(txtCompName.Text.Trim()); if (strSmiles != "") { txtSmiles.Text = strSmiles; } else { MessageBox.Show("No record found", "Retrieve", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please enter compound name", "Retrieve", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private void btnSubmit_Click(object sender, EventArgs e) { try { string strErrMsg = ""; if (ValidateUserInputs(out strErrMsg)) { string strOldPwd_Enc = Encryption.EncriptDecript.Encrypt(txtPassword.Text.Trim()); string strNewPwd_Enc = Encryption.EncriptDecript.Encrypt(txtnewPassword.Text.Trim()); if (PepsiLiteDataAccess.DataOperations.UpdateUserDetails(txtUserName.Text.Trim(), strOldPwd_Enc, strNewPwd_Enc, Generic.Generic_PepsiLite.UserRoleID)) { 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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(blStatus); }
private DataRow GetSelectedRowFromSelectedTANSTable(string _tannumber, out int _rowindex_out) { try { if (SelectedTANsTbl != null) { if (SelectedTANsTbl.Rows.Count > 0) { DataRow dtRow = null; for (int i = 0; i < SelectedTANsTbl.Rows.Count; i++) { if (SelectedTANsTbl.Rows[i][0].ToString() == _tannumber) { dtRow = SelectedTANsTbl.Rows[i]; _rowindex_out = i; return(dtRow); } } } } } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } _rowindex_out = 0; return(null); }
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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private void GetTANsAndBindToControl() { try { //TANs on Phase,Shipment,userid and roleid if (cmbPhase.SelectedItem != null && cmbShipment.SelectedItem != null) { DataTable dtTANs = DataOperations.GetTANsOnPhase_Shipment_UID_RoleID(cmbPhase.SelectedItem.ToString(), cmbShipment.SelectedItem.ToString(), Generic.Generic_PepsiLite.UserID, Generic.Generic_PepsiLite.UserRoleID); if (dtTANs != null) { if (dtTANs.Rows.Count > 0) { AvailTANsTbl = dtTANs; dtGrid_TANs.DataSource = AvailTANsTbl; } else { AvailTANsTbl = null; dtGrid_TANs.DataSource = AvailTANsTbl; } } } } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } }
private void btnRetrieve_Click(object sender, EventArgs e) { try { string strSrchQry = GetSearchQuery(); if (strSrchQry != "") { DataTable dtPhaseDtls = DataOperations.RetrieveSearchResults(strSrchQry); if (dtPhaseDtls != null) { if (dtPhaseDtls.Rows.Count > 0) { dtGridPDetails.DataSource = dtPhaseDtls; } else { MessageBox.Show("No data found", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("No data found", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { PepsiLiteErrorHandling.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) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } return(blStatus); }
private static Molecule StandardizeMolecule(Molecule mol, out bool ischiral_out) { Molecule molChem = null; bool blIsChiral = false; try { Standardizer molSdz = new Standardizer("absolutestereo:set"); molChem = molSdz.standardize(mol); blIsChiral = molChem.isAbsStereo(); #region Code Commented //string strDirPath = AppDomain.CurrentDomain.BaseDirectory.ToString(); //string strXmlPath = strDirPath + "chiral.xml"; //StandardizerConfiguration sconfing = new StandardizerConfiguration(); //sconfing.read(strXmlPath); //Standardizer sdz = sconfing.getStandardizer(); //molChem = sdz.standardize(mol); //Standardizer sdz = new Standardizer(new File(strXmlPath)); #endregion ischiral_out = blIsChiral; return(molChem); } catch (Exception ex) { PepsiLiteErrorHandling.WriteErrorLog(ex.ToString()); } ischiral_out = blIsChiral; return(molChem); }