Example #1
0
        public void setBookReturned(string s, dbBook book)
        {
            Conn.SQLDA.SelectCommand.CommandText = "select * from [Reservation_R].[dbo].[ISSUED] where IDMAIN = " + s + " and BAR = '" + book.barcode + "' ";
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(Conn.SQLDA);
            DataSet B = new DataSet();
            int i = Conn.SQLDA.Fill(B);
            if (i == 0)
            {
                //
            }
            if (B.Tables[0].Rows[0]["IDROLD"].ToString() != "")
            {
                DeleteBarFromBJVVV(B.Tables[0].Rows[0]["BAR"].ToString());
            }
            Conn.SQLDA.UpdateCommand = new SqlCommand();
            Conn.SQLDA.UpdateCommand.Connection = Conn.BJVVVConn;
            Conn.SQLDA.UpdateCommand.CommandText = "update Reservation_R..ISSUED set IDMAIN = 0, IDROLD = '',DATE_FACT_VOZV = '" + DateTime.Today.ToString("yyyyMMdd") + "' where ID = " + B.Tables[0].Rows[0]["ID"].ToString();
            if (Conn.SQLDA.UpdateCommand.Connection.State == ConnectionState.Closed)
            {
                Conn.SQLDA.UpdateCommand.Connection.Open();
            }

            int rc = Conn.SQLDA.UpdateCommand.ExecuteNonQuery();
            Conn.SQLDA.UpdateCommand.Connection.Close();
            //B.Tables[0].Rows[0]["IDMAIN"] = "0";
            //B.Tables[0].Rows[0]["DATE_FACT_VOZV"] = DateTime.Now.ToShortDateString();
            //B.Tables[0].Rows[0]["IDROLD"] = "";
            //Conn.SQLDA.UpdateCommand = cmdBuilder.GetUpdateCommand();
            //Conn.SQLDA.Update(B.Tables[0]);
        }
Example #2
0
 public dbBook(dbBook Book)
 {
     this.author = Book.author;
         this.barcode = Book.barcode;
         this.id = Book.id;
         this.name = Book.name;
         this.rname = Book.rname;
         this.inv = Book.inv;
         this.fctvzv = Book.fctvzv;
         this.vzv = Book.vzv;
         this.iddata = Book.iddata;
         this.name = Book.name;
         this.rname = Book.rname;
 }
