Zbiór zmian 764 dla trunk

Pokaż
Ignoruj:
Data:
2009-07-22 14:39:49 (17 years ago)
Autor:
marek
Opis:

re #185

Lokalizacja:
trunk
Pliki:
1 dodane
4 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/BazaReklam/Classes/Helpers/ReklamaHelper.cs

    r750 r764  
    6868 
    6969        } 
     70 
     71        public static void AddUpdateIssueChange(double issueId, int currentIssueNumer, int newIssueNumber) 
     72        { 
     73            SqlConnection conn = null; 
     74            SqlCommand cmd = null; 
     75 
     76            try 
     77            { 
     78                conn = new SqlConnection(ConnString.getConnString().Value); 
     79                conn.Open(); 
     80                cmd = new SqlCommand("sp_AddUpdateIssueChange", conn); 
     81                cmd.CommandType = CommandType.StoredProcedure; 
     82                cmd.Parameters.AddWithValue("@issueId", issueId); 
     83                cmd.Parameters.AddWithValue("@currentIssueNumer", currentIssueNumer); 
     84                cmd.Parameters.AddWithValue("@newIssueNumber", newIssueNumber); 
     85                cmd.ExecuteNonQuery(); 
     86            } 
     87            finally 
     88            { 
     89                if (cmd != null) 
     90                    cmd.Dispose(); 
     91 
     92                if (conn != null && conn.State == ConnectionState.Open) 
     93                { 
     94                    conn.Close(); 
     95                    conn.Dispose(); 
     96                } 
     97            } 
     98 
     99        } 
    70100    } 
    71101} 
  • trunk/BazaReklam/KalendarzEmisji.cs

    r732 r764  
    99    public partial class KalendarzEmisji : Form 
    1010    { 
    11         //emisja, która ukazala sie w gazecie 
    12         public readonly string WYDANA = "wydana"; 
    13         //emisja, ktora sie dopiero ukaze 
    14         public readonly string NIEWYDANA = "niewydana"; 
    15         //emisja zafakturowana 
    16         public readonly string ZAFAKTUROWANA = "zafakturowana"; 
    17         //emisja zafakturowana i wydana 
    18         public readonly string ZAFAKTUROWANA_WYDANA = "zafakturowana_wydana"; 
    19         //emisja siê nie ukazala, ale jest w miesiacu, ktory jest juz zafakturowany 
    20         public readonly string MS_ZAFAKTUROWANY_NIEWYDANA = "zafakturowana_wydana"; 
    21         //emisja do zmiany 
    22         public readonly string DO_ZMIANY = "do_zmiany"; 
    23         //emisja do zmiany 
    24         public readonly string NOWA = "nowa"; 
    25  
    2611        string tytul; 
    2712 
     
    3722 
    3823        readonly short emisjaDoZmiany; 
    39         short nowaEmisja; 
     24        short? nowaEmisja; 
    4025 
    4126        int iloscEmisji; 
     
    4732        #region properties 
    4833 
    49         public short NowaEmisja 
     34        public short? NowaEmisja 
    5035        { 
    5136            get { return nowaEmisja; } 
     
    117102            nRDataGridView.CellValueChanged += nRDataGridView_CellValueChanged; 
    118103            nRDataGridView.CellContentClick += nRDataGridView_CellContentClicked; 
    119  
    120            // nRBindingSource.ResetBindings(false); 
    121104        } 
    122105 
     
    155138        private void zmienButton_Click(object sender, EventArgs e) 
    156139        { 
    157             foreach (REKLAMADataSet.UKAZE_SIE_W_NRRow r in emisje) 
    158             { 
    159                 if (r.RowState != DataRowState.Deleted) 
    160                 { 
    161                     if (r.Nr_Wydania == emisjaDoZmiany) 
    162                     { 
    163                         r.Nr_Wydania = nowaEmisja; 
    164                         r.EndEdit(); 
    165                         break; 
    166                     } 
    167                 } 
    168             } 
     140            //foreach (REKLAMADataSet.UKAZE_SIE_W_NRRow r in emisje) 
     141            //{ 
     142            //    if (r.RowState != DataRowState.Deleted) 
     143            //    { 
     144            //        if (r.Nr_Wydania == emisjaDoZmiany && nowaEmisja.HasValue) 
     145            //        { 
     146            //            r.Nr_Wydania = nowaEmisja.Value; 
     147            //            r.EndEdit(); 
     148            //            break; 
     149            //        } 
     150            //    } 
     151            //} 
     152            nowaEmisja = GetNewIssueNumber(); 
     153 
     154        } 
     155 
     156        private short? GetNewIssueNumber() 
     157        { 
     158            short? newIssueNumer = null; 
     159            bool? isIssueChecked; 
     160 
     161            foreach (DataGridViewRow row in nRDataGridView.Rows) 
     162            { 
     163                if (row.ReadOnly || (row.DefaultCellStyle.BackColor != Color.White && row.DefaultCellStyle.BackColor != Color.LightYellow)) continue; 
     164 
     165                isIssueChecked = (bool?)row.Cells[3].Value; 
     166                if (!isIssueChecked.HasValue || !isIssueChecked.Value) continue; 
     167 
     168                newIssueNumer = (short)row.Cells[0].Value; 
     169                break; 
     170            } 
     171 
     172            return newIssueNumer; 
    169173        } 
    170174 
    171175        private void nRDataGridView_CellContentClicked(object sender, DataGridViewCellEventArgs e) 
    172176        { 
    173             if (e.RowIndex >= 0) 
    174             { 
    175                 if (!nRDataGridView.Rows[e.RowIndex].ReadOnly) 
    176                 { 
    177                     if (e.ColumnIndex == 3) 
    178                     { 
    179                         if (nRDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor == Color.White) 
    180                         { 
    181                             if (emisjaDoZmiany != 0 && index != -1) 
    182                             { 
    183                                 nRDataGridView.Rows[index].Cells[3].Value = false; 
    184                                 nRDataGridView.Rows[index].DefaultCellStyle.BackColor = Color.White; 
    185                             } 
    186  
    187                             nowaEmisja = (short)nRDataGridView.Rows[e.RowIndex].Cells[0].Value; 
    188                             index = e.RowIndex; 
    189  
    190                             nRDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightYellow; 
    191                         } 
    192                         else 
    193                         { 
    194                             nowaEmisja = (short)nRDataGridView.Rows[e.RowIndex].Cells[0].Value; 
    195                             index = e.RowIndex; 
    196  
    197                             nRDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White; 
    198                         } 
    199  
    200                     } 
    201                 } 
     177            if (e.RowIndex < 0) return; 
     178 
     179            if (nRDataGridView.Rows[e.RowIndex].ReadOnly) return; 
     180 
     181            if (e.ColumnIndex != 3) return; 
     182 
     183            if (nRDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor == Color.White) 
     184            { 
     185                if (emisjaDoZmiany != 0 && index != -1) 
     186                { 
     187                    nRDataGridView.Rows[index].Cells[3].Value = false; 
     188                    nRDataGridView.Rows[index].DefaultCellStyle.BackColor = Color.White; 
     189                } 
     190 
     191                nowaEmisja = (short) nRDataGridView.Rows[e.RowIndex].Cells[0].Value; 
     192                index = e.RowIndex; 
     193 
     194                nRDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightYellow; 
     195            } 
     196            else 
     197            { 
     198                nowaEmisja = (short) nRDataGridView.Rows[e.RowIndex].Cells[0].Value; 
     199                index = e.RowIndex; 
     200 
     201                nRDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White; 
    202202            } 
    203203            nRDataGridView.EndEdit(); 
     
    206206        private void nRDataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) 
    207207        { 
    208             if (e.ColumnIndex == 3) 
    209             { 
    210                 if (((bool)nRDataGridView[e.ColumnIndex, e.RowIndex].Value)) 
    211                 { 
    212                     iloscEmisji++; 
    213                 } 
    214                 else 
    215                 { 
    216                     iloscEmisji--; 
    217                 } 
    218  
    219                 label2.Text = iloscEmisji.ToString(); 
    220             } 
     208            if (e.ColumnIndex != 3) return; 
     209 
     210            if (((bool) nRDataGridView[e.ColumnIndex, e.RowIndex].Value)) 
     211                iloscEmisji++; 
     212            else 
     213                iloscEmisji--; 
     214 
     215            label2.Text = iloscEmisji.ToString(); 
    221216        } 
    222217 
    223218        private void nRDataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) 
    224219        { 
    225             if (e.ListChangedType == ListChangedType.Reset) 
    226             { 
    227                 foreach (DataGridViewRow row in nRDataGridView.Rows) 
    228                 { 
    229                     row.DefaultCellStyle.BackColor = Color.White; 
    230  
    231                     row.Cells[2].Value = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames 
    232                         [(int)Convert.ToDateTime(row.Cells[1].Value).DayOfWeek]; 
    233  
    234                     DataRow[] table = emisje.Select("[Nr Wydania]=" + row.Cells[0].Value); 
    235  
    236                     if (table != null && table.Length > 0) 
     220            if (e.ListChangedType != ListChangedType.Reset) return; 
     221 
     222            foreach (DataGridViewRow row in nRDataGridView.Rows) 
     223            { 
     224                row.DefaultCellStyle.BackColor = Color.White; 
     225 
     226                row.Cells[2].Value = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames 
     227                    [(int) Convert.ToDateTime(row.Cells[1].Value).DayOfWeek]; 
     228 
     229                DataRow[] table = emisje.Select("[Nr Wydania]=" + row.Cells[0].Value); 
     230 
     231                if (table != null && table.Length > 0) 
     232                { 
     233                    row.ReadOnly = true; 
     234                    row.Cells[3].Value = true; 
     235                    row.DefaultCellStyle.BackColor = Color.WhiteSmoke; 
     236 
     237                    REKLAMADataSet.UKAZE_SIE_W_NRRow em = 
     238                        (REKLAMADataSet.UKAZE_SIE_W_NRRow) table[0]; 
     239 
     240                    if (Convert.ToDateTime(row.Cells[1].Value) < DateTime.Today) 
     241                    { 
     242                        row.DefaultCellStyle.BackColor = Color.MintCream; 
     243                    } 
     244                    else 
     245                    { 
     246                        if (em.zafakturowana) 
     247                        { 
     248                            row.DefaultCellStyle.BackColor = Color.LightGray; 
     249                        } 
     250 
     251                        //anulowana 
     252                        if (em.status == 2) 
     253                        { 
     254                            row.DefaultCellStyle.ForeColor = Color.Red; 
     255                        } 
     256 
     257                        if (emisjaDoZmiany == (short) row.Cells[0].Value) 
     258                        { 
     259                            row.DefaultCellStyle.BackColor = Color.MistyRose; 
     260                        } 
     261                    } 
     262                } 
     263                else if (emisjaDoZmiany == 0) 
     264                { 
     265                    //emisja nie zosta³a wczeœniej wybrana, ale jej misi¹c ju¿ 
     266                    // jest zafakturowany 
     267                    DateTime dataWydania = (DateTime) row.Cells[1].Value; 
     268                    if (dataWydania.Year <= dataOstatatniejZafakturowanejEmisji.Year 
     269                        && 
     270                        dataWydania.Month <= dataOstatatniejZafakturowanejEmisji.Month) 
    237271                    { 
    238272                        row.ReadOnly = true; 
    239                         row.Cells[3].Value = true; 
    240                         row.DefaultCellStyle.BackColor = Color.WhiteSmoke; 
    241  
    242                         REKLAMADataSet.UKAZE_SIE_W_NRRow em = 
    243                             (REKLAMADataSet.UKAZE_SIE_W_NRRow)table[0]; 
    244  
    245                         if (Convert.ToDateTime(row.Cells[1].Value) < DateTime.Today) 
    246                         { 
    247                             row.DefaultCellStyle.BackColor = Color.MintCream; 
    248                         } 
    249                         else 
    250                         { 
    251                             if (em.zafakturowana) 
    252                             { 
    253                                 row.DefaultCellStyle.BackColor = Color.LightGray; 
    254                             } 
    255  
    256                             //anulowana 
    257                             if (em.status == 2) 
    258                             { 
    259                                 row.DefaultCellStyle.ForeColor = Color.Red; 
    260                             } 
    261  
    262                             if (emisjaDoZmiany == (short)row.Cells[0].Value) 
    263                             { 
    264                                 row.DefaultCellStyle.BackColor = Color.MistyRose; 
    265                             } 
    266                         } 
    267                     } 
    268                     else if (emisjaDoZmiany == 0) 
    269                     { 
    270                         //emisja nie zosta³a wczeœniej wybrana, ale jej misi¹c ju¿ 
    271                         // jest zafakturowany 
    272                         DateTime dataWydania = (DateTime)row.Cells[1].Value; 
    273                         if (dataWydania.Year <= dataOstatatniejZafakturowanejEmisji.Year 
    274                             && 
    275                             dataWydania.Month <= dataOstatatniejZafakturowanejEmisji.Month) 
    276                         { 
    277                             row.ReadOnly = true; 
    278                             row.DefaultCellStyle.BackColor = Color.LightGray; 
    279                         } 
    280                     } 
    281                 } 
    282             } 
    283         } 
    284  
     273                        row.DefaultCellStyle.BackColor = Color.LightGray; 
     274                    } 
     275                } 
     276            } 
     277        } 
    285278    } 
    286279} 
  • trunk/BazaReklam/OrderDetails.cs

    r750 r764  
    12761276                    if (emisjaRow.zafakturowana) 
    12771277                    { 
    1278                         zmienToolStripMenuItem.Visible = true; 
     1278                        zmienToolStripMenuItem.Visible = emisjaRow.status == 0; 
    12791279                        usunToolStripMenuItem.Visible = false; 
    1280                         anulujToolStripMenuItem.Visible = true; 
     1280                        anulujToolStripMenuItem.Visible = emisjaRow.status == 0; 
    12811281 
    12821282                        e.ContextMenuStrip = emisjeContextMenuStrip; 
     
    13601360                                                            emisja.Nr_Wydania); 
    13611361 
    1362             if (kalendarz.ShowDialog() == DialogResult.OK) 
     1362            if (kalendarz.ShowDialog() == DialogResult.OK && kalendarz.NowaEmisja.HasValue) 
    13631363            { 
    13641364                short staraEmisja = emisja.Nr_Wydania; 
    13651365 
    1366                 emisja.Nr_Wydania = kalendarz.NowaEmisja; 
     1366                emisja.Nr_Wydania = kalendarz.NowaEmisja.Value; 
    13671367                emisja.EndEdit(); 
    13681368                rEKLAMADataSet.UKAZE_SIE_W_NR.EndInit(); 
     
    13701370 
    13711371                if (emisja.zafakturowana && (staraEmisja != kalendarz.NowaEmisja)) 
    1372                     rEKLAMADataSet.zmianyEmisji.AddzmianyEmisjiRow(emisja, 
    1373                                                                    staraEmisja, 
    1374                                                                    kalendarz.NowaEmisja, 
    1375                                                                    DateTime.Now); 
     1372                    ReklamaHelper.AddUpdateIssueChange((double)emisja.ID, staraEmisja, kalendarz.NowaEmisja.Value); 
    13761373            } 
    13771374        } 
  • trunk/BazaReklam/ZamowieniaForm.cs

    r732 r764  
    12251225                usunKorekte(faktura); 
    12261226            else 
    1227                 usunFakture(faktura); 
     1227                UsunFakture(faktura); 
    12281228 
    12291229            Cursor = Cursors.Default; 
     
    12881288        } 
    12891289 
    1290         private void usunFakture(REKLAMADataSet.FAKTURYRow faktura) 
     1290        private void UsunFakture(REKLAMADataSet.FAKTURYRow faktura) 
    12911291        { 
    12921292            int idFakt = faktura.ID_FAKTURY; 
     
    14081408                DataRow[] rows = rEKLAMADataSet.FAKTURY.Select("id_faktury=" + id); 
    14091409                if (rows.Length > 0) 
    1410                     usunFakture((REKLAMADataSet.FAKTURYRow) rows[0]); 
     1410                    UsunFakture((REKLAMADataSet.FAKTURYRow) rows[0]); 
    14111411                 
    14121412                RestoreConnections();