Пример #1
0
 public ChangeComment(DBWork.dbReader reader_)
 {
     InitializeComponent();
     reader  =reader_;
     Conn.SQLDA.SelectCommand.CommandText = "select * from Readers..AbonementMemo where IDReader = " + reader.id;
     DataSet DS = new DataSet();
     int c = Conn.SQLDA.Fill(DS, "tmp");
     if (c == 0) return;
     textBox1.Text = DS.Tables["tmp"].Rows[0]["Comment"].ToString();
 }
Пример #2
0
        private void button13_Click(object sender, EventArgs e)
        {
            #region old
            /*if (label25.Text == "")
            {
                MessageBox.Show("�������� �� ������! ������� �������� ��������!");
                return;
            }
            DBWork.dbReader reader = new DBWork.dbReader(int.Parse(label25.Text));

            Conn.ReaderDA.SelectCommand.CommandText = "select * from Main where";

            //DataSet ds = dbw.GetFormular("149921");
            //int i = ds.Tables.Count;
            //CrystalReport11.SetDataSource(dbw.GetFormular("149921"));
            Conn.SQLDA.SelectCommand.Parameters["@IDR"].Value = reader.id;
            Conn.SQLDA.SelectCommand.CommandText = " select " +
            "max(case when tmp.mnf = 200 then pl end) as Zag, " +
            "max(case when tmp.mnf = 200 then srt end) as zag_sort, " +
            "max(case when tmp.mnf = 700 then pl end) as avt, " +
            "max(case when tmp.mnf = 700 then srt end) as avt_sort, " +
            "max(case when tmp.mnf = 2100 then pl end) as god, " +
            "max(case when tmp.mnf = 200 then pl end) as mesto, " +
            "max(case when tmp.mnf = 200 then idm end) as idmain, " +
            "max(case when tmp.mnf = 200 then iss end) as issue, " +
            "max(case when tmp.mnf = 200 then vozv end) as vozv, " +
            "max(case when tmp.mnf = 200 then fct end) as fact, " +
            "max(case when tmp.mnf = 200 then zakid end) as zkid, " +
            "max(case when tmp.mnf = 200 then zi end) as zid, " +
            "((case when (tmp.pnlt = 'false' or tmp.pnlt is NULL) then 'false' else 'true' end)) as penalty, " +
            "((case when (tmp.rempnlt = 'false' or tmp.rempnlt is NULL) then 'false' else 'true' end)) as rempenalty " +
            "from " +
            "(select Z.ID as zi,Z.IDMAIN as zakid, Z.DATE_ISSUE as iss, Z.DATE_VOZV as vozv, Z.DATE_FACT_VOZV as fct, Z.PENALTY as pnlt,Z.REMPENALTY as rempnlt, X.IDMAIN as idm, X.PLAIN as pl, Y.SORT as srt, Y.MNFIELD as mnf " +
            "from BJACC..DATAEXTPLAIN X " +
            "join BJACC..DATAEXT Y on Y.ID=X.IDDATAEXT " +
            "join Reservation_R..ISSUED Z on ((Z.IDMAIN = Y.IDMAIN) or (Z.IDMAIN_CONST=Y.IDMAIN and Z.PENALTY='true')) " +
                //"--join Reservation_R..ISSUED ZZ on Z.IDMAIN = ZZ.IDMAIN_CONST "+
            "where (((Y.MNFIELD = 200 and Y.MSFIELD = '$a') " +
            "or (Y.MSFIELD = '$a' and Y.MNFIELD = 700) " +
            "or (Y.MSFIELD = '$d' and Y.MNFIELD = 2100) " +
            "or (Y.MSFIELD = '$a' and Y.MNFIELD = 210)) and (Z.IDREADER = @IDR) and (( ((Z.IDMAIN!=0)and(Z.REMPENALTY = 'false')and (Z.PENALTY='true')) or ((Z.IDMAIN=0)and(Z.PENALTY='true')) or ((Z.IDMAIN!=0)and(Z.REMPENALTY = 'false')and (Z.PENALTY='false'))  ) )) " +
            "group by Z.ID, Z.IDMAIN, X.PLAIN, Y.SORT, Y.MNFIELD, X.IDMAIN,Z.DATE_ISSUE,Z.DATE_VOZV, Z.DATE_FACT_VOZV,Z.PENALTY, Z.REMPENALTY " +
            ") as tmp " +
            "group by idm,pnlt,rempnlt ";
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            DataSet R = new DataSet();
            R.Tables.Add("form");

            int i = Conn.SQLDA.Fill(R.Tables["form"]);
            CrystalReport1 cr1 = new CrystalReport1();
            cr1.SetDataSource(R.Tables["form"]);
            crystalReportViewer1.ReportSource = cr1;

            CrystalDecisions.CrystalReports.Engine.TextObject txtReaderName;
            CrystalDecisions.CrystalReports.Engine.TextObject txtReaderNum;
            txtReaderName = cr1.ReportDefinition.ReportObjects["Text19"] as TextObject;
            txtReaderNum = cr1.ReportDefinition.ReportObjects["Text20"] as TextObject;

            txtReaderName.Text = reader.Surname + " " + reader.Name + " " + reader.SecondName;
            txtReaderNum.Text = reader.id;
            //crystalReportViewer1.PrintReport();
            cr1.PrintToPrinter(2, false, 1, 99999);*/
            #endregion
            if (lFromularNumber.Text == "")
            {
                MessageBox.Show("�������� �� ������! ������� �������� ��������!");
                return;
            }
            DBWork.dbReader reader = new DBWork.dbReader(int.Parse(lFromularNumber.Text));

            Conn.ReaderDA.SelectCommand.CommandText = "select * from Main where";

            //DataSet ds = dbw.GetFormular("149921");
            //int i = ds.Tables.Count;
            //CrystalReport11.SetDataSource(dbw.GetFormular("149921"));
            Conn.SQLDA.SelectCommand.Parameters["@IDR"].Value = reader.id;
            Conn.SQLDA.SelectCommand.CommandText = "select zagp.PLAIN zag,avtp.PLAIN avt, B.INV inv, B.DATE_ISSUE iss,B.DATE_VOZV vzv  " +
                                                   "  from BJACC..DATAEXT A  " +
                                                   " inner join Reservation_R..ISSUED B on B.INV collate Cyrillic_General_CI_AI = A.SORT and A.MNFIELD = 899 and A.MSFIELD = '$p' " +
                                                   " left join BJACC..DATAEXT zag on zag.MNFIELD = 200 and zag.MSFIELD = '$a' and zag.IDMAIN = A.IDMAIN " +
                                                   " left join BJACC..DATAEXT avt on avt.MNFIELD = 700 and avt.MSFIELD = '$a' and avt.IDMAIN = A.IDMAIN " +
                                                   " left join BJACC..DATAEXTPLAIN zagp on zagp.IDDATAEXT = zag.ID " +
                                                   " left join BJACC..DATAEXTPLAIN avtp on avtp.IDDATAEXT = avt.ID " +
                                                   " where B.IDREADER = @IDR and B.IDMAIN != 0";
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            DataSet R = new DataSet();
            R.Tables.Add("form");

            int i = Conn.SQLDA.Fill(R.Tables["form"]);
            CrystalReport1 cr1 = new CrystalReport1();
            cr1.SetDataSource(R.Tables["form"]);
            crystalReportViewer1.ReportSource = cr1;

            CrystalDecisions.CrystalReports.Engine.TextObject txtReaderName;
            CrystalDecisions.CrystalReports.Engine.TextObject txtReaderNum;
            txtReaderName = cr1.ReportDefinition.ReportObjects["Text19"] as TextObject;
            txtReaderNum = cr1.ReportDefinition.ReportObjects["Text20"] as TextObject;

            txtReaderName.Text = reader.Surname + " " + reader.Name + " " + reader.SecondName;
            txtReaderNum.Text = reader.id;
            //crystalReportViewer1.PrintReport();
            cr1.PrintToPrinter(1, false, 1, 99999);
        }
