Exemplo n.º 1
0
        public List <smsoutbox> smsoutbox(smsoutboxPost db)
        {
            SqlConnection con  = conection.serverChoice(db.branch);
            var           list = new List <smsoutbox> {
            };

            con.Open();
            SqlCommand    cmd = new SqlCommand("select top 100 * from tsms_outbox where doc_no like'%" + db.doc_no + "%' and doc_typ like '%" + db.doc_typ + "%' order by sms_dt desc", con);
            SqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                var ss = new smsoutbox
                {
                    ids     = rdr["ids"].ToString(),
                    date    = rdr["sms_dt"].ToString(),
                    smsto   = rdr["smsto"].ToString(),
                    smsmsg  = rdr["smsmsg"].ToString(),
                    process = rdr["processed"].ToString(),
                    docno   = rdr["doc_no"].ToString(),
                    token   = rdr["token"].ToString(),
                    doctype = rdr["doc_typ"].ToString()
                };
                list.Add(ss);
            }
            con.Close();
            return(list);
        }
        public HttpResponseMessage Post([FromBody] smsoutboxPost db)
        {
            var res = brcdb.smsoutbox(db);

            var response = new HttpResponseMessage(HttpStatusCode.Created)
            {
                Content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json")
            };

            return(response);
        }