Beispiel #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvUsers.CurrentRow != null)
                {
                    if (dgvUsers.SortedColumn != null)
                    {
                        sortedColumn  = dgvUsers.SortedColumn;
                        sortDirection = dgvUsers.SortOrder;
                    }
                    frmCompanyEntry fUser = new frmCompanyEntry((int)Constant.Mode.Modify, (Int64)dgvUsers.CurrentRow.Cells["CompId"].Value);
                    fUser.ShowInTaskbar = false;
                    fUser.ShowDialog();
                    LoadList();


                    if (sortedColumn != null)
                    {
                        ListSortDirection LSD;
                        if (sortDirection == SortOrder.Ascending)
                        {
                            LSD = System.ComponentModel.ListSortDirection.Ascending;
                        }
                        else
                        {
                            LSD = System.ComponentModel.ListSortDirection.Descending;
                        }

                        dgvUsers.Sort(dgvUsers.Columns[sortedColumn.Name], LSD);
                    }
                    if (dgvUsers.CurrentRow != null && idgvPosition <= dgvUsers.RowCount)
                    {
                        if (dgvUsers.Rows.Count - 1 < idgvPosition)
                        {
                            dgvUsers.CurrentCell = dgvUsers.Rows[idgvPosition - 1].Cells[0];
                        }
                        else
                        {
                            dgvUsers.CurrentCell = dgvUsers.Rows[idgvPosition].Cells[0];
                        }
                    }
                    dgvUsers_SelectionChanged(sender, e);
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("CompanyInfo", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
        }
Beispiel #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            try
            {
                frmCompanyEntry fCompany = new frmCompanyEntry((int)Constant.Mode.Insert, 0);
                fCompany.ShowInTaskbar = false;
                fCompany.ShowDialog();
                LoadList();

                DataTable dtCompCount = new DataTable();
                dtCompCount = objList.ListOfRecord("usp_CompanyCount", null, "Company-Count");

                if (Convert.ToInt16(dtCompCount.Rows[0]["Company"].ToString()) >= 3)
                {
                    btnNew.Enabled = false;
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("Lead", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
        }