Example #1
0
        private void saveToolStripButton_Click(object sender, EventArgs e)
        {
            int index = xtraTabControl_WORD_MNG_DETAY.SelectedTabPageIndex;

            if (index != -1)
            {
                var rtb = xtraTabControl_WORD_MNG_DETAY.TabPages[index].Controls[0];
                DevExpress.XtraGrid.GridControl grd_ = (DevExpress.XtraGrid.GridControl)rtb;
                System.Data.DataView            RW   = (System.Data.DataView)grd_.DataSource;
                SqlConnection con = new SqlConnection(_GLOBAL_PARAMETRELER._CONNECTION_STRING.ToString());
                con.Open();
                if (RW != null)
                {
                    TARIFELER._GLOBAL_TARIFELER WORD = new TARIFELER._GLOBAL_TARIFELER();
                    // SATIR SİL
                    RW.RowStateFilter = DataViewRowState.Deleted;
                    if (RW.Count != 0)
                    {
                        for (int i = 0; i <= RW.Count - 1; i++)
                        {
                            DataRow DR = RW[i].Row;
                            WORD.KEYWORD_ROW_DELETE(con, DR, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Name, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Tag.ToString());
                        }
                    }

                    // Yeni eklenmiş Satırları kaydet
                    RW.RowStateFilter = DataViewRowState.Added;
                    if (RW.Count != 0)
                    {
                        for (int i = 0; i <= RW.Count - 1; i++)
                        {
                            DataRow DR = RW[i].Row;
                            WORD.KEYWORD_ROW_ADD(con, DR, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Name, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Tag.ToString());
                        }
                    }
                    // SATIR GUNCELLE
                    RW.RowStateFilter = DataViewRowState.ModifiedOriginal;
                    if (RW.Count != 0)
                    {
                        for (int i = 0; i <= RW.Count - 1; i++)
                        {
                            DataRow DR = RW[i].Row;
                            if (DR["ID"].ToString() == "")
                            {
                                WORD.KEYWORD_ROW_ADD(con, DR, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Name, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Tag.ToString());
                            }
                            else
                            {
                                WORD.KEYWORD_ROW_UPDATE(con, DR, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Name, xtraTabControl_WORD_MNG_DETAY.SelectedTabPage.Tag.ToString());
                            }
                        }
                    }
                    RW.Table.AcceptChanges();
                    RW.RowStateFilter = DataViewRowState.CurrentRows;
                }
            }
        }