Esempio n. 1
0
        public int PostDeletehandheld([FromBody] handheldcls frm)
        {
            int ret = 0;
            NpgsqlConnection cont = new NpgsqlConnection();

            cont.ConnectionString = constr;
            cont.Open();
            NpgsqlCommand cmd = new NpgsqlCommand();

            cmd.Connection  = cont;
            cmd.CommandText = "delete from handhelds  where handheldid=" + frm.handheldid;
            ret             = cmd.ExecuteNonQuery();
            cont.Close();
            cont.Dispose();
            return(ret);
        }
Esempio n. 2
0
        public int PostUpdateHandhelds([FromBody] handheldcls frm)
        {
            int ret = 0;
            NpgsqlConnection cont = new NpgsqlConnection();

            cont.ConnectionString = constr;
            cont.Open();
            NpgsqlCommand cmd = new NpgsqlCommand();

            cmd.Connection  = cont;
            cmd.CommandText = "update handhelds set AhwalID = " + frm.ahwalid + ",serial = '" + frm.serial + "',defective = " + frm.defective + ",barcode = '" + frm.barcode + "' where handheldid=" + frm.handheldid;
            ret             = cmd.ExecuteNonQuery();
            cont.Close();
            cont.Dispose();


            return(ret);
        }
Esempio n. 3
0
        public int PostAddHandhelds([FromBody] handheldcls frm)
        {
            int ret = 0;
            NpgsqlConnection cont = new NpgsqlConnection();

            cont.ConnectionString = constr;
            cont.Open();
            NpgsqlCommand cmd = new NpgsqlCommand();

            cmd.Connection  = cont;
            cmd.CommandText = "insert into handhelds(AhwalID,serial,defective,barcode) values (" + frm.ahwalid + ",'" + frm.serial + "'," + frm.defective + ",'" + frm.barcode + "')";
            ret             = cmd.ExecuteNonQuery();
            cont.Close();
            cont.Dispose();


            return(ret);
        }