| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.ComponentModel;
|
|---|
| 4 | using System.Data;
|
|---|
| 5 | using System.Data.SqlClient;
|
|---|
| 6 | using System.Drawing;
|
|---|
| 7 | using System.Text;
|
|---|
| 8 | using System.Windows.Forms;
|
|---|
| 9 |
|
|---|
| 10 | namespace Baza_Reklam
|
|---|
| 11 | {
|
|---|
| 12 | public partial class MDIBazaReklam : Form
|
|---|
| 13 | {
|
|---|
| 14 | public MDIBazaReklam()
|
|---|
| 15 | {
|
|---|
| 16 | InitializeComponent();
|
|---|
| 17 |
|
|---|
| 18 | if (ConnString.getConnString().Value.Contains("truck"))
|
|---|
| 19 | {
|
|---|
| 20 | this.Text = "Baza reklam EXPO " + Application.ProductVersion;
|
|---|
| 21 | this.toolStrip1.BackColor = Color.MistyRose;
|
|---|
| 22 | //Baza_Reklam.Classes.Version.nrWersji;
|
|---|
| 23 | }
|
|---|
| 24 | else
|
|---|
| 25 | {
|
|---|
| 26 | this.Text = "Baza reklam " + Application.ProductVersion;
|
|---|
| 27 | //Baza_Reklam.Classes.Version.nrWersji;
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | private void MDIBazaReklam_Load(object sender, EventArgs e)
|
|---|
| 34 | {
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | uprawnienia();
|
|---|
| 38 |
|
|---|
| 39 | //MessageBox.Show(span.ToString());
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | private void uprawnienia()
|
|---|
| 43 | {
|
|---|
| 44 | startToolStripButton.Enabled = false;
|
|---|
| 45 | zamowieniaToolStripButton.Enabled = false;
|
|---|
| 46 | klienciToolStripButton.Enabled = false;
|
|---|
| 47 | fakturyToolStripButton.Enabled = false;
|
|---|
| 48 | raportyToolStripButton.Enabled = false;
|
|---|
| 49 | prowizjeToolStripButton.Enabled = false;
|
|---|
| 50 | infoToolStripButton.Enabled = false;
|
|---|
| 51 | produkcjaToolStripButton.Enabled = false;
|
|---|
| 52 | listaReklamToolStripButton.Enabled = false;
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 | if (User.getUser().St_handlowiec || User.getUser().St_kierownik || User.getUser().St_sekretarka || User.getUser().St_subhandlowiec || User.getUser().St_produkcja)
|
|---|
| 56 | {
|
|---|
| 57 | zamowieniaToolStripButton.Enabled = true;
|
|---|
| 58 | klienciToolStripButton.Enabled = true;
|
|---|
| 59 | fakturyToolStripButton.Enabled = true;
|
|---|
| 60 | listaReklamToolStripButton.Enabled = true;
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | if (User.getUser().St_dtp || User.getUser().St_handlowiec || User.getUser().St_kierownik || User.getUser().St_sekretarka || User.getUser().St_subhandlowiec || User.getUser().St_produkcja)
|
|---|
| 64 | {
|
|---|
| 65 | raportyToolStripButton.Enabled = true;
|
|---|
| 66 | infoToolStripButton.Enabled = true;
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | if (User.getUser().St_admin || User.getUser().St_handlowiec || User.getUser().St_kierownik || User.getUser().St_sekretarka || User.getUser().St_subhandlowiec)
|
|---|
| 70 | {
|
|---|
| 71 | prowizjeToolStripButton.Enabled = true;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | if (User.getUser().St_admin)
|
|---|
| 75 | {
|
|---|
| 76 | adminToolStripButton.Visible = true;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | produkcjaToolStripButton.Enabled = true;
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 | if (User.getUser().St_handlowiec || User.getUser().St_kierownik || User.getUser().St_sekretarka || User.getUser().St_subhandlowiec || User.getUser().St_produkcja)
|
|---|
| 83 | {
|
|---|
| 84 | startToolStripButton.Enabled = true;
|
|---|
| 85 | StartForm.getStartForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 86 | StartForm.getStartForm(this).Show();
|
|---|
| 87 | }
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | private void klienciToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 91 | {
|
|---|
| 92 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 93 |
|
|---|
| 94 | foreach (Form childForm in MdiChildren)
|
|---|
| 95 | {
|
|---|
| 96 | childForm.Hide();
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | ClientsForm.getClientsForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 100 | ClientsForm.getClientsForm(this).Show();
|
|---|
| 101 |
|
|---|
| 102 | this.Cursor = Cursors.Default;
|
|---|
| 103 |
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | private void zamowieniaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 107 | {
|
|---|
| 108 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 109 |
|
|---|
| 110 | foreach (Form childForm in MdiChildren)
|
|---|
| 111 | {
|
|---|
| 112 | childForm.Hide();
|
|---|
| 113 | }
|
|---|
| 114 | OrdersForm.getOrderForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 115 | OrdersForm.getOrderForm(this).Show();
|
|---|
| 116 |
|
|---|
| 117 | this.Cursor = Cursors.Default;
|
|---|
| 118 |
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | private void fakturyToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 122 | {
|
|---|
| 123 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 124 |
|
|---|
| 125 | foreach (Form childForm in MdiChildren)
|
|---|
| 126 | {
|
|---|
| 127 | childForm.Hide();
|
|---|
| 128 | }
|
|---|
| 129 | FacturesForm.getFacturesForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 130 | FacturesForm.getFacturesForm(this).Show();
|
|---|
| 131 |
|
|---|
| 132 | this.Cursor = Cursors.Default;
|
|---|
| 133 |
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | private void produkcjaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 137 | {
|
|---|
| 138 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 139 |
|
|---|
| 140 | foreach (Form childForm in MdiChildren)
|
|---|
| 141 | {
|
|---|
| 142 | childForm.Hide();
|
|---|
| 143 | }
|
|---|
| 144 | ProductionForm.getProductionForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 145 | ProductionForm.getProductionForm(this).Show();
|
|---|
| 146 |
|
|---|
| 147 | this.Cursor = Cursors.Default;
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | private void infoToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 151 | {
|
|---|
| 152 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 153 |
|
|---|
| 154 | foreach (Form childForm in MdiChildren)
|
|---|
| 155 | {
|
|---|
| 156 | childForm.Hide();
|
|---|
| 157 | }
|
|---|
| 158 | InfoForm.getInfoForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 159 | InfoForm.getInfoForm(this).Show();
|
|---|
| 160 |
|
|---|
| 161 | this.Cursor = Cursors.Default;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | private void raportyToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 165 | {
|
|---|
| 166 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 167 |
|
|---|
| 168 | foreach (Form childForm in MdiChildren)
|
|---|
| 169 | {
|
|---|
| 170 | childForm.Hide();
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | ReportsForm.getReportsForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 174 | ReportsForm.getReportsForm(this).Show();
|
|---|
| 175 |
|
|---|
| 176 | this.Cursor = Cursors.Default;
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | private void prowizjeToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 180 | {
|
|---|
| 181 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 182 |
|
|---|
| 183 | foreach (Form childForm in MdiChildren)
|
|---|
| 184 | {
|
|---|
| 185 | childForm.Hide();
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | ProvisionForm.getProvisionForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 189 | ProvisionForm.getProvisionForm(this).Show();
|
|---|
| 190 |
|
|---|
| 191 | this.Cursor = Cursors.Default;
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | private void startToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 195 | {
|
|---|
| 196 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 197 |
|
|---|
| 198 | foreach (Form childForm in MdiChildren)
|
|---|
| 199 | {
|
|---|
| 200 | childForm.Hide();
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | StartForm.getStartForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 204 | StartForm.getStartForm(this).Show();
|
|---|
| 205 |
|
|---|
| 206 | this.Cursor = Cursors.Default;
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | private void listaReklamToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 210 | {
|
|---|
| 211 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 212 |
|
|---|
| 213 | foreach (Form childForm in MdiChildren)
|
|---|
| 214 | {
|
|---|
| 215 | childForm.Hide();
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | ListaReklamNaWydanieForm.getListaReklamNaWydanieForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 219 | ListaReklamNaWydanieForm.getListaReklamNaWydanieForm(this).Show();
|
|---|
| 220 |
|
|---|
| 221 | this.Cursor = Cursors.Default;
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | private void adminToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 225 | {
|
|---|
| 226 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 227 |
|
|---|
| 228 | foreach (Form childForm in MdiChildren)
|
|---|
| 229 | {
|
|---|
| 230 | childForm.Hide();
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | AdminForm.getAdminForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 234 | AdminForm.getAdminForm(this).Show();
|
|---|
| 235 |
|
|---|
| 236 | this.Cursor = Cursors.Default;
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | private void koniecToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 240 | {
|
|---|
| 241 | this.Close();
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | private void MDIBazaReklam_FormClosing(object sender, FormClosingEventArgs e)
|
|---|
| 245 | {
|
|---|
| 246 | if (MessageBox.Show("Czy na pewno chcesz wyjæ z programu?", "", MessageBoxButtons.YesNo) == DialogResult.No)
|
|---|
| 247 | {
|
|---|
| 248 | e.Cancel = true;
|
|---|
| 249 | return;
|
|---|
| 250 | }
|
|---|
| 251 | else
|
|---|
| 252 | e.Cancel = false;
|
|---|
| 253 |
|
|---|
| 254 | string s1 = "";
|
|---|
| 255 |
|
|---|
| 256 | try
|
|---|
| 257 | {
|
|---|
| 258 | foreach (Form childForm in MdiChildren)
|
|---|
| 259 | {
|
|---|
| 260 | s1 = childForm.GetType().ToString();
|
|---|
| 261 | childForm.Close();
|
|---|
| 262 | }
|
|---|
| 263 | }
|
|---|
| 264 | catch (Exception ex)
|
|---|
| 265 | {
|
|---|
| 266 | MessageBox.Show("Formularz: " + s1 + "\n" + ex.ToString());
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 | }
|
|---|
| 271 |
|
|---|
| 272 | private void MDIBazaReklam_FormClosed(object sender, FormClosedEventArgs e)
|
|---|
| 273 | {
|
|---|
| 274 | //Application.Exit();
|
|---|
| 275 | int i = 0;
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | private void zamowieniaToolStripButton2_Click(object sender, EventArgs e)
|
|---|
| 279 | {
|
|---|
| 280 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 281 |
|
|---|
| 282 | foreach (Form childForm in MdiChildren)
|
|---|
| 283 | {
|
|---|
| 284 | childForm.Hide();
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 | ZestawienieZamowienForm.getZestawienieZamowienForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 288 | ZestawienieZamowienForm.getZestawienieZamowienForm(this).Show();
|
|---|
| 289 |
|
|---|
| 290 | this.Cursor = Cursors.Default;
|
|---|
| 291 |
|
|---|
| 292 | }
|
|---|
| 293 |
|
|---|
| 294 | private void fakturyNoweToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 295 | {
|
|---|
| 296 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 297 |
|
|---|
| 298 | foreach (Form childForm in MdiChildren)
|
|---|
| 299 | {
|
|---|
| 300 | childForm.Hide();
|
|---|
| 301 | }
|
|---|
| 302 | FacturesFormNEW.getFacturesForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 303 | FacturesFormNEW.getFacturesForm(this).Show();
|
|---|
| 304 |
|
|---|
| 305 | this.Cursor = Cursors.Default;
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| 308 | private void korektaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 309 | {
|
|---|
| 310 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 311 |
|
|---|
| 312 | foreach (Form childForm in MdiChildren)
|
|---|
| 313 | {
|
|---|
| 314 | childForm.Hide();
|
|---|
| 315 | }
|
|---|
| 316 | KorektyForm.getFacturesForm(this).WindowState = FormWindowState.Maximized;
|
|---|
| 317 | KorektyForm.getFacturesForm(this).Show();
|
|---|
| 318 |
|
|---|
| 319 | this.Cursor = Cursors.Default;
|
|---|
| 320 | }
|
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 | }
|
|---|
| 325 | }
|
|---|