Zbiór zmian 797 dla trunk/BazaReklam/ProvisionForm.cs
- Data:
- 2009-08-03 13:02:12 (17 years ago)
- Pliki:
-
- 1 zmodyfikowane
-
trunk/BazaReklam/ProvisionForm.cs (zmodyfikowane) (10 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/BazaReklam/ProvisionForm.cs
r677 r797 5 5 using System.Data.SqlClient; 6 6 using System.Windows.Forms; 7 7 using Baza_Reklam.Classes; 8 8 using Baza_Reklam.Classes.Interfaces; 9 9 using Baza_Reklam.Classes.Helpers; … … 112 112 try 113 113 { 114 SaveResult(); 115 114 116 conn = new SqlConnection(ConnString.getConnString().Value); 115 117 conn.Open(); … … 188 190 try 189 191 { 192 SaveResult(); 193 190 194 command.ExecuteNonQuery(); 191 195 transaction.Commit(); … … 229 233 if (Validate()) 230 234 { 231 pLANBindingSource.EndEdit(); 232 pLANTableAdapter.Update(rEKLAMADataSet.PLAN); 235 if (prowizjeDataGridView.SelectedCells.Count!=1) 236 { 237 MessageBox.Show("Proszê zaznaczyæ tylko jedn¹ komórkê."); 238 Cursor = Cursors.Default; 239 return; 240 } 241 242 SaveResult(); 243 244 MessageBox.Show("Zmiany zapisane"); 233 245 } 234 246 Cursor = Cursors.Default; 235 236 MessageBox.Show("Zmiany zapisane");237 247 } 238 248 … … 324 334 325 335 326 btnBlockProvision.Visible = User.Instance().IsK siegowosc;327 if (!User.Instance().IsK siegowosc) return;336 btnBlockProvision.Visible = User.Instance().IsKierownik; 337 if (!User.Instance().IsKierownik) return; 328 338 329 339 _isProvisionBlocked = … … 367 377 private void prowizjeDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) 368 378 { 369 if (Validate()) 370 { 371 if (prowizjeDataGridView.Columns[e.ColumnIndex].Name == "PR_PROWIZJI") 379 if (prowizjeDataGridView.Columns[e.ColumnIndex].Name != "PR_PROWIZJI") return; 380 381 CorrectBonusPercentage(e.ColumnIndex, e.RowIndex); 382 } 383 384 private void CorrectBonusPercentage(int column, int row) 385 { 386 if (prowizjeDataGridView.Columns[column].Name != "PR_PROWIZJI") return; 387 388 if (prowizjeDataGridView.Columns[column].Name == "PR_PROWIZJI") 389 { 390 if (Convert.ToDecimal(prowizjeDataGridView[column, row].Value) >= 1) 372 391 { 373 if (Convert.ToDecimal(prowizjeDataGridView[e.ColumnIndex, e.RowIndex].Value) >= 1) 374 { 375 prowizjeDataGridView[e.ColumnIndex, e.RowIndex].Value = Convert.ToDecimal(prowizjeDataGridView[e.ColumnIndex, e.RowIndex].Value) / 100; 376 } 392 prowizjeDataGridView[column, row].Value = 393 Convert.ToDecimal(prowizjeDataGridView[column, row].Value) / 100; 377 394 } 378 } 395 } 396 } 397 398 private void SaveResult() 399 { 400 CorrectBonusPercentage(prowizjeDataGridView.SelectedCells[0].ColumnIndex, prowizjeDataGridView.SelectedCells[0].RowIndex); 401 pLANBindingSource.EndEdit(); 402 pLANTableAdapter.Update(rEKLAMADataSet.PLAN); 379 403 } 380 404 … … 394 418 } 395 419 420 CorrectBonusPercentage(e.ColumnIndex, e.RowIndex); 421 396 422 ukrytyLabel.Select(); 397 423 prowizjeDataGridView.EndEdit(); 398 424 pLANBindingSource.EndEdit(); 399 425 400 if (prowizjeDataGridView.Columns[e.ColumnIndex].Name == "PR_PROWIZJI")401 {402 if (Convert.ToDecimal(prowizjeDataGridView[e.ColumnIndex, e.RowIndex].Value) >= 1)403 {404 prowizjeDataGridView[e.ColumnIndex, e.RowIndex].Value = Convert.ToDecimal(prowizjeDataGridView[e.ColumnIndex, e.RowIndex].Value) / 100;405 }406 }407 408 426 REKLAMADataSet.PLANDataTable changes = rEKLAMADataSet.PLAN.GetChanges(DataRowState.Modified) as 409 427 REKLAMADataSet.PLANDataTable; … … 462 480 private void btnBlockProvision_Click(object sender, EventArgs e) 463 481 { 464 if (!User.Instance().IsK siegowosc) return;482 if (!User.Instance().IsKierownik) return; 465 483 466 484 if (!_isProvisionBlocked.HasValue) return; … … 480 498 aGENCITableAdapter.FillByIdAgencji(sLOWNIKDataSet.AGENCI, agencja); 481 499 pLANTableAdapter.FillByAgencja(rEKLAMADataSet.PLAN, rok, miesiac, agencja); 500 501 if (_isProvisionBlocked.Value) 502 SendEmailNotification(); 482 503 } 483 504 … … 487 508 btnBlockProvision.Checked = isBlocked; 488 509 } 510 511 private void SendEmailNotification() 512 { 513 string selectedAgencja = agencjaToolStripComboBox.Control.Text; 514 ISmtpConfiguration smtpConfig = new SmtpConfiguration(); 515 IEmailSender emailSender = new EmailSender(smtpConfig); 516 emailSender.From = ConfigurationHelper.GetSettingByKey("Application.Email.From"); 517 emailSender.To.AddRange(ConfigurationHelper.GetSettingByKey("Application.Email.Prowizje.To").Split(';')); 518 emailSender.Subject = string.Format(ConfigurationHelper.GetSettingByKey("Application.Email.Prowizje.Subject"), selectedAgencja); 519 emailSender.Body = string.Format(ConfigurationHelper.GetSettingByKey("Application.Email.Prowizje.Body"), selectedAgencja, User.Instance().Imie + " " + User.Instance().Nazwisko, "\n", DateTime.Now); 520 emailSender.Send(); 521 } 489 522 } 490 523 }
