Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Formular.SelectedRows.Count == 0)
            {
                MessageBox.Show("Выделите строку!");
                return;
            }

            if (DEPARTMENT.GetCountOfPrologedTimes((int)Formular.SelectedRows[0].Cells["idiss"].Value) > 0)
            {
                MessageBox.Show("Нельзя продлить книгу более одного раза!");
                return;
            }
            Prolong p = new Prolong();

            p.ShowDialog();
            if (p.Days == -99)
            {
                return;
            }
            if (Formular.SelectedRows[0].Cells["IsAtHome"].Value.ToString().ToLower().Contains("дом"))
            {
                DEPARTMENT.Prolong((int)Formular.SelectedRows[0].Cells["idiss"].Value, p.Days, EmpID);
            }
            else
            {
                DEPARTMENT.Prolong((int)Formular.SelectedRows[0].Cells["idiss"].Value, 3, EmpID);
            }
            ReaderVO reader = new ReaderVO((int)Formular.SelectedRows[0].Cells["idr"].Value);

            FillFormularGrid(reader);
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Formular.SelectedRows.Count == 0)
            {
                MessageBox.Show("Выделите строку!");
                return;
            }
            Prolong p = new Prolong();

            p.ShowDialog();
            if (p.Days == -99)
            {
                return;
            }
            DEPARTMENT.Prolong((int)Formular.SelectedRows[0].Cells["idiss"].Value, p.Days, EmpID);
            ReaderVO reader = new ReaderVO((int)Formular.SelectedRows[0].Cells["idr"].Value);

            FillFormularGrid(reader);
        }
Example #3
0
        private void Formular_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            switch (Formular.Columns[e.ColumnIndex].Name)
            {
                case "but":
                    if (e.RowIndex == -1) break;

                    if (((DataGridViewDisableButtonCell)Formular.Rows[e.RowIndex].Cells["but"]).Value.ToString() == "����� ���������")
                    {
                        switch (MessageBox.Show("�� ������� ��� ������ ����� ���������? ����� ������������� ����� �������� �� ����� ������, �.�. ��� ���������� � ������ ��������� ���������.", "��������!", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        {
                            case DialogResult.Yes:
                                this.dbw.RemPenalty(this.Formular.Rows[e.RowIndex].Cells["zi"].Value.ToString());
                                Conn.SQLDA.InsertCommand = new SqlCommand();
                                Conn.SQLDA.InsertCommand.Connection = Conn.ZakazCon;
                                Conn.SQLDA.InsertCommand.CommandText = "insert into Reservation_R..PENY_HIST (SUM, PDATE, INV, IDREADER, IDMAIN) values " +
                                                                       " ('" + Formular.Rows[e.RowIndex].Cells["peny"].Value.ToString() +
                                                                       "' , '" + DateTime.Now.ToString("yyyyMMdd") +
                                                                       "' ,  '" + Formular.Rows[e.RowIndex].Cells["inv"].Value.ToString() +
                                                                       "' , " + lFromularNumber.Text + ", " + Formular.Rows[e.RowIndex].Cells["idmain"].Value.ToString() + ")";
                                if (Conn.SQLDA.InsertCommand.Connection.State == ConnectionState.Closed)
                                {
                                    Conn.SQLDA.InsertCommand.Connection.Open();
                                }
                                Conn.SQLDA.InsertCommand.ExecuteNonQuery();
                                Conn.SQLDA.InsertCommand.Connection.Close();
                                this.Formular.Rows.RemoveAt(e.RowIndex);
                                this.autoinc(Formular);
                                return;
                            //break;
                            case DialogResult.No:
                                return;
                            //break;
                        }
                    }

                    f4 = new Prolong();
                    f4.ShowDialog();
                    if (f4.Days == -99)
                        return;
                    if (!dbw.Prolong(f4.Days, Formular.Rows[e.RowIndex].Cells["idmain"].Value.ToString(), Formular.Rows[e.RowIndex].Cells["inv"].Value.ToString()))
                    {
                        Formular.Rows[e.RowIndex].Cells["pen"].Value = false;
                        //Formular.Rows[e.RowIndex].Cells["pen"].ReadOnly = true;
                        ((DataGridViewDisableButtonCell)Formular.Rows[e.RowIndex].Cells["but"]).Enabled = true;
                        ((DataGridViewDisableButtonCell)Formular.Rows[e.RowIndex].Cells["but"]).Value = "��������";
                    }
                    dbw.InsertActionProlong(new DBWork.dbReader(int.Parse(lFromularNumber.Text)), new DBWork.dbBook(Formular.Rows[e.RowIndex].Cells["bar"].Value.ToString()));
                    Formular.Rows[e.RowIndex].Cells["vozv"].Value = DateTime.Parse(Formular.Rows[e.RowIndex].Cells["vozv"].Value.ToString()).AddDays(f4.Days);
                    //Formular.Rows[e.RowIndex].Cells["peny"].Value = CalculatePeny(Formular.Rows[e.RowIndex]).ToString() + " �.";
                    return;
                //break;
                case "pen":
                    if (e.RowIndex == -1) break;
                    if (Formular.Rows[e.RowIndex].Cells["pen"].Value.ToString().ToLower() == "true")
                    {
                        if (Formular.Rows[e.RowIndex].Cells["fact"].Value.ToString() == "")
                        {
                            MessageBox.Show("�� �� ������ ����� ��������� �������, �.�. ����� ��� �� ����������! ��������� ��������� ��� ��������� �����.", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            //switch (MessageBox.Show("����� ��� �� ����������. �� ������������� ������ ����� ���������? ", "��������!", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                            //{
                            //    case DialogResult.Yes:
                            //        dbw.RemPenalty(Formular.Rows[e.RowIndex].Cells["idmain"].Value.ToString());
                            //        Formular.Rows[e.RowIndex].Cells["pen"].Value = false;
                            //        ((DataGridViewDisableButtonCell)Formular.Rows[e.RowIndex].Cells["but"]).Enabled = false;
                            //        ((DataGridViewDisableButtonCell)Formular.Rows[e.RowIndex].Cells["but"]).Value = "��� ���������";
                            //        break;
                            //    case DialogResult.No:
                            //        return;
                            //        //break;
                            //}
                        }
                        else
                        {
                            MessageBox.Show("����� ����� ��������� ������� �� ������ \"����� ���������\"", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }
                    }
                    else
                    {
                        MessageBox.Show("������ ���������� ��������� �������: ��� ��������������� �������������.");
                        //Formular.Rows[e.RowIndex].Cells["pen"].Value = false;
                    }
                    break;

            }
        }
Example #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Formular.SelectedRows.Count == 0)
     {
         MessageBox.Show("�������� ������!");
         return;
     }
     Prolong p = new Prolong();
     p.ShowDialog();
     if (p.Days == -99) return;
     DEPARTMENT.Prolong((int)Formular.SelectedRows[0].Cells["idiss"].Value, p.Days, EmpID);
     ReaderVO reader = new ReaderVO((int)Formular.SelectedRows[0].Cells["idr"].Value);
     FillFormularGrid(reader);
 }