Esempio n. 1
0
        private void TransView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (m_bAns == false)
            {
                return;
            }

            int rowhandleva = TransView.GetDataSourceRowIndex(TransView.FocusedRowHandle);

            m_oCountry.CountryName = cCName;
            if (TransView.IsNewItemRow(TransView.FocusedRowHandle) == true)
            {
                int cId;
                cId    = m_oCountry.InsertCountry(m_oCountry.CountryName);
                m_bAns = false;
                TransView.SetRowCellValue(TransView.FocusedRowHandle, "CountryId", cId);
                m_bAns = true;
            }
            else
            {
                m_oCountry.CountryId = Convert.ToInt32(TransView.GetRowCellValue(TransView.FocusedRowHandle, "CountryId"));
                m_oCountry.UpdateCountry(m_oCountry.CountryId, m_oCountry.CountryName);
            }
            m_bEdit = false;
        }
Esempio n. 2
0
        private void toolStripDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (BsfGlobal.FindPermission("Vendor-Grade-Master-Delete") == false)
            {
                MessageBox.Show("No Rights to Vendor-Grade-Master-Delete");
                return;
            }

            if (TransView.FocusedRowHandle >= 0)
            {
                if (TransView.IsNewItemRow(TransView.FocusedRowHandle) == true)
                {
                    return;
                }
                if (TransView.FocusedRowHandle != TransView.RowCount - 2)
                {
                    return;
                }

                DialogResult reply = MessageBox.Show("Do you want Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (reply == DialogResult.Yes)
                {
                    int Id = 0;
                    Id = Convert.ToInt32(TransView.GetRowCellValue(TransView.FocusedRowHandle, "GradeId"));
                    m_oGrade.DeleteGrade(Id);
                    //grdTrans.Rows.RemoveAt(grdTrans.CurrentRow.Index);
                    TransView.DeleteRow(TransView.FocusedRowHandle);
                }
            }
        }
Esempio n. 3
0
        private void TransView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (m_bAns == true)
            {
                return;
            }

            int rowhandleva = TransView.GetDataSourceRowIndex(TransView.FocusedRowHandle);

            if (TransView.IsNewItemRow(TransView.FocusedRowHandle) == true)
            {
                int iID = m_lFBL.InsertFDesc(m_lFDescription);
                m_bAns = true;
                TransView.SetRowCellValue(TransView.FocusedRowHandle, "FeatureId", iID);
                m_bAns = false;
            }

            else
            {
                m_lFeatureId = Convert.ToInt32(TransView.GetRowCellValue(TransView.FocusedRowHandle, "FeatureId"));
                m_lFBL.UpdateFDesc(m_lFeatureId, m_lFDescription);
            }
        }
Esempio n. 4
0
        private void grdTrans_EditorKeyPress(object sender, KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (TransView.FocusedColumn.FieldName == "GradeName")
            {
                if (TransView.IsNewItemRow(TransView.FocusedRowHandle) == true)
                {
                    if (TransView.RowCount != 1)
                    {
                        if (Convert.ToInt32(TransView.GetRowCellValue(TransView.RowCount - 2, "TValue")) == 0.0)
                        {
                            e.Handled = true;
                            return;
                        }
                    }
                }
            }


            if (TransView.FocusedColumn.FieldName == "FValue")
            {
                e.Handled = true;
                return;
            }

            if (TransView.FocusedColumn.FieldName == "TValue")
            {
                if (TransView.IsNewItemRow(TransView.FocusedRowHandle) != true)
                {
                    if (TransView.FocusedRowHandle != TransView.RowCount - 2)
                    {
                        e.Handled = true;
                        return;
                    }
                }
            }



            if (TransView.FocusedColumn.FieldName == "TValue")
            {
                if (!char.IsNumber(e.KeyChar))
                {
                    e.Handled = true;
                }
                else
                {
                    e.Handled = false;
                }
                if (e.KeyChar == 8)
                {
                    e.Handled = false;
                }
            }



            if (e.KeyChar == '.')
            {
                char[] c   = (((System.Windows.Forms.TextBoxBase)(sender))).Text.ToString().ToCharArray();
                int    cnt = 1;
                foreach (char b in c)
                {
                    if (b == '.')
                    {
                        cnt += 1;
                    }
                }
                if (cnt > 1)
                {
                    e.Handled = true;
                }
                else
                {
                    e.Handled = false;
                }
            }

            if (TransView.FocusedColumn.FieldName == "TValue")
            {
                if (TransView.IsNewItemRow(TransView.FocusedRowHandle) != true)
                {
                    if (TransView.FocusedRowHandle != TransView.RowCount - 2)
                    {
                        e.Handled = true;
                        return;
                    }
                }
            }
        }