Ejemplo n.º 1
0
        private void extInfoDataGridView_CellValueChanged(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.Equals(null) || this.obeyEvnts == false ||
                this.canEdit == false)
            {
                return;
            }
            if (e.RowIndex < 0)
            {
                return;
            }
            if (this.canEdit == false)
            {
                cmnCde.showMsg("You don't have permission to perform" +
                               " this action!\nContact your System Administrator!", 0);
                return;
            }
            if (this.extInfoDataGridView.Rows[e.RowIndex].Cells[4].Value == null)
            {
                this.extInfoDataGridView.Rows[e.RowIndex].Cells[4].Value = "-1";
            }
            if (this.extInfoDataGridView.Rows[e.RowIndex].Cells[5].Value == null)
            {
                this.extInfoDataGridView.Rows[e.RowIndex].Cells[5].Value = "-1";
            }
            if (this.extInfoDataGridView.Rows[e.RowIndex].Cells[0].Value == null)
            {
                this.extInfoDataGridView.Rows[e.RowIndex].Cells[0].Value = string.Empty;
            }

            if (this.extInfoDataGridView.Rows[e.RowIndex].Cells[2].Value == null)
            {
                this.extInfoDataGridView.Rows[e.RowIndex].Cells[2].Value = string.Empty;
            }
            if (this.extInfoDataGridView.Rows[e.RowIndex].Cells[3].Value == null)
            {
                this.extInfoDataGridView.Rows[e.RowIndex].Cells[3].Value = string.Empty;
            }
            if (e.ColumnIndex == 2 || e.ColumnIndex == 3)
            {
                if (long.Parse(
                        this.extInfoDataGridView.Rows[e.RowIndex].Cells[5].Value.ToString()) > 0)
                {
                    cmnCde.updateRowOthrInfVal(this.ext_inf_tbl_name, long.Parse(
                                                   this.extInfoDataGridView.Rows[e.RowIndex].Cells[4].Value.ToString()),
                                               this.row_pk_id,
                                               this.extInfoDataGridView.Rows[e.RowIndex].Cells[3].Value.ToString(),
                                               this.extInfoDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString()
                                               , this.extInfoDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()
                                               , long.Parse(this.extInfoDataGridView.Rows[e.RowIndex].Cells[5].Value.ToString()));
                }
                else
                {
                    if (cmnCde.doesRowHvOthrInfo(this.ext_inf_tbl_name, long.Parse(
                                                     this.extInfoDataGridView.Rows[e.RowIndex].Cells[4].Value.ToString()), this.row_pk_id) > 0)
                    {
                        cmnCde.updateRowOthrInfVal(this.ext_inf_tbl_name, long.Parse(
                                                       this.extInfoDataGridView.Rows[e.RowIndex].Cells[4].Value.ToString()),
                                                   this.row_pk_id,
                                                   this.extInfoDataGridView.Rows[e.RowIndex].Cells[3].Value.ToString(),
                                                   this.extInfoDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString()
                                                   , this.extInfoDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()
                                                   , long.Parse(this.extInfoDataGridView.Rows[e.RowIndex].Cells[5].Value.ToString()));
                    }
                    else
                    {
                        long rwID = cmnCde.getNewExtInfoID(this.ext_inf_seq_name);

                        cmnCde.createRowOthrInfVal(this.ext_inf_tbl_name, long.Parse(
                                                       this.extInfoDataGridView.Rows[e.RowIndex].Cells[4].Value.ToString()),
                                                   this.row_pk_id,
                                                   this.extInfoDataGridView.Rows[e.RowIndex].Cells[3].Value.ToString(),
                                                   this.extInfoDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString()
                                                   , this.extInfoDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString(), rwID);
                        this.obeyEvnts = false;
                        this.extInfoDataGridView.EndEdit();
                        this.extInfoDataGridView.Rows[e.RowIndex].Cells[5].Value = rwID;
                        this.obeyEvnts = true;
                    }
                }
            }
        }