Example #1
0
        /// <summary>
        ///     Usuwanie akcesji.
        ///     Wykorzystuje procedurę składowaną "UsunAkcesje", która przyjmuje parametry:
        ///         1. kod czasopisma
        ///         2. nazwę użytkownika
        /// </summary>
        private void DeleteAkcesja()
        {
            DataTable Dt = IsNumberBorrowed();

            if (Dt.Rows.Count > 0)
            {
                string message = string.Format("{0} {1} {2}", _translationsDictionary.ContainsKey("there_are_borrowed_copies_in_quantities") ? _translationsDictionary["there_are_borrowed_copies_in_quantities"] : "Istnieją wypożyczone egzemplarze w ilości:", Dt.Rows.Count, _translationsDictionary.ContainsKey("do_you_want_to_return_it") ? _translationsDictionary["do_you_want_to_return_it"] : "Czy chcesz je zwrócić?");

                //if (MessageBox.Show(string.Format("Istnieją wypożyczone egzemplarze w ilości: {0}. Czy chcesz je zwrócić?", Dt.Rows.Count), "Zwracanie numerów", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                if (MessageBox.Show(message, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int  i     = 1;
                    bool check = true;

                    foreach (DataRow row in Dt.Rows)
                    {
                        ZwrotForm zwrot = new ZwrotForm(row["wypoz_id"].ToString(), Settings.employeeID, this);
                        zwrot.Text += string.Format(" {0} z {1}", i, Dt.Rows.Count);

                        if (zwrot.ShowDialog() == DialogResult.Cancel)
                        {
                            check = false;
                        }

                        i++;
                    }

                    if (check)
                    {
                        DeleteAkcesja();
                    }
                }

                return;
            }

            string message2 = _translationsDictionary.ContainsKey("do_you_want_to_delete_accession") ? _translationsDictionary["do_you_want_to_delete_accession"] : "Czy usunąć kartę akcesji tego czasopisma? Jeśli istnieją numery w tej karcie akcesji, to zostaną usunięte!";
            string caption  = _translationsDictionary.ContainsKey("deleting_accession") ? _translationsDictionary["deleting_accession"] : "Usuwanie karty akcesji";

            //if (MessageBox.Show("Czy usunąć kartę akcesji tego czasopisma? Jeśli istnieją numery w tej karcie akcesji, to zostaną usunięte!", "Usuwanie karty akcesji", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
            if (MessageBox.Show(message2, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
            {
                SqlCommand Command = new SqlCommand();
                Command.CommandText = "EXEC UsunAkcesje @kod, @user; ";

                Command.Parameters.AddWithValue("@kod", this.AkcesjaCode);
                Command.Parameters.AddWithValue("@user", Environment.UserDomainName + "\\" + Environment.UserName);

                if (CommonFunctions.WriteData(Command, ref Settings.Connection))
                {
                    message2 = _translationsDictionary.ContainsKey("accession_has_been_deleted") ? _translationsDictionary["accession_has_been_deleted"] : "Karta akcesji została pomyślnie usunięta.";
                    caption  = _translationsDictionary.ContainsKey("deleting_accession") ? _translationsDictionary["deleting_accession"] : "Usuwanie karty akcesji";

                    //MessageBox.Show("Karta akcesji została pomyślnie usunięta.", "Usuwanie karty akcesji", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show(message2, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }
Example #2
0
        /// <summary>
        ///     Usuwanie pojedynczego
        /// </summary>
        private void DeleteSingleNumber()
        {
            DataTable Dt = IsNumberBorrowed();

            if (Dt.Rows.Count > 0)
            {
                string message = string.Format("{0} {1}. {2}", _translationsDictionary.getStringFromDictionary("there_are_borrowed_copies_in_quantities", "Istnieją wypożyczone egzemplarze w ilości:"), Dt.Rows.Count, _translationsDictionary.getStringFromDictionary("do_you_want_to_return_it", "Czy chcesz je zwrócić?"));

                //if (MessageBox.Show(string.Format("Istnieją wypożyczone egzemplarze w ilości: {0}. Czy chcesz je zwrócić?", Dt.Rows.Count), "Zwracanie numerów", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                if (MessageBox.Show(message, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int  i     = 1;
                    bool check = true;

                    foreach (DataRow row in Dt.Rows)
                    {
                        ZwrotForm zwrot = new ZwrotForm(row["wypoz_id"].ToString(), Settings.employeeID, this);
                        zwrot.Text += string.Format(" {0} z {1}", i, Dt.Rows.Count);

                        if (zwrot.ShowDialog() == DialogResult.Cancel)
                        {
                            check = false;
                        }

                        i++;
                    }

                    if (check)
                    {
                        DeleteSingleNumber();
                    }
                }

                return;
            }

            //do_you_want_to_delete_single_magazine_number
            string do_you_want_to_delete_single_magazine_number = _translationsDictionary.getStringFromDictionary("do_you_want_to_delete_single_magazine_number", "Czy na pewno chcesz usunąć pojedynczy numer?");

            //if (MessageBox.Show("Czy na pewno chcesz usunąć pojedynczy numer?", "Usuwanie", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            if (MessageBox.Show(do_you_want_to_delete_single_magazine_number, _translationsDictionary.getStringFromDictionary("deleting", "Usuwanie"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                SqlCommand Command = new SqlCommand();

                Command.CommandText = "EXEC DeleteSingleNumber @p_akcesja_kod, @p_czasop_kod, @p_mode, @p_maxKol, @id_czasop_n; ";
                Command.Parameters.AddWithValue("@p_czasop_kod", this.CzasopCode);
                Command.Parameters.AddWithValue("@p_akcesja_kod", this.AkcesjaCode);
                Command.Parameters.AddWithValue("@p_mode", this.VolumesMode);
                Command.Parameters.AddWithValue("@p_maxKol", this.MaxKol);
                Command.Parameters.AddWithValue("@id_czasop_n", this.id_czasop_n);

                if (CommonFunctions.WriteData(Command, ref Settings.Connection))
                {//
                    MessageBox.Show(_translationsDictionary.getStringFromDictionary("removed", "Numer pomyślnie usunięto."), _translationsDictionary.getStringFromDictionary("single_number_deleting", "Usuwanie numeru"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }
Example #3
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            bool Success = false;

            SqlCommand Command = new SqlCommand();

            Command.CommandText = "";

            UbytkowanieForm UF;

            for (int i = 0; i < DGV.Rows.Count; i++)
            {
                //
                if (MessageBox.Show(string.Format("{0} {1}?", _translationsDictionary.getStringFromDictionary("do_you_want_to_delete_signature", "Czy chcesz usunąć sygnaturę "), DGV.Rows[i].Cells[SygNameDGV.Name].Value), _translationsDictionary.getStringFromDictionary("deleting", "Usuwanie"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    DataTable Dt = Settings.IsNumberBorrowed(DGV.Rows[i].Cells[SygIDDGV.Name].Value.ToString(), 5);

                    if (Dt.Rows.Count > 0)
                    {
                        string message = string.Format("{0} {1} {2}", _translationsDictionary.ContainsKey("there_are_borrowed_copies_in_quantities") ? _translationsDictionary["there_are_borrowed_copies_in_quantities"] : "Istnieją wypożyczone egzemplarze w ilości:", Dt.Rows.Count, _translationsDictionary.ContainsKey("do_you_want_to_return_it") ? _translationsDictionary["do_you_want_to_return_it"] : "Czy chcesz je zwrócić?");

                        if (MessageBox.Show(string.Format(message, Dt.Rows.Count), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        //if (MessageBox.Show(string.Format("Istnieją wypożyczone egzemplarze w ilości: {0}. Czy chcesz je zwrócić?", Dt.Rows.Count), "Zwracanie numerów", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            int  j     = 1;
                            bool check = true;

                            foreach (DataRow row in Dt.Rows)
                            {
                                ZwrotForm zwrot = new ZwrotForm(row["wypoz_id"].ToString(), Settings.employeeID, this);
                                zwrot.Text += string.Format(" {0} z {1}", j, Dt.Rows.Count);

                                if (zwrot.ShowDialog() == DialogResult.Cancel)
                                {
                                    check = false;
                                }

                                j++;
                            }

                            if (!check)
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }
                    }

                    Command = new SqlCommand();

                    Command.CommandText += "EXEC Czasop_DeleteSygs @id" + i + "; ";
                    Command.Parameters.AddWithValue("@id" + i, DGV.Rows[i].Cells[SygIDDGV.Name].Value);

                    if (CommonFunctions.WriteData(Command, ref Settings.Connection))
                    {
                        //MessageBox.Show("Sygnatura została usunięta bez wpisu do księgi ubytków.", _translationsDictionary.getStringFromDictionary("deleting", "Usuwanie"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MessageBox.Show(_translationsDictionary.getStringFromDictionary("signature_was_removed_without_registration", "Sygnatura została usunięta bez wpisu do księgi ubytków."), _translationsDictionary.getStringFromDictionary("deleting", "Usuwanie"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Success = true;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            for (int i = 0; i < UbytkiDGV.Rows.Count; i++)
            {
                UF = new UbytkowanieForm(MagazineID, UbytkiDGV.Rows[i].Cells[UbytkiSygIDDGV.Name].Value.ToString(), UbytkiDGV.Rows[i].Cells[UbytkiSygNameDGV.Name].Value.ToString(), Title, Seryjne);

                UF.ShowDialog();
            }

            if (DGV.Rows.Count > 0)
            {
                DGV.Rows.Clear();
            }

            if (AllDGV.Rows.Count > 0)
            {
                AllDGV.Rows.Clear();
            }

            if (UbytkiDGV.Rows.Count > 0)
            {
                UbytkiDGV.Rows.Clear();
            }

            FetchData(MagazineID);

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #4
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            bool deleted = false;

            for (int i = 0; i < UbytkiDGV.Rows.Count; i++)
            {
                if (((bool)UbytkiDGV.Rows[i].Cells["CheckBoxDGVC"].Value))
                {
                    DataTable Dt = Settings.IsNumberBorrowed(UbytkiDGV.Rows[i].Cells["id_volumesDGVC"].Value.ToString(), 2);

                    if (Dt.Rows.Count > 0)
                    {
                        string message = string.Format("{0} {1} {2}", _translationsDictionary.ContainsKey("there_are_borrowed_copies_in_quantities") ? _translationsDictionary["there_are_borrowed_copies_in_quantities"] : "Istnieją wypożyczone egzemplarze w ilości:", Dt.Rows.Count, _translationsDictionary.ContainsKey("do_you_want_to_return_it") ? _translationsDictionary["do_you_want_to_return_it"] : "Czy chcesz je zwrócić?");

                        if (MessageBox.Show(message, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        //if (MessageBox.Show(string.Format("Istnieją wypożyczone egzemplarze w ilości: {0}. Czy chcesz je zwrócić?", Dt.Rows.Count), "Zwracanie numerów", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            int  j     = 1;
                            bool check = true;

                            foreach (DataRow row in Dt.Rows)
                            {
                                ZwrotForm zwrot = new ZwrotForm(row["wypoz_id"].ToString(), Settings.employeeID, this);
                                zwrot.Text += string.Format(" {0} z {1}", j, Dt.Rows.Count);

                                if (zwrot.ShowDialog() == DialogResult.Cancel)
                                {
                                    check = false;
                                }

                                j++;
                            }

                            if (!check)
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }
                    }

                    SingleUbytkowanieForm SUF = new SingleUbytkowanieForm(UbytkiDGV.Rows[i].Cells["id_volumesDGVC"].Value.ToString(), this.MagazineID, this.SygLabel.Text, Title, Seryjne);
                    SUF.ShowDialog();

                    deleted = true;
                }
            }

            if (!deleted && UbytkiDGV.Rows.Count > 0)
            {
                MessageBox.Show(_translationsDictionary.getStringFromDictionary("choose_volume_to_delete", "Proszę wybrać wolumin do usunięcia."), _translationsDictionary.getStringFromDictionary("deleting", "Usuwanie woluminów"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            FetchData(MagazineID, id_cza_syg, Seryjne);

            if (UbytkiDGV.Rows.Count == 0)
            {
                DeleteSyg();
            }

            this.Close();
        }