示例#1
0
        public History(ReaderVO reader)
        {
            InitializeComponent();
            label2.Text = reader.FIO;
            DBReference dbref = new DBReference();


            dataGridView1.DataSource = dbref.GetReaderHistory(reader);

            dataGridView1.Columns["DATE_ISSUE"].HeaderText  = "Дата выдачи";
            dataGridView1.Columns["DATE_RETURN"].HeaderText = "Дата возврата";
            dataGridView1.Columns["inv"].HeaderText         = "Инвентарный номер";
            dataGridView1.Columns["tit"].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["tit"].Width = 300;
            dataGridView1.Columns["tit"].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
        }
示例#2
0
 public ReaderInformation(ReaderVO reader_, MainForm f1_)
 {
     InitializeComponent();
     f1                = f1_;
     reader            = reader_;
     label2.Text       = reader.FIO;
     pictureBox1.Image = reader.Photo;
     MethodsForCurBase.FormTable(reader, dataGridView1);
     //DisplayCommNote();
     //RegInMos();
     label6.Text = "Дата последней отправки письма: " + reader.GetLastDateEmail();
 }
示例#3
0
        public static void FormTable(ReaderVO reader, DataGridView dataGridView1)
        {
            SqlDataAdapter SQLDA = new SqlDataAdapter();

            SQLDA.SelectCommand             = new SqlCommand();
            SQLDA.SelectCommand.Connection  = new SqlConnection(XmlConnections.GetConnection("/Connections/CirculationACC"));
            SQLDA.SelectCommand.CommandText = "select * from Readers..Main where NumberReader = " + reader.ID;
            DataSet DS = new DataSet();

            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>();

            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;";
            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 == "Document") || (col.ColumnName == "DocumentNumber") || (col.ColumnName == "Photo") || (col.ColumnName == "Photo") || (col.ColumnName == "AbonementType") || (col.ColumnName == "SheetWithoutCard") || (col.ColumnName == "Password") || (col.ColumnName == "FamilyNameFind") || (col.ColumnName == "NameFind") || (col.ColumnName == "FatherNameFind") || (col.ColumnName == "Interest"))
                {
                    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();
                }
                dataGridView1.Rows[i].Cells[0].Value = value;
                i++;
            }

            /*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;
             * 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++;
             * }*/
            /*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;
             * 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++;
             * }*/
        }