Example #3
0
        public void setBookForReader(dbBook book, dbReader reader, int days)
        {
            Conn.SQLDA.SelectCommand.CommandText = "select * from Reservation_R..ADVORDER where INV = '" + book.inv + "'";
            DataSet DS = new DataSet();
            int c = Conn.SQLDA.Fill(DS, "t");
            if (c != 0)
            {
                MessageBox.Show("���� ��������� ����� �� ���������� � �������� � ������� " + DS.Tables["t"].Rows[0]["IDREADER"].ToString() + "! ������� ���������� ����� ���������!");
                return;
            }

            Conn.SQLDA.InsertCommand = new SqlCommand();
            Conn.SQLDA.InsertCommand.Connection = Conn.ZakazCon;
            if (Conn.ZakazCon.State != ConnectionState.Open) Conn.ZakazCon.Open();
            Conn.SQLDA.InsertCommand.CommandText = "insert into Reservation_R..ISSUED (IDMAIN,BAR,DATE_VOZV,IDREADER,IDEMP,DATE_ISSUE,IDMAIN_CONST, " +
                                                    " PENALTY, REMPENALTY, INV, STATUS, IDDATA) values (@IDMAIN,@BAR,@DATE_VOZV,@IDREADER,@IDEMP,@DATE_ISSUE,@IDMAIN_CONST, " +
                                                    "@PENALTY, @REMPENALTY, @INV, @STATUS,@IDDATA)";
            Conn.SQLDA.InsertCommand.Parameters.Add("IDMAIN", SqlDbType.Int);
            Conn.SQLDA.InsertCommand.Parameters.Add("BAR", SqlDbType.NVarChar);
            Conn.SQLDA.InsertCommand.Parameters.Add("DATE_VOZV", SqlDbType.DateTime);
            Conn.SQLDA.InsertCommand.Parameters.Add("IDREADER", SqlDbType.Int);
            Conn.SQLDA.InsertCommand.Parameters.Add("IDEMP", SqlDbType.Int);
            Conn.SQLDA.InsertCommand.Parameters.Add("DATE_ISSUE", SqlDbType.DateTime);
            Conn.SQLDA.InsertCommand.Parameters.Add("IDMAIN_CONST", SqlDbType.NVarChar);
            Conn.SQLDA.InsertCommand.Parameters.Add("PENALTY", SqlDbType.Bit);
            Conn.SQLDA.InsertCommand.Parameters.Add("REMPENALTY", SqlDbType.Bit);
            Conn.SQLDA.InsertCommand.Parameters.Add("INV", SqlDbType.NVarChar);
            Conn.SQLDA.InsertCommand.Parameters.Add("IDDATA", SqlDbType.Int);
            Conn.SQLDA.InsertCommand.Parameters.Add("STATUS", SqlDbType.Int);
            Conn.SQLDA.InsertCommand.Parameters["IDMAIN"].Value = book.id;
            Conn.SQLDA.InsertCommand.Parameters["BAR"].Value = book.barcode;
            Conn.SQLDA.InsertCommand.Parameters["DATE_VOZV"].Value = DateTime.Now.AddDays(days).ToShortDateString();
            Conn.SQLDA.InsertCommand.Parameters["IDREADER"].Value = reader.id;
            Conn.SQLDA.InsertCommand.Parameters["IDEMP"].Value = F1.EmpID;
            Conn.SQLDA.InsertCommand.Parameters["DATE_ISSUE"].Value = DateTime.Now.ToShortDateString();
            Conn.SQLDA.InsertCommand.Parameters["IDMAIN_CONST"].Value = book.id;
            Conn.SQLDA.InsertCommand.Parameters["PENALTY"].Value = false;
            Conn.SQLDA.InsertCommand.Parameters["REMPENALTY"].Value = false;
            Conn.SQLDA.InsertCommand.Parameters["INV"].Value = book.inv;
            Conn.SQLDA.InsertCommand.Parameters["STATUS"].Value = 3;
            Conn.SQLDA.InsertCommand.Parameters["IDDATA"].Value = book.iddata;
            Conn.SQLDA.InsertCommand.ExecuteNonQuery();
            //book = book.Remove(book.Length - 1, 1);
            //reader = reader.Remove(0, 1);
            //reader = reader.Remove(reader.Length - 1, 1);
            /*Conn.SQLDA.SelectCommand.CommandText = "select * from Reservation_R..ISSUED where ID = -1";
            Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(Conn.SQLDA);
            int i = Conn.SQLDA.Fill(Zakaz);

            DataRow row = Zakaz.Tables[0].NewRow();
            row["IDMAIN"] = book.id;
            row["BAR"] = book.barcode;
            row["DATE_VOZV"] = DateTime.Now.AddDays(days).ToShortDateString();
            row["IDREADER"] = reader.id;
            row["IDEMP"] = F1.EmpID;
            row["DATE_ISSUE"] = DateTime.Now.ToShortDateString();
            row["IDMAIN_CONST"] = book.id;
            row["PENALTY"] = false;
            row["REMPENALTY"] = false;
            row["INV"] = book.inv;
            Zakaz.Tables[0].Rows.Add(row);
            //Conn.SQLDA.SelectCommand.CommandText = "select * from ZAKAZ where ID = -1";
            //Conn.SQLDA.SelectCommand.Connection = Conn.ZakazCon;
            //SQLDA.InsertCommand = cmdBuilder.GetInsertCommand();
            Conn.SQLDA.Update(Zakaz.Tables[0]);*/
        }
Example #4
0
 internal void InsertActionRETURNED(dbReader reader, dbBook book)
 {
     Conn.SQLDA.InsertCommand = new SqlCommand();
         Conn.SQLDA.InsertCommand.Connection = Conn.ZakazCon;
         if (Conn.ZakazCon.State != ConnectionState.Open) Conn.ZakazCon.Open();
         Conn.SQLDA.InsertCommand.CommandText = "insert into Reservation_R..ABONEMENTACTIONS (ACTIONTYPE,BAR,IDEMP,IDREADER,DATEACT) " +
                                                 " values (@ACTIONTYPE,@BAR,@IDEMP,@IDREADER,@DATEACT)";
         Conn.SQLDA.InsertCommand.Parameters.Add("ACTIONTYPE", SqlDbType.Int);
         Conn.SQLDA.InsertCommand.Parameters.Add("BAR", SqlDbType.NVarChar);
         Conn.SQLDA.InsertCommand.Parameters.Add("IDEMP", SqlDbType.Int);
         Conn.SQLDA.InsertCommand.Parameters.Add("IDREADER", SqlDbType.Int);
         Conn.SQLDA.InsertCommand.Parameters.Add("DATEACT", SqlDbType.DateTime);
         Conn.SQLDA.InsertCommand.Parameters["ACTIONTYPE"].Value = 2;
         Conn.SQLDA.InsertCommand.Parameters["BAR"].Value = book.barcode;
         Conn.SQLDA.InsertCommand.Parameters["IDEMP"].Value = this.F1.EmpID;
         Conn.SQLDA.InsertCommand.Parameters["IDREADER"].Value = book.rid;
         Conn.SQLDA.InsertCommand.Parameters["DATEACT"].Value = DateTime.Now;
         try
         {
             Conn.SQLDA.InsertCommand.ExecuteNonQuery();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + ". �� ��������� ���������������� �������� - �������. ���������� � ������������.");
         }
 }