示例#1
0
文件: Form8.cs 项目: infra-hdc/LIBFL
        public Form8(dbReader reader)
        {
            InitializeComponent();
            label2.Text = reader.FIO;
            Conn.SQLDA.SelectCommand.CommandText = "select A.ID,C.PLAIN zag, E.PLAIN avt,A.PDATE, A.INV, A.SUM from Reservation_R..PENY_HIST A" +
                                                   " inner join BJVVV..DATAEXT B on A.IDMAIN = B.IDMAIN and B.MNFIELD = 200 and B.MSFIELD = '$a' " +
                                                   " inner join BJVVV..DATAEXTPLAIN C on B.ID = C.IDDATAEXT " +
                                                   " inner join BJVVV..DATAEXT D on A.IDMAIN = D.IDMAIN and D.MNFIELD = 700 and D.MSFIELD = '$a' " +
                                                   " inner join BJVVV..DATAEXTPLAIN E on D.ID = E.IDDATAEXT " +
                                                   " where A.IDREADER = " + reader.id;
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            DataSet DS = new DataSet();

            Conn.SQLDA.Fill(DS, "lll");
            dataGridView1.DataSource = DS.Tables["lll"];

            dataGridView1.Columns["PDATE"].HeaderText = "Дата выплаты";
            dataGridView1.Columns["INV"].HeaderText   = "Инвентарный номер";
            dataGridView1.Columns["ZAG"].HeaderText   = "Заглавие";
            dataGridView1.Columns["AVT"].HeaderText   = "Автор";
            dataGridView1.Columns["SUM"].HeaderText   = "Сумма штрафа";
            dataGridView1.Columns["ID"].HeaderText    = "№№";
            dataGridView1.Columns["ID"].Width         = 40;
            int i = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                row.Cells["ID"].Value = (++i).ToString();
            }
            dataGridView1.Columns["ZAG"].Width = 300;
            dataGridView1.Columns["ZAG"].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
        }
示例#2
0
 public Form9(dbReader reader_)
 {
     InitializeComponent();
     reader      = reader_;
     label2.Text = reader.FIO;
     MethodsForCurBase.FormTable(reader, dataGridView1);
 }
示例#3
0
文件: Form10.cs 项目: infra-hdc/LIBFL
        private bool FindReaderInOldBase(dbReader reader)
        {
            Conn.SQLDA.SelectCommand.CommandText = " select * from AbonOld..Main " +
                                                   " where lower(FullName) like ltrim(rtrim( (lower('" +
                                                   reader.Surname + " " + reader.Name + " " + reader.SecondName + " " + "'))))+'%' ";

            DataSet DS  = new DataSet();
            int     cnt = Conn.SQLDA.Fill(DS, "old");

            if (cnt == 0)
            {
                return(false);
            }
            dataGridView1.DataSource                = DS.Tables["old"];
            dataGridView1.Columns[0].Visible        = false;
            dataGridView1.Columns[1].HeaderText     = "Номер читателя";
            dataGridView1.Columns[2].HeaderText     = "ФИО";
            dataGridView1.Columns[3].HeaderText     = "Дата рождения";
            dataGridView1.Columns[4].HeaderText     = "Документ";
            dataGridView1.Columns[5].HeaderText     = "Вид абонемента";
            dataGridView1.Columns[6].HeaderText     = "Телефон";
            dataGridView1.Columns[7].HeaderText     = "Учебное заведение";
            dataGridView1.Columns[8].HeaderText     = "Адрес";
            dataGridView1.Columns[8].Visible        = false;
            dataGridView1.Columns[9].HeaderText     = "Индекс";
            dataGridView1.Columns[10].HeaderText    = "Страна";
            dataGridView1.Columns[11].HeaderText    = "Область";
            dataGridView1.Columns[12].HeaderText    = "Город";
            dataGridView1.Columns[13].HeaderText    = "Улица";
            dataGridView1.Columns[14].HeaderText    = "Дом";
            dataGridView1.Columns[15].HeaderText    = "Индекс2";
            dataGridView1.Columns[16].HeaderText    = "Страна2";
            dataGridView1.Columns[17].HeaderText    = "Область2";
            dataGridView1.Columns[18].HeaderText    = "Город2";
            dataGridView1.Columns[19].HeaderText    = "Улица2";
            dataGridView1.Columns[20].HeaderText    = "Дом2";
            dataGridView1.Columns[21].HeaderText    = "Дата регистрации";
            dataGridView1.Columns[22].HeaderText    = "Дата перерегистрации";
            dataGridView1.Columns[23].HeaderText    = "Потерян";
            dataGridView1.Columns[24].HeaderText    = "Научная степень";
            dataGridView1.Columns[25].HeaderText    = "Отдел";
            dataGridView1.Columns[26].HeaderText    = "Сектор";
            dataGridView1.Columns[27].HeaderText    = "Номер комнаты";
            dataGridView1.Columns[28].HeaderText    = "Местонахождение";
            dataGridView1.Columns[29].HeaderText    = "Email";
            dataGridView1.Columns[30].HeaderText    = "Отделение библиотеки";
            dataGridView1.Columns[31].HeaderText    = "Коментарии";
            dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            MethodsForCurBase.FormTable(reader, dataGridView2);
            return(true);
        }
示例#4
0
        public Form11(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();
        }
示例#5
0
文件: Form10.cs 项目: infra-hdc/LIBFL
        private void SetChecked(dbReader reader)
        {
            SqlCommand cmd = new SqlCommand("[Readers]..[setchk]", Conn.ReadersCon);

            if (cmd.Connection.State == ConnectionState.Closed)
            {
                cmd.Connection.Open();
            }
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@IDR", SqlDbType.Int);
            cmd.Parameters["@IDR"].Value = reader.id;
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();
        }
示例#6
0
文件: Form10.cs 项目: infra-hdc/LIBFL
 public Form10(dbReader reader_)
 {
     InitializeComponent();
     this.reader = reader_;
     if (!FindReaderInOldBase(reader))
     {
         MessageBox.Show("Был произведен поиск по фамилии читателя в старой базе для переноса его комментариев и долгов, но читателей с такими фамилиями не нашлось.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
         SetChecked(reader);
         canShow = false;
     }
     else
     {
         canShow = true;
     }
     //FindReaderInOldBase(new DBWork.dbReader(22577));
 }
示例#7
0
 public dbReader(dbReader Reader)
 {
     this.barcode        = Reader.barcode;
     this.FIO            = Reader.FIO;
     this.id             = Reader.id;
     this.Surname        = Reader.Surname;
     this.Name           = Reader.Name;
     this.SecondName     = Reader.SecondName;
     this.AbonType       = Reader.AbonType;
     this.IsWasInOldBase = Reader.IsWasInOldBase;
     this.RegInMos       = Reader.RegInMos;
     this.rlocation      = Reader.rlocation;
     this.ReaderRights   = Reader.ReaderRights;
     this.CanGetAtHome   = Reader.CanGetAtHome;
     this.Department     = Reader.Department;
     this.Photo          = Reader.Photo;
 }
示例#8
0
文件: Form10.cs 项目: infra-hdc/LIBFL
        private int UpdateBooks(string idrold, dbReader reader)
        {
            SqlCommand cmd = new SqlCommand("[Reservation_R]..[updbooks]", Conn.ZakazCon);

            if (Conn.ZakazCon.State != ConnectionState.Open)
            {
                Conn.ZakazCon.Open();
            }
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@IDR", SqlDbType.Int);
            cmd.Parameters.Add("@IDROLD", SqlDbType.NVarChar);
            cmd.Parameters["@IDR"].Value    = reader.id;
            cmd.Parameters["@IDROLD"].Value = idrold;

            int i = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(i);
        }
示例#9
0
文件: Form10.cs 项目: infra-hdc/LIBFL
        private void InsertComment(string idrold, dbReader reader, Notes nts)
        {
            SqlCommand cmd = new SqlCommand("[Readers]..[updcomment]", Conn.ReadersCon);

            cmd.CommandType = CommandType.StoredProcedure;
            if (cmd.Connection.State == ConnectionState.Closed)
            {
                cmd.Connection.Open();
            }
            cmd.Parameters.Add("@IDR", SqlDbType.Int);
            cmd.Parameters.Add("@COMMENT", SqlDbType.NVarChar);
            cmd.Parameters.Add("@NOTE", SqlDbType.NVarChar);
            cmd.Parameters["@IDR"].Value     = reader.id;
            cmd.Parameters["@COMMENT"].Value = nts.Comment;
            cmd.Parameters["@NOTE"].Value    = nts.Note;

            cmd.ExecuteNonQuery();
            cmd.Connection.Close();
        }
示例#10
0
文件: Form7.cs 项目: infra-hdc/LIBFL
        public Form7(dbReader reader, string BASENAME)
        {
            InitializeComponent();
            label2.Text = reader.FIO;
            Conn.SQLDA.SelectCommand.CommandText = "select A.ID,(case when A.INV = '-1' then EE.[NAME] else C.PLAIN end) as zag, " +
                                                   " E.PLAIN avt,A.DATE_ISSUE,A.DATE_RET, A.ZALISS,(case when A.INV = '-1' then EE.BARCODE else A.INV end) as INV " +
                                                   " from " + BASENAME + "..ISSUED_OF_HST A" +
                                                   " left join BJVVV..DATAEXT B on A.IDMAIN = B.IDMAIN and B.MNFIELD = 200 and B.MSFIELD = '$a' " +
                                                   " left join BJVVV..DATAEXTPLAIN C on B.ID = C.IDDATAEXT " +
                                                   " left join BJVVV..DATAEXT D on A.IDMAIN = D.IDMAIN and D.MNFIELD = 700 and D.MSFIELD = '$a' " +
                                                   " left join BJVVV..DATAEXTPLAIN E on D.ID = E.IDDATAEXT " +
                                                   " left join " + BASENAME + "..PreDescr EE on EE.BARCODE = A.BAR " +
                                                   " where A.IDREADER = " + reader.id;
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            DataSet DS = new DataSet();
            int     t  = Conn.SQLDA.Fill(DS, "lll");

            dataGridView1.DataSource = DS.Tables["lll"];

            dataGridView1.Columns["DATE_ISSUE"].HeaderText = "Дата выдачи";
            dataGridView1.Columns["DATE_ISSUE"].Width      = 70;
            dataGridView1.Columns["DATE_RET"].HeaderText   = "Дата возврата";
            dataGridView1.Columns["DATE_RET"].Width        = 70;
            dataGridView1.Columns["ZALISS"].HeaderText     = "Выдано в зале";
            dataGridView1.Columns["INV"].HeaderText        = "Инв номер/ шкод";
            dataGridView1.Columns["ZAG"].HeaderText        = "Заглавие";
            dataGridView1.Columns["AVT"].HeaderText        = "Автор";
            dataGridView1.Columns["ID"].HeaderText         = "№№";
            dataGridView1.Columns["ID"].Width = 40;
            int i = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                row.Cells["ID"].Value = (++i).ToString();
            }
            dataGridView1.Columns["ZAG"].Width = 300;
            dataGridView1.Columns["ZAG"].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
        }
示例#11
0
        public static void FormTable(dbReader reader, DataGridView dataGridView1)
        {
            Conn.SQLDA.SelectCommand.CommandText = "select * from Readers..Main where NumberReader = " + reader.id;
            Conn.SQLDA.SelectCommand.Connection  = Conn.ZakazCon;
            DataSet DS = new DataSet();

            Conn.SQLDA.Fill(DS, "lll");
            dataGridView1.Columns.Add("value", "");
            dataGridView1.ColumnHeadersVisible = false;
            dataGridView1.RowHeadersWidth      = 296;
            dataGridView1.Columns[0].Width     = 436;
            int i = 0;
            Dictionary <string, string> FieldsCaptions = new Dictionary <string, string>();

            Conn.SQLDA.SelectCommand.CommandText = "      USE Readers;  " +
                                                   "SELECT " +
                                                   "             [Table Name] = OBJECT_NAME(c.object_id),  " +
                                                   "             [Column Name] = c.name,  " +
                                                   "             [Description] = ex.value   " +
                                                   "       FROM   " +
                                                   "             sys.columns c   " +
                                                   "       LEFT OUTER JOIN   " +
                                                   "             sys.extended_properties ex   " +
                                                   "       ON   " +
                                                   "             ex.major_id = c.object_id  " +
                                                   "             AND ex.minor_id = c.column_id   " +
                                                   "             AND ex.name = 'MS_Description'   " +
                                                   "       WHERE   " +
                                                   "             OBJECTPROPERTY(c.object_id, 'IsMsShipped')=0   " +
                                                   "             AND OBJECT_NAME(c.object_id) = 'Main' " +
                                                   "       ORDER  " +
                                                   "             BY OBJECT_NAME(c.object_id), c.column_id;";
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            //DataSet DS = new DataSet();
            Conn.SQLDA.Fill(DS, "fldcap");
            foreach (DataRow r in DS.Tables["fldcap"].Rows)
            {
                FieldsCaptions.Add(r["Column Name"].ToString(), r["Description"].ToString());
            }
            foreach (DataColumn col in DS.Tables["lll"].Columns)
            {
                if ((col.ColumnName == "AbonementType") ||
                    (col.ColumnName == "SheetWithoutCard") ||
                    (col.ColumnName == "Password") ||
                    (col.ColumnName == "FamilyNameFind") ||
                    (col.ColumnName == "NameFind") ||
                    (col.ColumnName == "FatherNameFind") ||
                    (col.ColumnName == "Interest") ||
                    (col.ColumnName == "DocumentNumber") ||
                    (col.ColumnName == "DateRegistration") ||
                    (col.ColumnName == "DateReRegistration") ||
                    (col.ColumnName == "MobileTelephone") ||
                    (col.ColumnName == "WorkCity") ||
                    (col.ColumnName == "WorkName") ||
                    (col.ColumnName == "WorkPosition") ||
                    (col.ColumnName == "WorkTelephone") ||
                    (col.ColumnName == "WorkTelephoneAdd") ||
                    (col.ColumnName == "WorkDepartment") ||
                    (col.ColumnName == "RegistrationPostOffice") ||
                    (col.ColumnName == "RegistrationCountry") ||
                    (col.ColumnName == "RegistrationRegion") ||
                    (col.ColumnName == "RegistrationProvince") ||
                    (col.ColumnName == "RegistrationDistrict") ||
                    (col.ColumnName == "RegistrationCity") ||
                    (col.ColumnName == "RegistrationStreet") ||
                    (col.ColumnName == "RegistrationHouse") ||
                    (col.ColumnName == "RegistrationFlat") ||
                    (col.ColumnName == "RegistrationTelephone") ||
                    (col.ColumnName == "LivePostOffice") ||
                    (col.ColumnName == "LiveCountry") ||
                    (col.ColumnName == "LiveRegion") ||
                    (col.ColumnName == "LiveProvince") ||
                    (col.ColumnName == "LiveDistrict") ||
                    (col.ColumnName == "LiveCity") ||
                    (col.ColumnName == "LiveStreet") ||
                    (col.ColumnName == "LiveHouse") ||
                    (col.ColumnName == "LiveFlat") ||
                    (col.ColumnName == "LiveTelephone") ||
                    (col.ColumnName == "WordReg") ||
                    (col.ColumnName == "Email") ||
                    (col.ColumnName == "NumberSC") ||
                    (col.ColumnName == "SerialSC") ||
                    (col.ColumnName == "Document") ||
                    (col.ColumnName == "ClassInfringer") ||
                    (col.ColumnName == "SheetWithoutCardData") ||
                    (col.ColumnName == "SpecialNote") ||
                    (col.ColumnName == "EditorCreate") ||
                    (col.ColumnName == "EditorEnd") ||
                    (col.ColumnName == "EditEndDate") ||
                    (col.ColumnName == "EditorNow") ||
                    (col.ColumnName == "SelfRecord") ||
                    (col.ColumnName == "ReRegistration") ||
                    (col.ColumnName == "AbonementType") ||
                    (col.ColumnName == "InBlackList") ||
                    (col.ColumnName == "Photo") ||
                    (col.ColumnName == "InputAlwaysDate")
                    )
                {
                    continue;
                }
                dataGridView1.Rows.Add();
                dataGridView1.Rows[i].HeaderCell.Value = FieldsCaptions[col.ColumnName];
                string value = DS.Tables["lll"].Rows[0][col].ToString();
                value = MethodsForCurBase.GetValueFromList(col.ColumnName, value);
                value = MethodsForCurBase.GetRightBoolValue(value);
                if (DS.Tables["lll"].Rows[0][col].GetType() == typeof(DateTime))
                {
                    value = ((DateTime)DS.Tables["lll"].Rows[0][col]).ToShortDateString();
                }
                if (dataGridView1.Rows[i].HeaderCell.Value.ToString() == "Инвалидность")
                {
                    if (value == "1")
                    {
                        value = "нет";
                    }
                    else
                    {
                        value = "да";
                    }
                }
                dataGridView1.Rows[i].Cells[0].Value = value;
                i++;
            }

            /*Conn.SQLDA.SelectCommand.CommandText = "select B.NameInterest intr from Readers..Interest A inner join Readers..InterestList B on A.IDInterest = B.IDInterest where IDReader = " + reader.id;
             * Conn.SQLDA.Fill(DS, "itrs");
             * foreach (DataRow r in DS.Tables["itrs"].Rows)
             * {
             *  dataGridView1.Rows.Add();
             *  dataGridView1.Rows[i].HeaderCell.Value = "Интерес";
             *  dataGridView1.Rows[i].Cells[0].Value = r["intr"].ToString();
             *  i++;
             * }
             * Conn.SQLDA.SelectCommand.CommandText = "select B.NameLanguage lng from Readers..Language A inner join Readers..LanguageList B on A.IDLanguage = B.IDLanguage where IDReader = " + reader.id;
             * Conn.SQLDA.Fill(DS, "lng");
             * foreach (DataRow r in DS.Tables["lng"].Rows)
             * {
             *  dataGridView1.Rows.Add();
             *  dataGridView1.Rows[i].HeaderCell.Value = "Язык";
             *  dataGridView1.Rows[i].Cells[0].Value = r["lng"].ToString();
             *  i++;
             * }*/
            Conn.SQLDA.SelectCommand.CommandText = "select B.SHORTNAME dep from Readers..ReaderRight A inner join BJVVV..LIST_8 B on A.IDOrganization = B.ID where A.IDReader = " + reader.id;
            Conn.SQLDA.Fill(DS, "d");
            foreach (DataRow r in DS.Tables["d"].Rows)
            {
                dataGridView1.Rows.Add();
                dataGridView1.Rows[i].HeaderCell.Value = "Отдел (если сотрудник)";
                dataGridView1.Rows[i].Cells[0].Value   = r["dep"].ToString();
                i++;
            }
        }
示例#12
0
        public dbBook(string Bar, string BASENAME)
        {
            this.NumbersCount = 1;
            this.BASENAME     = BASENAME;
            Conn.SQLDA.SelectCommand.CommandText = "select  ID, IDMAIN, SORT, IDDATA from BJVVV..DATAEXT where SORT = '" + Bar + "' and MNFIELD = 899 and MSFIELD = '$w'";
            Conn.SQLDA.SelectCommand.Connection  = Conn.BRIT_SOVETCon;
            DataSet B = new DataSet();
            int     i = Conn.SQLDA.Fill(B);

            this.additionalNumbers = "";
            if (i == 0) // не найдено в основной базе
            {
                Conn.SQLDA.SelectCommand.CommandText = "select  ID, IDMAIN, SORT, IDDATA from REDKOSTJ..DATAEXT where SORT = '" + Bar + "' and MNFIELD = 899 and MSFIELD = '$w'";
                Conn.SQLDA.SelectCommand.Connection  = Conn.BRIT_SOVETCon;
                B = new DataSet();
                i = Conn.SQLDA.Fill(B);
                int ParseResult;
                if (i == 0)//не найдено в базе редкость
                {
                    if ((Bar.IndexOf("U") == 0) && (Bar.Length == 10) && int.TryParse(Bar.Substring(1, 9), out ParseResult))
                    {
                        Conn.SQLDA.SelectCommand.CommandText = "select  * from " + BASENAME + "..PreDescr where BARCODE = '" + Bar + "'";
                        Conn.SQLDA.SelectCommand.Connection  = Conn.BRIT_SOVETCon;
                        B = new DataSet();
                        i = Conn.SQLDA.Fill(B);
                        if (i == 0)
                        {
                            //не найдена в таблице преописания
                            this.id      = "надовводить";
                            this.barcode = Bar;
                        }
                        else
                        {
                            //найдена в таблице преописания
                            this.name              = B.Tables[0].Rows[0]["NAME"].ToString();
                            this.barcode           = B.Tables[0].Rows[0]["BARCODE"].ToString();
                            this.year              = B.Tables[0].Rows[0]["YEAR"].ToString();
                            this.code              = B.Tables[0].Rows[0]["CODE"].ToString();
                            this.number            = B.Tables[0].Rows[0]["NUMBER"].ToString();
                            this.mainfund          = (bool)B.Tables[0].Rows[0]["MAINFUND"];
                            this.redk              = false;
                            this.religion          = false;
                            this.ChgKlass          = DateTime.Now;
                            this.id                = "-1";
                            this.inv               = "-1";
                            this.iddata            = "0";
                            this.additionalNumbers = B.Tables[0].Rows[0]["ADDNUMBERS"].ToString();
                            if (this.mainfund)
                            {
                                this.klass = "Для выдачи";
                            }
                            else
                            {
                                this.klass  = "ДП";
                                this.RESPAN = "ДП";
                            }
                            Conn.SQLDA.SelectCommand.CommandText = "select * from " + BASENAME + "..ISSUED_OF where IDMAIN_CONST = "
                                                                   + this.id + " and BAR  = '" + this.barcode + "'";
                            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
                            B          = new DataSet();
                            this.rname = "";
                            this.rid   = "-1";
                            try
                            {
                                i        = Conn.SQLDA.Fill(B);
                                this.rid = B.Tables[0].Rows[0]["IDREADER"].ToString();

                                this.vzv = DateTime.Parse(B.Tables[0].Rows[0]["DATE_RET"].ToString());
                                //this.fctvzv = DateTime.Parse(B.Tables[0].Rows[0]["DATE_FACT_VOZV"].ToString());
                                this.FirstIssue = DateTime.Parse(B.Tables[0].Rows[0]["DATE_ISSUE"].ToString());
                                if (this.klass == "ДП")
                                {
                                    this.RESPAN = "ДП";
                                }
                                else
                                {
                                    this.RESPAN = B.Tables[0].Rows[0]["RESPAN"].ToString();
                                }
                                this.idemp = B.Tables[0].Rows[0]["IDEMP"].ToString();
                            }
                            catch
                            {
                                this.rname = "";
                            }
                            if ((this.rid != "") && (this.rid != "-1"))
                            {
                                Conn.ReaderDA.SelectCommand.CommandText = "select NumberReader, BarCode, FamilyName, Name, FatherName from main where NumberReader = " + this.rid;
                                DataSet R = new DataSet();
                                Conn.ReaderDA.Fill(R);
                                string name       = "";
                                string secondName = "";
                                try
                                {
                                    name = R.Tables[0].Rows[0]["Name"].ToString().Remove(1, R.Tables[0].Rows[0]["Name"].ToString().Length - 1) + ". ";
                                }
                                catch
                                {
                                    name = "";
                                }
                                try
                                {
                                    secondName = R.Tables[0].Rows[0]["FatherName"].ToString().Remove(1, R.Tables[0].Rows[0]["FatherName"].ToString().Length - 1) + ".";
                                }
                                catch
                                {
                                    secondName = "";
                                }
                                this.rname = R.Tables[0].Rows[0]["FamilyName"].ToString() + " " + name + secondName;
                            }
                        }
                    }
                    else
                    {
                        this.id = "Неверный штрихкод";
                        return;
                    }
                }
                else //найдено в редкости
                {
                    this.redk = true;
                    string IDDATA = B.Tables[0].Rows[0]["IDDATA"].ToString();
                    this.iddata  = IDDATA;
                    this.id      = B.Tables[0].Rows[0]["IDMAIN"].ToString();
                    this.barcode = B.Tables[0].Rows[0]["SORT"].ToString();
                    Conn.SQLDA.SelectCommand.CommandText = "select  ID, IDMAIN, SORT, IDDATA from REDKOSTJ..DATAEXT where IDDATA = '" + IDDATA + "' and MNFIELD = 899 and MSFIELD = '$p'";
                    Conn.SQLDA.SelectCommand.Connection  = Conn.BRIT_SOVETCon;
                    B = new DataSet();
                    i = Conn.SQLDA.Fill(B);
                    string INV = B.Tables[0].Rows[0]["SORT"].ToString();

                    Conn.SQLDA.SelectCommand.CommandText = "WITH FC AS (SELECT dt.ID,dt.SORT, " +
                                                           "dt.MNFIELD, " +
                                                           "dt.MSFIELD, " +
                                                           "dt.IDMAIN, " +
                                                           "dtp.PLAIN " +
                                                           "FROM   REDKOSTJ..DATAEXT dt " +
                                                           "       JOIN REDKOSTJ..DATAEXTPLAIN dtp " +
                                                           "            ON  dt.ID = dtp.IDDATAEXT) " +
                                                           "select  COL1.PLAIN zag,dtpa.PLAIN avt from FC COL1 " +
                                                           "left join FC dtpa ON COL1.IDMAIN = dtpa.IDMAIN and dtpa.MNFIELD = 700 and dtpa.MSFIELD = '$a' " +
                                                           "where COL1.MNFIELD = 200 and COL1.MSFIELD = '$a'  and COL1.IDMAIN = " + this.id;
                    Conn.SQLDA.SelectCommand.Connection = Conn.BRIT_SOVETCon;
                    B           = new DataSet();
                    i           = Conn.SQLDA.Fill(B);
                    this.name   = B.Tables[0].Rows[0]["zag"].ToString();
                    this.author = B.Tables[0].Rows[0]["avt"].ToString();
                    Conn.SQLDA.SelectCommand.CommandText = "select B.SORT from REDKOSTJ..DATAEXT A, REDKOSTJ..DATAEXT B " +
                                                           " where A.IDMAIN  = " + this.id + " and A.SORT = '" + this.barcode +
                                                           "' and A.MSFIELD = '$w' and A.MNFIELD = 899  and " +
                                                           " A.IDDATA = B.IDDATA and B.MNFIELD= 899 and B.MSFIELD = '$p' ";

                    B        = new DataSet();
                    i        = Conn.SQLDA.Fill(B);
                    this.inv = B.Tables[0].Rows[0]["SORT"].ToString();

                    //зал местонахождения книги
                    Conn.SQLDA.SelectCommand.CommandText = " select B.PLAIN from REDKOSTJ..DATAEXT A" +
                                                           " inner join REDKOSTJ..DATAEXTPLAIN B on A.ID = B.IDDATAEXT" +
                                                           " where A.IDDATA = " + IDDATA +
                                                           " and A.MNFIELD = 899 and A.MSFIELD = '$a'";
                    B        = new DataSet();
                    i        = Conn.SQLDA.Fill(B);
                    this.zal = B.Tables[0].Rows[0]["PLAIN"].ToString();
                    if (this.zal.Contains("нигохранени") || this.zal.Contains("редкой книги"))
                    {
                        this.klass = "Для выдачи";
                    }
                    else
                    {
                        this.klass = "ДП";
                    }

                    //id зала местонахождения
                    Conn.SQLDA.SelectCommand.CommandText = " select * from REDKOSTJ..LIST_8 " +
                                                           " where SHORTNAME = '" + this.zal + "'";
                    B          = new DataSet();
                    i          = Conn.SQLDA.Fill(B);
                    this.zalid = B.Tables[0].Rows[0]["ID"].ToString();

                    this.religion = false;

                    //класс издания
                    Conn.SQLDA.SelectCommand.CommandText = " select B.PLAIN,A.Changed from REDKOSTJ..DATAEXT A" +
                                                           " inner join REDKOSTJ..DATAEXTPLAIN B on A.ID = B.IDDATAEXT" +
                                                           " where A.IDDATA = " + IDDATA +
                                                           " and A.MNFIELD = 921 and A.MSFIELD = '$c'";
                    B = new DataSet();
                    i = Conn.SQLDA.Fill(B);
                    string o = "";
                    if (i != 0)
                    {
                        o = B.Tables[0].Rows[0]["Changed"].ToString();
                        //this.klass = B.Tables[0].Rows[0]["PLAIN"].ToString();
                    }

                    /*else
                     * {
                     *  o = B.Tables[0].Rows[0]["Changed"].ToString();
                     *  //this.klass = "no_klass";
                     * }*/
                    if (o != "")
                    {
                        this.ChgKlass = ((DateTime)B.Tables[0].Rows[0]["Changed"]).Date;
                    }
                    else
                    {
                        this.ChgKlass = DateTime.Now;
                    }
                    if (this.klass == "ДП")
                    {
                        this.RESPAN = "ДП";
                    }
                    else
                    {
                        this.RESPAN = "";
                    }

                    /*if (this.religion)//если книги из религизной коллекции, то выдавать и принимать как с классом ДП и только в зале рел.лит-ры
                     * {
                     *  this.klass = "ДП";
                     * }*/

                    Conn.SQLDA.SelectCommand.CommandText = "select * from " + BASENAME + "..ISSUED_OF where IDMAIN_CONST = " + this.id + " and INV  = '" + INV + "'";
                    Conn.SQLDA.SelectCommand.Connection  = Conn.ZakazCon;
                    B          = new DataSet();
                    this.rname = "";
                    this.rid   = "-1";
                    try
                    {
                        i        = Conn.SQLDA.Fill(B);
                        this.rid = B.Tables[0].Rows[0]["IDREADER"].ToString();

                        this.vzv = DateTime.Parse(B.Tables[0].Rows[0]["DATE_RET"].ToString());
                        //this.fctvzv = DateTime.Parse(B.Tables[0].Rows[0]["DATE_FACT_VOZV"].ToString());
                        this.FirstIssue = DateTime.Parse(B.Tables[0].Rows[0]["DATE_ISSUE"].ToString());
                        if (this.klass == "ДП")
                        {
                            this.RESPAN = "ДП";
                        }
                        else
                        {
                            this.RESPAN = B.Tables[0].Rows[0]["RESPAN"].ToString();
                        }
                        this.idemp = B.Tables[0].Rows[0]["IDEMP"].ToString();
                    }
                    catch
                    {
                        this.rname = "";
                    }
                    if ((this.rid != "") && (this.rid != "-1"))
                    {
                        Conn.ReaderDA.SelectCommand.CommandText = "select NumberReader, BarCode, FamilyName, Name, FatherName from main where NumberReader = " + this.rid;
                        DataSet R = new DataSet();
                        Conn.ReaderDA.Fill(R);
                        string name       = "";
                        string secondName = "";
                        try
                        {
                            name = R.Tables[0].Rows[0]["Name"].ToString().Remove(1, R.Tables[0].Rows[0]["Name"].ToString().Length - 1) + ". ";
                        }
                        catch
                        {
                            name = "";
                        }
                        try
                        {
                            secondName = R.Tables[0].Rows[0]["FatherName"].ToString().Remove(1, R.Tables[0].Rows[0]["FatherName"].ToString().Length - 1) + ".";
                        }
                        catch
                        {
                            secondName = "";
                        }
                        this.rname = R.Tables[0].Rows[0]["FamilyName"].ToString() + " " + name + secondName;
                    }
                }
            }
            else//===============================================================================================================================
            {
                this.redk = false;
                string IDDATA = B.Tables[0].Rows[0]["IDDATA"].ToString();
                this.iddata  = IDDATA;
                this.id      = B.Tables[0].Rows[0]["IDMAIN"].ToString();
                this.barcode = B.Tables[0].Rows[0]["SORT"].ToString();
                Conn.SQLDA.SelectCommand.CommandText = "select  ID, IDMAIN, SORT, IDDATA from BJVVV..DATAEXT where IDDATA = '" + IDDATA + "' and MNFIELD = 899 and MSFIELD = '$p'";
                Conn.SQLDA.SelectCommand.Connection  = Conn.BRIT_SOVETCon;
                B = new DataSet();
                i = Conn.SQLDA.Fill(B);
                string INV = B.Tables[0].Rows[0]["SORT"].ToString();

                Conn.SQLDA.SelectCommand.CommandText = "WITH FC AS (SELECT dt.ID,dt.SORT, " +
                                                       "dt.MNFIELD, " +
                                                       "dt.MSFIELD, " +
                                                       "dt.IDMAIN, " +
                                                       "dtp.PLAIN " +
                                                       "FROM   BJVVV..DATAEXT dt " +
                                                       "        JOIN BJVVV..DATAEXTPLAIN dtp " +
                                                       "            ON  dt.ID = dtp.IDDATAEXT) " +
                                                       "select  COL1.PLAIN zag,dtpa.PLAIN avt from FC COL1 " +
                                                       "left join FC dtpa ON COL1.IDMAIN = dtpa.IDMAIN and dtpa.MNFIELD = 700 and dtpa.MSFIELD = '$a' " +
                                                       "where COL1.MNFIELD = 200 and COL1.MSFIELD = '$a'  and COL1.IDMAIN = " + this.id;
                Conn.SQLDA.SelectCommand.Connection = Conn.BRIT_SOVETCon;
                B           = new DataSet();
                i           = Conn.SQLDA.Fill(B);
                this.name   = B.Tables[0].Rows[0]["zag"].ToString();;
                this.author = B.Tables[0].Rows[0]["avt"].ToString();
                Conn.SQLDA.SelectCommand.CommandText = "select B.SORT from BJVVV..DATAEXT A, BJVVV..DATAEXT B " +
                                                       " where A.IDMAIN  = " + this.id + " and A.SORT = '" + this.barcode +
                                                       "' and A.MSFIELD = '$w' and A.MNFIELD = 899  and " +
                                                       " A.IDDATA = B.IDDATA and B.MNFIELD= 899 and B.MSFIELD = '$p' ";
                B        = new DataSet();
                i        = Conn.SQLDA.Fill(B);
                this.inv = B.Tables[0].Rows[0]["SORT"].ToString();


                //зал местонахождения книги
                Conn.SQLDA.SelectCommand.CommandText = " select B.PLAIN from BJVVV..DATAEXT A" +
                                                       " inner join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT" +
                                                       " where A.IDDATA = " + IDDATA +
                                                       " and A.MNFIELD = 899 and A.MSFIELD = '$a'";
                B = new DataSet();
                i = Conn.SQLDA.Fill(B);
                if (i != 0)
                {
                    this.zal = B.Tables[0].Rows[0]["PLAIN"].ToString();
                    if (this.zal.Contains("нигохранени") || this.zal.Contains("бонемент") || this.zal.Contains("абонементного"))
                    {
                        this.klass = "Для выдачи";
                    }
                    else
                    {
                        this.klass = "ДП";
                    }
                }
                else
                {
                    this.klass = "Для выдачи";
                }

                //id зала местонахождения
                Conn.SQLDA.SelectCommand.CommandText = " select * from BJVVV..LIST_8 " +
                                                       " where SHORTNAME = '" + this.zal + "'";
                B = new DataSet();
                i = Conn.SQLDA.Fill(B);
                if (i != 0)
                {
                    this.zalid = B.Tables[0].Rows[0]["ID"].ToString();
                }

                //принадлежит ли екнига коллекции религ. лит?
                Conn.SQLDA.SelectCommand.CommandText = " select B.PLAIN from BJVVV..DATAEXT A" +
                                                       " inner join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT" +
                                                       " where A.IDDATA = " + IDDATA +
                                                       " and A.MNFIELD = 899 and A.MSFIELD = '$b' and 1=0 and" +
                                                       " (SORT = 'КоллекцияArdis' or SORT = 'КоллекцияBibliothecaHermetica' or SORT = 'КоллекцияYMCAPress' or SORT = 'КоллекцияЖизньсБогом' or SORT = 'КоллекцияЗернов')";
                B             = new DataSet();
                i             = Conn.SQLDA.Fill(B);
                this.religion = (i == 0) ? false : true;//отныне всегда false. коллекции сдают в книгохранение. пусть берут все.

                //класс издания
                Conn.SQLDA.SelectCommand.CommandText = " select B.PLAIN,A.Changed from BJVVV..DATAEXT A" +
                                                       " inner join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT" +
                                                       " where A.IDDATA = " + IDDATA +
                                                       " and A.MNFIELD = 921 and A.MSFIELD = '$c'";
                B = new DataSet();
                i = Conn.SQLDA.Fill(B);
                string o = "";
                if (i != 0)
                {
                    o = B.Tables[0].Rows[0]["Changed"].ToString();
                    //this.klass = B.Tables[0].Rows[0]["PLAIN"].ToString();
                }

                /*else
                 * {
                 *  o = B.Tables[0].Rows[0]["Changed"].ToString();
                 *  //this.klass = "no_klass";
                 * }*/

                if (o != "")
                {
                    this.ChgKlass = ((DateTime)B.Tables[0].Rows[0]["Changed"]).Date;
                }
                else
                {
                    this.ChgKlass = DateTime.Now;
                }

                if (this.religion)//если книги из религизной коллекции, то выдавать и принимать как с классом ДП и только в зале рел.лит-ры
                {
                    this.klass = "ДП";
                }
                if (this.klass == "ДП")
                {
                    this.RESPAN = "ДП";
                }
                else
                {
                    this.RESPAN = "";//B.Tables[0].Rows[0]["RESPAN"].ToString();
                }
                Conn.SQLDA.SelectCommand.CommandText = " select B.PLAIN from BJVVV..DATAEXT A" +
                                                       " inner join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT" +
                                                       " where A.IDDATA = " + IDDATA +
                                                       " and A.MNFIELD = 899 and A.MSFIELD = '$b' and " +
                                                       " SORT = 'Врхр'";
                B = new DataSet();
                i = Conn.SQLDA.Fill(B);
                if (i != 0)//если временное хранение то считать ДП
                {
                    this.klass  = "ДП";
                    this.RESPAN = "ДП";
                }


                Conn.SQLDA.SelectCommand.CommandText = "select * from " + BASENAME + "..ISSUED_OF where BAR  = '" + this.barcode + "'";
                Conn.SQLDA.SelectCommand.Connection  = Conn.ZakazCon;
                B          = new DataSet();
                this.rname = "";
                this.rid   = "-1";
                try
                {
                    i                   = Conn.SQLDA.Fill(B);
                    this.rid            = B.Tables[0].Rows[0]["IDREADER"].ToString();
                    this.ISIssuedAtHome = (bool)B.Tables[0].Rows[0]["ATHOME"];
                    if (this.klass == "ДП")
                    {
                        this.RESPAN = "ДП";
                    }
                    else
                    {
                        this.RESPAN = B.Tables[0].Rows[0]["RESPAN"].ToString();
                    }

                    this.vzv = DateTime.Parse(B.Tables[0].Rows[0]["DATE_RET"].ToString());
                    //this.fctvzv = DateTime.Parse(B.Tables[0].Rows[0]["DATE_FACT_VOZV"].ToString());
                    this.FirstIssue = DateTime.Parse(B.Tables[0].Rows[0]["DATE_ISSUE"].ToString());
                    this.idemp      = B.Tables[0].Rows[0]["IDEMP"].ToString();
                }
                catch
                {
                    this.rname = "";
                }
                if ((this.rid != "") && (this.rid != "-1"))
                {
                    Conn.ReaderDA.SelectCommand.CommandText = "select NumberReader, BarCode, FamilyName, Name, FatherName from main where NumberReader = " + this.rid;
                    DataSet R = new DataSet();
                    Conn.ReaderDA.Fill(R);
                    string name       = "";
                    string secondName = "";
                    try
                    {
                        name = R.Tables[0].Rows[0]["Name"].ToString().Remove(1, R.Tables[0].Rows[0]["Name"].ToString().Length - 1) + ". ";
                    }
                    catch
                    {
                        name = "";
                    }
                    try
                    {
                        secondName = R.Tables[0].Rows[0]["FatherName"].ToString().Remove(1, R.Tables[0].Rows[0]["FatherName"].ToString().Length - 1) + ".";
                    }
                    catch
                    {
                        secondName = "";
                    }
                    this.rname = R.Tables[0].Rows[0]["FamilyName"].ToString() + " " + name + secondName;
                }
            }
            if (this.iddata != null)
            {
                Conn.SQLDA.SelectCommand.CommandText = " select ID,ID_Reader from Reservation_O..Orders " +
                                                       " where IDDATA = " + this.iddata;
                B = new DataSet();
                i = Conn.SQLDA.Fill(B, "t");
                if (i != 0)
                {
                    this.ord_id  = B.Tables["t"].Rows[0]["ID"].ToString();
                    this.ord_rid = B.Tables["t"].Rows[0]["ID_Reader"].ToString();
                    dbReader tmpr = new dbReader(this.ord_rid);
                    //this.ISIssuedAtHome =
                }
                else
                {
                    this.ord_id  = "-1";
                    this.ord_rid = "-1";
                }
            }
        }
示例#13
0
文件: Form23.cs 项目: infra-hdc/LIBFL
 public Form23(dbReader reader_)
 {
     InitializeComponent();
     reader = reader_;
 }