Exemple #1
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.SelectedCells.Count > 0)
            {
                DataGridViewColumn col = gv.Columns[gv.SelectedCells[0].ColumnIndex];

                if (col.DataGridView.SelectedCells.Count > 0 && gv.SelectedCells[0].Selected)
                {
                    DataGridViewRow dr = gv.SelectedCells[0].OwningRow;
                    int             id = -1;
                    id = int.Parse(dr.Cells[LetterEntity.FIELD_ID].Value.ToString());
                    if (!_selectMode)
                    {
                        LetterForm form = new LetterForm((int)gv.Tag);
                        form.LetterId = id;
                        form.initLetter();
                        form.ShowDialog();
                        if (form.DataChanged)
                        {
                            fillGrid();
                        }
                    }
                    else
                    {
                        _returnLetterId = id;
                        this.Close();
                    }
                }
            }
        }
Exemple #2
0
        private void grid_DoubleClick(object sender, EventArgs e)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.SelectedCells.Count > 0)
            {
                DataGridViewColumn col = gv.Columns[gv.SelectedCells[0].ColumnIndex];

                if (col.DataGridView.SelectedCells.Count > 0 && gv.SelectedCells[0].Selected)
                {
                    DataGridViewRow dr = gv.SelectedCells[0].OwningRow;
                    int             id = -1;
                    if (gv.Tag.Equals(LetterBL.LETTER_TYPE_SEND))
                    {
                        id = int.Parse(dr.Cells[LetterEntity.FIELD_ID + "_1"].Value.ToString());
                    }
                    else
                    {
                        id = int.Parse(dr.Cells[LetterEntity.FIELD_ID].Value.ToString());
                    }
                    LetterForm form = new LetterForm((int)gv.Tag);
                    form.LetterId = id;
                    form.initLetter();
                    form.ShowDialog();
                    if (form.DataChanged)
                    {
                        FillGrids();
                    }
                }
            }
        }
Exemple #3
0
        private void letterGrid_DoubleClick(object sender, EventArgs e)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.SelectedCells.Count <= 0)
            {
                return;
            }

            DataGridViewColumn col = gv.Columns[gv.SelectedCells[0].ColumnIndex];

            bool isAnySelected = col.DataGridView.SelectedCells.Count > 0 && gv.SelectedCells[0].Selected;

            if (!isAnySelected)
            {
                return;
            }

            DataGridViewRow dr       = gv.SelectedCells[0].OwningRow;
            int             letterId = int.Parse(dr.Cells[0].Value.ToString());
            int             type     = _letterBL.getLetterType(letterId);

            LetterForm form = new LetterForm(type);

            form.LetterId = letterId;
            form.initLetter();
            form.ShowDialog();
        }
Exemple #4
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.SelectedCells.Count > 0)
            {
                DataGridViewColumn col = gv.Columns[gv.SelectedCells[0].ColumnIndex];

                if (col.DataGridView.SelectedCells.Count > 0 && gv.SelectedCells[0].Selected)
                {
                    DataGridViewRow dr = gv.SelectedCells[0].OwningRow;
                    int             id = -1;
                    if (dr.Cells[LetterEntity.FIELD_ID] == null || dr.Cells[LetterEntity.FIELD_ID].Value == null)
                    {
                        return;
                    }
                    id = int.Parse(dr.Cells[LetterEntity.FIELD_ID].Value.ToString());


                    LetterForm form = new LetterForm();
                    form.LetterId = id;
                    form.initLetter();
                    form.ShowDialog();
                }
            }
        }
Exemple #5
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            LetterForm form = new LetterForm();

            form.LetterType = LetterType;
            form.initLetter();
            form.LetterId = -1;
            form.ShowDialog();
            if (form.DataChanged)
            {
                fillGrid();
            }
        }
Exemple #6
0
        private void btnLetter_Click(object sender, EventArgs e)
        {
            LetterBL     letterBl     = new LetterBL();
            LetterEntity letterEntity = letterBl.getByLetterNumber(txtLetterNumber.Text);


            LetterForm form = new LetterForm();

            form.LetterType = int.Parse(letterEntity.get(LetterEntity.FIELD_LETTER_TYPE).ToString());
            form.LetterId   = (int)letterEntity.get(LetterEntity.FIELD_ID);
            form.readOnly   = true;
            form.initLetter();
            form.ShowDialog();
        }
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count <= 0)
            {
                return;
            }
            int letterid = (int)(dataGridView1.SelectedRows[0].Cells[4].Value);

            LetterEntity entity = _letterBL.getByLetterId(letterid);

            int        letterType = int.Parse(entity.get(LetterEntity.FIELD_LETTER_TYPE).ToString());
            LetterForm form       = new LetterForm(letterType);

            form.LetterId     = letterid;
            form.LetterEntity = entity;
            form.initLetter();
            form.ShowDialog();
            //if (form.DataChanged)
            //    FillGrids();
        }
Exemple #8
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            DataGridViewColumn col = dataGridView1.Columns[dataGridView1.SelectedCells[0].ColumnIndex];

            if (col.DataGridView.SelectedCells.Count > 0 && dataGridView1.SelectedCells[0].Selected)
            //if (dataGridView1.SelectedRows.Count > 0)
            {
                DataGridViewRow dr   = dataGridView1.SelectedCells[0].OwningRow;
                int             id   = int.Parse(dr.Cells[LetterEntity.FIELD_ID].Value.ToString());
                LetterForm      form = new LetterForm();
                form.LetterType = LetterType;
                form.LetterId   = id;

                form.initLetter();
                form.ShowDialog();
                if (form.DataChanged)
                {
                    fillGrid();
                }
            }
        }
Exemple #9
0
        private void showLetter(object sender, string index)
        {
            DataGridView gv = (DataGridView)sender;

            if (gv.SelectedCells.Count > 0)
            {
                DataGridViewColumn col = gv.Columns[gv.SelectedCells[0].ColumnIndex];

                if (col.DataGridView.SelectedCells.Count > 0 && gv.SelectedCells[0].Selected)
                {
                    DataGridViewRow dr = gv.SelectedCells[0].OwningRow;
                    int             id = -1;
                    id = int.Parse(dr.Cells[LetterEntity.FIELD_ID + index].Value.ToString());
                    int        letterType = int.Parse(dr.Cells[LetterEntity.FIELD_LETTER_TYPE + index].Value.ToString());
                    LetterForm form       = new LetterForm(letterType);
                    form.LetterId = id;
                    //form.readOnly = true;
                    form.initLetter();
                    form.ShowDialog();
                }
            }
        }