Ejemplo n.º 1
0
        private void Init(DataTable dt, string text)
        {
            InitializeComponent();


            try
            {
                //ned to remove
                // ds = new GeneralFunctions("dcb", "dcb").GetTestData();
                ///ned to remove
                ///
                int colCnt = dt.Columns.Count;

                selectedRowData = new object[colCnt];

                if (colCnt > 0)
                {
                    for (int i = 0; i < colCnt; i++)
                    {
                        string actText = dt.Columns[i].Caption;
                        selectedRowData[i] = actText;
                        string newText = getFormatedColumnName(actText);
                        dt.Columns[i].ColumnName = newText;
                    }
                }

                this.dt    = dt;
                this.Text += " _ " + text;
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
Ejemplo n.º 2
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         this.DialogResult = DialogResult.Cancel;
         this.Dispose();
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
Ejemplo n.º 3
0
 private void dgvSearch_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyData == Keys.Return)
         {
             selectRow(dgvSearch.CurrentRow.Index);
         }
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
Ejemplo n.º 4
0
        //private void dgvSearch_Sorted(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        new ApplicationSettings().SetColuredGridsRows(ref dgvSearch);
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageView.ExceptionError(ex);
        //    }
        //}


        private void dgvSearch_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex > -1)
                {
                    selectRow(e.RowIndex);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
Ejemplo n.º 5
0
        public static void setBhikkuPictureFromByteArray(byte[] picData, PictureBox picBox)
        {
            try
            {
                // set byte array
                MemoryStream mem = new MemoryStream(picData);
                // bikkuImage = picData;

                Image img = Image.FromStream(mem);
                picBox.Image = DBCore.Utility.getThumbImage(img, picBox.Width, picBox.Height);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
Ejemplo n.º 6
0
 private void btnSelect_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvSearch.SelectedRows.Count > 0)
         {
             selectRow(dgvSearch.CurrentRow.Index);
         }
         else
         {
             this.DialogResult = DialogResult.Cancel;
             MessageView.ShowWarningMsg("Please select a row");
         }
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
Ejemplo n.º 7
0
        private void selectRow(int index)
        {
            try
            {
                this.DialogResult = DialogResult.OK;

                //set selected data
                Hashtable htbl = new Hashtable();
                for (int i = 0; i < selectedRowData.Length; i++)
                {
                    htbl.Add(selectedRowData[i].ToString(), dgvSearch[i, index].Value);
                }

                DataRowValues = htbl;
                this.Hide();
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
Ejemplo n.º 8
0
        private void frmSearch_Load(object sender, EventArgs e)
        {
            try
            {
                if (dt.Rows.Count == 0)
                {
                    MessageView.ShowWarningMsg("No record(s) found");
                    this.Dispose();
                }
                dgvSearch.DataSource = dt;

                // hide extra fields

                for (int i = 0; i < dgvSearch.Columns.Count; i++)
                {
                    if (maxColumnCount < (i + 1))
                    {
                        dgvSearch.Columns[i].Visible = false;
                    }
                }

                Utility.SetDatagridViewRow(dgvSearch);

                if (firstColWidth > 0 && dgvSearch.Columns.Count > 0)
                {
                    dgvSearch.Columns[0].Width = firstColWidth;
                }

                if (secondColWidth > 0 && dgvSearch.Columns.Count > 1)
                {
                    dgvSearch.Columns[1].Width = secondColWidth;
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }