示例#1
0
        private void gvWI_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            try
            {
                if (_IsNew)
                {
                    return;
                }

                if (gvWI.FocusedColumn != null && gvWI.GetFocusedRowCellValue("WIID") != null)
                {
                    if (int.TryParse(gvWI.GetFocusedRowCellValue("WIID").ToString(), out _WIIDValue))
                    {
                        ObjEArticle.WIID      = _WIIDValue;
                        txtWI.Text            = gvWI.GetFocusedRowCellValue("WI") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("WI").ToString();
                        txtWIDescription.Text = gvWI.GetFocusedRowCellValue("WIDescription") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("WIDescription").ToString();
                        txtFabrikat.Text      = gvWI.GetFocusedRowCellValue("Fabrikate") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("Fabrikate").ToString();
                        txtMasseinheit.Text   = gvWI.GetFocusedRowCellValue("Masseinheit") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("Masseinheit").ToString();
                        txtDimension.Text     = gvWI.GetFocusedRowCellValue("Dimension") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("Dimension").ToString();
                        cmbME.SelectedIndex   = cmbME.Properties.Items.IndexOf(gvWI.GetFocusedRowCellValue("Menegenheit") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("Menegenheit").ToString());
                        txtremark.Text        = gvWI.GetFocusedRowCellValue("Remarks") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("Remarks").ToString();
                        txtTextKZ.Text        = gvWI.GetFocusedRowCellValue("TextKZ") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("TextKZ").ToString();
                        txtDatanormNr.Text    = gvWI.GetFocusedRowCellValue("DataNormNumber") == DBNull.Value ? "" : gvWI.GetFocusedRowCellValue("DataNormNumber").ToString();
                        lblArticle.Text       = "Artikelübersicht zu : " + txtWG.Text + "/" + txtWA.Text + "/" + txtWI.Text;
                        BindDimensions(_WIIDValue);
                        DArticles Obj = new DArticles();
                        Obj.GetTypByWIID(ObjEArticle);
                        gcTyp.DataSource = ObjEArticle.dtTyp;
                        gvTyp.BestFitColumns();
                        Utility.Setfocus(gvTyp, "RTID", ObjEArticle.RTID);
                    }
                }
                else
                {
                    gcDimensions.DataSource = null;
                    gcTyp.DataSource        = null;
                }
            }
            catch (Exception ex)
            {
                Utility.ShowError(ex);
            }
        }