private void ListVendorsDGView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (PrivilegesManager.GetEventStatues(Calcium_RMS.Events.EditVendors) == EventStatus.Permit) { if (e.RowIndex >= 0) { DataRow aVendorDataRow = VendorsMgmt.SelectVendorRowByName(ListVendorsDGView.Rows[e.RowIndex].Cells["Namecol"].Value.ToString()); if (aVendorDataRow == null) { ListVendorsBtn.PerformClick(); } else { EditVendor aEditVendor = new EditVendor(); aEditVendor.TopMost = true; aEditVendor.UpdateVariables(aVendorDataRow); aEditVendor.Show(); } } } else { MessageBox.Show(MsgTxt.PrivUserNotAllowedTxt, MsgTxt.InformationCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListVendors:ListVendorsDGView_CellDoubleClick()] \n Exception: \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
private void ItemsPerPageBtn_Click(object sender, EventArgs e) { try { int TestParser; ListVendorsBtn.PerformClick(); if (int.TryParse(ItemsPerPageTxtBox.Text, out TestParser) && aVendorTable != null) { if (TestParser > 0 && ListVendorsDGView.Rows.Count > 0) { ItemsPerPage = TestParser; if (ItemsPerPage < 100) { pagesnumber = (int)aVendorTable.Rows.Count / ItemsPerPage; if ((double.Parse(aVendorTable.Rows.Count.ToString()) / ItemsPerPage - int.Parse(aVendorTable.Rows.Count.ToString()) / ItemsPerPage) > 0) { pagesnumber++; } PageOfTotalTxtBox.Text = "1/" + pagesnumber.ToString(); page(1); } else { MessageBox.Show(MsgTxt.ShouldNotBeLessThanTxt + " 100", MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListVendors:ItemsPerPageBtn_Click()] \n Exception: \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }