예제 #1
0
        private void GrdView_CellValueChanged(object sender, DevExpress.Xpf.Grid.CellValueChangedEventArgs e)
        {
            var row = e.Row as ProdutosDTO;

            new Thread(() =>
            {
                Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
                {
                    if (e.Column.FieldName.ToString() == "Anotacoes")
                    {
                        dto.Id = row.Id;
                        if (row.Anotacoes != null)
                        {
                            dto.Anotacoes = row.Anotacoes.Replace("'", "''").ToUpper();
                        }
                        else
                        {
                            dto.Anotacoes = "";
                        }
                        bll.P_UpdateAnotacoes(dto);
                    }
                    else if (e.Column.FieldName.ToString() == "Partnumber")
                    {
                        dto.Id = row.Id;
                        if (row.Partnumber != null)
                        {
                            dto.Partnumber = row.Partnumber.Replace("'", "''").ToUpper();
                        }
                        else
                        {
                            dto.Partnumber = "";
                        }
                        bll.P_UpdatePartnumber(dto);
                    }
                    else if (e.Column.FieldName.ToString() == "Ncm")
                    {
                        dto.Id = row.Id;
                        if (row.Ncm != null)
                        {
                            dto.Ncm = row.Ncm.Replace("'", "''").ToUpper();
                        }
                        else
                        {
                            dto.Ncm = "";
                        }
                        bll.P_UpdateNcm(dto);
                    }
                    else if (e.Column.FieldName.ToString() == "Custo")
                    {
                        dto.Id    = row.Id;
                        dto.Custo = row.Custo;
                        bll.P_UpdateCusto(dto);
                    }
                    else if (e.Column.FieldName.ToString() == "Ipi")
                    {
                        dto.Id  = row.Id;
                        dto.Ipi = row.Ipi;
                        bll.P_UpdateIpi(dto);
                    }
                    else if (e.Column.FieldName.ToString() == "Icms")
                    {
                        dto.Id   = row.Id;
                        dto.Icms = row.Icms;
                        bll.P_UpdateIcms(dto);
                    }
                }));
            }).Start();
        }