Пример #3
0
        public void FrmlrFam(string id)
        {
            ReaderRecordFormular = new DBWork.dbReader(int.Parse(id));

            dbw.GetFormular(ReaderRecordFormular.id);
            ReaderSetBarcode = new DBWork.dbReader(ReaderRecordFormular);
            lFormularName.Text = ReaderRecordFormular.Surname + " " + ReaderRecordFormular.Name + " " + ReaderRecordFormular.SecondName;
            lFromularNumber.Text = ReaderRecordFormular.id;
            //FormularColumnsForming(ReaderRecordFormular.id);
        }
Пример #4
0
        void Form1_Scanned(object sender, EventArgs ev)
        {
            #region cash
            /*Singletone  - ���� �������� ��� ���
            typedef std::pair<BookId, bool> BookFreePair;
            typedef std::vector<BookFreePair> BooksFreeType;

            � ������ ������ ���� ��������� BooksFreeType

            BooksFreeType cache_;
            ...
            bool isBookBusy(BookId bookId)
            {
               if(iterator find = cashe_.find(bookId))
              return find->second;

               bool busy = ReadBookBusyFromBD();
               cache.push_back(std::make_pair(bookId, busy));
               return busy;
            }
              */
            #endregion
            //MessageBox.Show(((IOPOSScanner_1_10)sender).ScanData.ToString());
            string g = tabControl1.SelectedTab.ToString();
            switch (tabControl1.SelectedTab.Text)
            {
                case "�������� ��������":
                    #region formular
                    //string _data = ((IOPOSScanner_1_10)sender).ScanData.ToString();
                    string _data = FromPort;
                    if (!dbw.isReader(_data))
                    {
                        MessageBox.Show("�������� �������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    /*if (_data.Length < 20)
                        _data = _data.Remove(0, 1);*/
                    //_data = _data.Remove(_data.Length - 1, 1);
                    ReaderRecordFormular = new DBWork.dbReader(_data);

                    if (ReaderRecordFormular.barcode == "notfoundbynumber")
                    {
                        MessageBox.Show("�������� �� ������, ���� �������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (ReaderRecordFormular.barcode == "numsoc")
                    {
                        MessageBox.Show("�������� �� ������, ���� �������� �������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (ReaderRecordFormular.barcode == "sersoc")
                    {
                        MessageBox.Show("�� ������������� ����� ���������� �����!�������� ������� ���������� �����!����� ���������� ����� ������� �������, �� ��������� �����! ����� ���������� ����� ���������� ���������������� � ������������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    OldBase(ReaderRecordFormular);
                    label20.Text = ReaderRecordFormular.Surname + " " + ReaderRecordFormular.Name + " " + ReaderRecordFormular.SecondName;
                    textBox6.Text = ReaderRecordFormular.AbonType;
                    label25.Text = ReaderRecordFormular.id;

                    //dbw.SetPenalty(ReaderRecordFormular.id);
                    this.FormularColumnsForming(ReaderRecordFormular.id);

                    /*Formular.Columns[1].Width = 100;
                    Formular.Columns[2].Visible = false;
                    Formular.Columns[4].Visible = false;
                    Formular.Columns[3].HeaderText = "�����";
                    Formular.Columns[3].Width = 90;
                    Formular.Columns[5].HeaderText = "��� �������";
                    Formular.Columns[5].Width = 110;
                    Formular.Columns[7].Visible = false;
                    Formular.Columns[6].HeaderText = "����� �������";
                    Formular.Columns[6].Width = 170;
                    Formular.Columns[8].HeaderText = "���� ������";
                    Formular.Columns[8].Width = 130;
                    Formular.Columns[9].HeaderText = "�������������� ���� ��������";
                    Formular.Columns[9].Width = 130;
                    Formular.Columns[10].HeaderText = "����������� ���� ��������";
                    Formular.Columns[10].Width = 130;
                    Formular.Columns[11].HeaderText = "���������";
                    Formular.Columns[11].Width = 130;*/

                    //Formular.Columns[8].Visible = false;
                    //Formular.Columns[9].Visible = false;
                    Sorting.WhatStat = Stats.Formular;
                    Sorting.AuthorSort = SortDir.None;
                    Sorting.ZagSort = SortDir.None;
                    break;
                    #endregion
                case "������ ��������� ��������":
                    #region vidachashtrihcoda

                    if (label16.Visible)
                    {
                        //string BarCode = ((IOPOSScanner_1_10)sender).ScanData.ToString().Remove(((IOPOSScanner_1_10)sender).ScanData.ToString().Length - 1, 1);
                        string BarCode = FromPort;
                        switch (dbw.SetReaderBarCode(ReaderSetBarcode.id, BarCode))
                        {
                            case -5:
                                MessageBox.Show("������ �������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                break;
                            case -1:
                                MessageBox.Show("������ ���� ������.", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                break;
                            case -2:
                                MessageBox.Show("�������� �� ������", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                break;
                            case -4:
                                MessageBox.Show("����� �������� ��� ���������� � ����! �������� ������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                break;
                            case -3:
                                MessageBox.Show("� �������� ���� �������� �� ���������� �����! ������ ��������� ����� �������� �� ���������.", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                groupBox4.Enabled = true;
                                break;
                            case 1:
                                textBox5.Text = BarCode;
                                //timer2.Enabled = false;
                                label16.Visible = false;
                                //tabControl1.Enabled = true;
                                groupBox4.Enabled = true;
                                label16.Visible = false;
                                MessageBox.Show("�������� ������� ������ � ��������!", "�������!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                        }
                        return;
                    }
                    else
                        MessageBox.Show("������� ������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                    #endregion
                case "����/������ �������":
                    #region priemVidacha
                    //timer1.Enabled = true;
                    label1.Enabled = true;
                    //button2.Enabled = false;
                    //button4.Enabled = false;

                    //_data = "9643909027074162622 1107009";

                    if ((this.emul == "") || (this.emul == null))
                    {
                        _data = FromPort;
                    }
                    else
                    {
                        _data = this.emul;
                    }
                    if ((this.ReaderRecord != null) && (this.BookRecord != null))
                    {
                        MessageBox.Show("����������� ���������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        this.emul = "";
                        return;
                    }
                    //MessageBox.Show(_data);
                    ReaderRecordWork = null;
                    BookRecordWork = null;
                    if (dbw.isReader(_data))
                    {
                        /*if (_data.Length < 20)
                            _data = _data.Remove(0, 1);*/
                        //_data = _data.Remove(_data.Length - 1, 1);
                        ReaderRecordWork = new DBWork.dbReader(_data);
                        if (ReaderRecordWork.barcode == "notfoundbynumber")
                        {
                            MessageBox.Show("�������� �� ������, ���� �������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.emul = "";
                            return;
                        }
                        if (ReaderRecordWork.barcode == "numsoc")
                        {
                            MessageBox.Show("�������� �� ������, ���� �������� �������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.emul = "";
                            return;
                        }
                        if (ReaderRecordWork.barcode == "sersoc")
                        {
                            MessageBox.Show("�� ������������� ����� ���������� �����!�������� ������� ���������� �����!����� ���������� ����� ������� �������, �� ��������� �����! ����� ���������� ����� ���������� ���������������� � ������������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.emul = "";
                            return;
                        }

                        if (OldBase())
                        {
                            this.emul = "";
                            return;
                        }
                        if (this.ReaderRecord != null)
                        {
                            this.emul = "";
                            return;
                        }
                        if (this.ReaderRecord != null)
                        {
                            MessageBox.Show("����������� ���������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            this.emul = "";
                            return;
                        }
                        if (ReaderRecordWork.barcode == "error")
                        {
                            MessageBox.Show("�������� �� ��������������� ���� �� ������������� ����� ���������� �����!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.emul = "";
                            return;
                        }
                        /*if (ReaderRecordWork.RegInMos != DateTime.MinValue)
                        {
                            if ((ReaderRecordWork.RegInMos - DateTime.Today).Days < 60)
                            {
                                MessageBox.Show("� �������� ������������� ���� ����������� � ������! �������� ����� 60 ����!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                this.emul = "";
                            }
                        }*/

                    }
                    else
                    {
                        //_data = _data.Remove(_data.Length - 1, 1);
                        BookRecordWork = new DBWork.dbBook(_data);
                        if (BookRecordWork.id == "�������� ��������")
                        {
                            MessageBox.Show("������ �������� �������� ���� ������� �� �������� (�����) ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.emul = "";
                            return;
                         }

                    }
                    if ((BookRecord != null) && (BookRecordWork != null))
                    {
                        MessageBox.Show("������� ��������� 2-� ������� ������! �������� �������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        this.emul = "";
                        return;
                    }

                    if (ReaderRecord == null)
                    {
                        if (BookRecord != null)
                        {
                            if (ReaderRecordWork != null)
                            {
                                ReaderRecord = ReaderRecordWork.Clone();
                                this.label5.Text = ReaderRecord.FIO;
                                //��������� ����� � �������� ����� ������ � ����������� ��� ������
                                button2.Enabled = true;
                                button4.Enabled = true;
                                button2.Focus();
                                this.AcceptButton = button2;
                                label1.Text = "����������� ������";
                            }
                            else
                            {
                                MessageBox.Show("������� ��������� 2-� ������� ������! �������� �������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                this.emul = "";
                                return;
                            }
                        }
                        else
                        {
                            if (ReaderRecordWork != null)
                            {
                                MessageBox.Show("������ �������� ��������! �������� �������� �������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                this.emul = "";
                                return;
                            }
                            else
                            {
                                if (dbw.isBookBusy(_data))
                                {
                                    string expireddays = GetExpiredDays(BookRecordWork.inv);
                                    dbw.setBookReturned(BookRecordWork.id, BookRecordWork);

                                    if (int.Parse(expireddays) > 0)
                                    {
                                        MessageBox.Show("������� ������ ����� ��������� �� " + expireddays + " ����. ����� ���������� " + CalculatePeny(BookRecordWork.vzv, DateTime.Today).ToString() + " ���.", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }

                                    dataGridView1.Rows.Insert(0, 1);
                                    dataGridView1.Rows[0].Cells[0].Value = BookRecordWork.inv;
                                    dataGridView1.Rows[0].Cells[1].Value = BookRecordWork.name;
                                    if (BookRecordWork.rname == "-1")
                                    {
                                        BookRecordWork.rname = "����������";
                                    }
                                    dataGridView1.Rows[0].Cells[2].Value = BookRecordWork.rname;
                                    dataGridView1.Rows[0].Cells[3].Value = "����������";
                                    dbw.InsertActionRETURNED(new DBWork.dbReader(BookRecordWork.rbar), BookRecordWork);
                                    BookRecord = null;
                                    ReaderRecord = null;
                                    button2.Enabled = false;
                                    button4.Enabled = false;
                                    label1.Text = "�������� �������� �������";
                                    //MessageBox.Show("����� ����������!", "����������", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    this.emul = "";
                                    return;
                                }
                                else
                                {
                                    this.label8.Text = BookRecordWork.author;
                                    this.label9.Text = BookRecordWork.name;
                                    this.label1.Text = "�������� ����� ��� ��������";
                                    this.button4.Enabled = true;
                                    BookRecord = BookRecordWork.Clone();
                                    this.emul = "";
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (BookRecord != null)
                        {
                            MessageBox.Show("����������� ���������� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            button2.Enabled = true;
                            button4.Enabled = true;
                            this.emul = "";
                            return;
                        }
                        else
                        {
                            this.label1.Text = "�������� ����� ��� �������!";
                            BookRecord = null;
                            ReaderRecord = null;
                        }
                    }

                    /*if (dbw.isReader(_data))
                        ReaderRecord = dbw.getDbReader(_data);
                    else
                        BookRecord = dbw.getDbBook(_data);*/
                    this.emul = "";
                    break;
                    #endregion
                case "�������":
                    //timer1.Enabled = false;
                    label1.Enabled = false;
                    //timer2.Enabled = false;
                    label16.Visible = false;
                    break;

            }
        }
 public ReaderRegistrationInMoscow(DBWork.dbReader reader_)
 {
     InitializeComponent();
     reader = reader_;
 }
Пример #6
0
 private void button5_Click(object sender, EventArgs e)
 {
     ReaderSetBarcode = new DBWork.dbReader((int)numericUpDown2.Value);
     if (ReaderSetBarcode.barcode == "error")
     {
         MessageBox.Show("�������� �� ������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         textBox2.Text = "";
         textBox3.Text = "";
         textBox4.Text = "";
         textBox5.Text = "";
         button6.Enabled = false;
         return;
     }
     textBox2.Text = ReaderSetBarcode.Surname;
     textBox3.Text = ReaderSetBarcode.Name;
     textBox4.Text = ReaderSetBarcode.SecondName;
     textBox5.Text = "R" + ReaderSetBarcode.barcode;
     button8.Visible = true;
     //timer2.Enabled = true;
     label16.Visible = true;
     //tabControl1.Enabled = false;
     groupBox4.Enabled = false;
 }
Пример #7
0
 private void button4_Click(object sender, EventArgs e)
 {
     //dbw.isBookBusy("");
     this.label8.Text = "";
     this.label9.Text = "";
     this.label5.Text = "";
     BookRecord = null;
     ReaderRecord = null;
     label1.Text = "�������� �������� �������";
     button2.Enabled = false;
     button4.Enabled = false;
 }
Пример #8
0
        private void button10_Click(object sender, EventArgs e)
        {
            //dbw.GetFormular("1000001");

            if (this.numericUpDown3.Value.ToString() == "")
            {
                MessageBox.Show("������� ����� ��������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (this.numericUpDown3.Value <= 0)
            {
                MessageBox.Show("������� ����� ������ ����", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            ReaderSetBarcode = new DBWork.dbReader((int)numericUpDown3.Value);
            if (ReaderSetBarcode.barcode == "error")
            {
                MessageBox.Show("�������� �� ������!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            OldBase(ReaderSetBarcode);
            dbw.GetFormular(ReaderSetBarcode.id);
            label20.Text = ReaderSetBarcode.Surname + " " + ReaderSetBarcode.Name + " " + ReaderSetBarcode.SecondName;
            textBox6.Text = ReaderSetBarcode.AbonType;
            label25.Text = ReaderSetBarcode.id;
            ReaderRecordFormular = new DBWork.dbReader(ReaderSetBarcode);

            this.FormularColumnsForming(ReaderSetBarcode.id);
        }
Пример #9
0
        public void FrmlrFam(string id)
        {
            ReaderRecordFormular = new DBWork.dbReader(int.Parse(id));

            dbw.GetFormular(ReaderRecordFormular.id);
            ReaderSetBarcode = new DBWork.dbReader(ReaderRecordFormular);
            label20.Text = ReaderRecordFormular.Surname + " " + ReaderRecordFormular.Name + " " + ReaderRecordFormular.SecondName;
            textBox6.Text = ReaderRecordFormular.AbonType;
            label25.Text = ReaderRecordFormular.id;
            FormularColumnsForming(ReaderRecordFormular.id);
        }
Пример #10
0
        public void button2_Click_1(object sender, EventArgs e)
        {
            //FindReaderInOldBase(ReaderRecord);
            if (ReaderRecord.RegInMos != DateTime.MinValue)
            {
                if ((ReaderRecord.RegInMos - DateTime.Today).Days < 60)
                {
                    MessageBox.Show("� �������� ������������� ���� ����������� � ������! �������� ����� 60 ����!", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.emul = "";
                }
            }

            bool set = false;
            //long copy_tStatus;
            //copy_tStatus = 0;
            if (dbw.isBookBusy(BookRecord.barcode))
            {
                MessageBox.Show("����� � ������� ��������! ���� ��������: " + dbw.GetDateRet(BookRecord.barcode) + ".", "��������!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                this.label8.Text = "";
                this.label9.Text = "";
                this.label5.Text = "";
                BookRecord = null;
                ReaderRecord = null;
            }
            else
            {
                if (dbw.isReaderHaveRights(ReaderRecord))
                {
                    if (!dbw.isRightsExpired(ReaderRecord.id))
                    {
                        set = true;
                    }
                    else
                    {
                        switch (MessageBox.Show("� ������� �������� ���������� ���� ���� ����������� ������������ �����������! ������ �������� ����� ������������ ����� �� ��������� ���� ������������� ���������� � ������ ��� �����?", "��������!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
                        {
                            case DialogResult.Yes:
                                set = true;
                                dbw.ProlongRights(ReaderRecord.id);
                                break;
                            case DialogResult.No:
                                set = false;
                                this.label8.Text = "";
                                this.label9.Text = "";
                                this.label5.Text = "";
                                BookRecord = null;
                                ReaderRecord = null;
                                button2.Enabled = false;
                                button4.Enabled = false;
                                label1.Text = "�������� �������� �������";
                                break;
                            case DialogResult.Cancel:
                                set = false;
                                break;
                        }

                    }

                }
                else
                {
                    switch (MessageBox.Show("� ������� �������� ��� ���� ��� ��������� ���� ������������� ����������! ������ ������ ����� ������������ ����� �� ��������� ���� ������������� ���������� � ������ ��� �����?", "��������!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
                    {
                        case DialogResult.Yes:
                            set = true;
                            dbw.setReaderRight(ReaderRecord.id);
                            break;
                        case DialogResult.No:
                            set = false;
                            this.label8.Text = "";
                            this.label9.Text = "";
                            this.label5.Text = "";
                            BookRecord = null;
                            ReaderRecord = null;
                            button2.Enabled = false;
                            button4.Enabled = false;
                            label1.Text = "�������� �������� �������";
                            break;
                        case DialogResult.Cancel:
                            set = false;
                            break;
                    }

                }
                if (set)
                {
                    /*if (ReaderRecord.AbonType == "��� ��������")
                    {
                        MessageBox.Show("� ������� �������� �� ��������� �������� ���� ����������. ������ ����������. ������� ��������� �������� ��� ���������� �� ������� \"�������� ��������\"�", "��������!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }*/
                    if (dbw.GetBookCountForReader(ReaderRecord.id) >= 5)
                    {
                        switch (MessageBox.Show("������ �������� �������� ����� ����� 5 ����. ������ ���������� ������?", "��������!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                        {
                            case DialogResult.No:
                                this.label8.Text = "";
                                this.label9.Text = "";
                                this.label5.Text = "";
                                BookRecord = null;
                                ReaderRecord = null;
                                button2.Enabled = false;
                                button4.Enabled = false;
                                label1.Text = "�������� �������� �������";
                                return;
                            case DialogResult.Yes:
                                dbw.setBookForReader(BookRecord, ReaderRecord, (int)numericUpDown1.Value);
                                dataGridView1.Rows.Insert(0, 1);
                                dataGridView1.Rows[0].Cells[0].Value = BookRecord.inv;
                                dataGridView1.Rows[0].Cells[1].Value = BookRecord.name;
                                BookRecord = new DBWork.dbBook(BookRecord.barcode);
                                dataGridView1.Rows[0].Cells[2].Value = ReaderRecord.FIO;
                                dataGridView1.Rows[0].Cells[3].Value = "������";
                                this.label8.Text = "";
                                this.label9.Text = "";
                                this.label5.Text = "";
                                dbw.InsertActionISSUED(ReaderRecord,BookRecord);
                                BookRecord = null;
                                ReaderRecord = null;
                                button2.Enabled = false;
                                button4.Enabled = false;
                                label1.Text = "�������� �������� �������";
                                break;
                        }

                    }
                    else
                    {
                        dbw.setBookForReader(BookRecord, ReaderRecord, (int)numericUpDown1.Value);
                        dataGridView1.Rows.Insert(0, 1);
                        dataGridView1.Rows[0].Cells[0].Value = BookRecord.inv;
                        dataGridView1.Rows[0].Cells[1].Value = BookRecord.name;
                        BookRecord = new DBWork.dbBook(BookRecord.barcode);
                        dataGridView1.Rows[0].Cells[2].Value = ReaderRecord.FIO;
                        dataGridView1.Rows[0].Cells[3].Value = "������";
                        this.label8.Text = "";
                        this.label9.Text = "";
                        this.label5.Text = "";
                        dbw.InsertActionISSUED(ReaderRecord,BookRecord);
                        BookRecord = null;
                        ReaderRecord = null;
                        button2.Enabled = false;
                        button4.Enabled = false;
                        label1.Text = "�������� �������� �������";
                    }

                }
            }
            BookRecord = null;
            ReaderRecord = null;
        }