예제 #1
0
        public string book_return(string barcode, string returntime, string userid, string userlocation)
        {
            string host = libhp.ini_opacurl();
            string st   = string.Format("server={0};database=database;User ID=user;Password=pwd;Trusted_Connection=false;", host);


            using (SqlConnection con = new SqlConnection(st))
            {
                con.Open();
                string         sql = string.Format("exec dbo.wsrv_return @acce01='{0}', @i1=1, @i2=1, @autosave=1,@hist01 = '{1}', @sent06 = '{2}', @hist14='{3}',@returntype = 1, @stoptype=1;", barcode, returntime, userid, userlocation);
                DataTable      dt  = new DataTable();
                SqlDataAdapter da  = new SqlDataAdapter(sql, con);
                da.Fill(dt);

                Book_return book_return = new Book_return();
                book_return.result  = dt.Rows[0][0].ToString();
                book_return.msg     = dt.Rows[0][1].ToString();
                book_return.cata11  = dt.Rows[0][13].ToString();
                book_return.acce01  = dt.Rows[0][2].ToString();
                book_return.cata12  = dt.Rows[0][8].ToString();
                book_return.sent02  = dt.Rows[0][3].ToString() + " 23:59";
                book_return.hist01  = dt.Rows[0][4].ToString();
                book_return.overday = dt.Rows[0][19].ToString();
                book_return.hist03  = dt.Rows[0][6].ToString();

                string result = JsonConvert.SerializeObject(book_return);
                return(result);
            }
        }
예제 #2
0
        private void btn_hs_Click(object sender, EventArgs e)  //
        {
            string opacurl      = libhp.ini_opacurl();
            string barcode      = txt_barcode2.Text.Trim();
            string hist01       = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
            string userid       = string1;
            string userlocation = string2;
            string url          = string.Format("http://{0}/getservice.ashx?mode=4&barcode={1}&userid={2}&userlocation={3}", opacurl, barcode, userid, userlocation);
            string get          = string.Empty;

            if (libhp.ini_mode() == "0")
            {
                get = libhp.getservice(url);
            }
            else
            {
                get = sqlhp.book_return(barcode, hist01, userid, userlocation);
            }


            Book_return m = JsonConvert.DeserializeObject <Book_return>(get);

            switch (m.result.ToString())
            {
            case "0":
            {
                int i = Convert.ToInt32(label18.Text) + 1;
                dataGridView_hs.Rows.Insert(0, Image.FromFile("c:\\check.png"), i, m.acce01, m.cata12, m.sent02, m.hist01, m.msg);
                dataGridView_hs.CurrentCell = dataGridView_hs.Rows[0].Cells[0];
                dataGridView_hs.CurrentRow.DefaultCellStyle.BackColor = Color.White;
                dataGridView_hs.ClearSelection();



                libhp.clean_control(txt_barcode2);

                label18.Text = i.ToString();

                break;
            }

            default:
            {
                int i = Convert.ToInt32(label18.Text) + 1;
                dataGridView_hs.Rows.Insert(0, Image.FromFile("c:\\notice.png"), i, m.acce01, m.cata12, "", "", m.msg);
                dataGridView_hs.CurrentCell = dataGridView_hs.Rows[0].Cells[0];
                dataGridView_hs.CurrentRow.DefaultCellStyle.BackColor = Color.Yellow;
                dataGridView_hs.ClearSelection();


                libhp.clean_control(txt_barcode2);

                label18.Text = i.ToString();

                break;
            }
            }
        }