Ejemplo n.º 1
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];

            TextBox allowanceName = row.Cells[2].Controls[0] as TextBox;
            TextBox defaultAmount = row.Cells[3].Controls[0] as TextBox;
            // int allowanceid = Convert.ToInt32( row.Cells[1].Text);

            ALLOWANCES all = new ALLOWANCES();

            all.JobTitleId    = jt.JobTitleId;
            all.DefaultPay    = Convert.ToInt32(defaultAmount.Text);
            all.AllowanceName = allowanceName.Text;
            all.AllowanceId   = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
            Response.Write(all.AllowanceId);
            GridView1.EditIndex = -1;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Global.URIstring);
                //HTTP PUT
                var updateTask = client.PutAsJsonAsync("allowances/" + all.AllowanceId, all);
                updateTask.Wait();

                var result = updateTask.Result;
            }

            getallowances(jt.JobTitleId);
            filterdata();
            // gvbind(); */
        }
Ejemplo n.º 2
0
        protected void addbutton_Click(object sender, EventArgs e)
        {
            ALLOWANCES all = new ALLOWANCES();

            all.JobTitleId    = jt.JobTitleId;
            all.DefaultPay    = Convert.ToInt32(newdefaultamounttextbox.Text);
            all.AllowanceName = newallowancetextbox.Text;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Global.URIstring);
                //HTTP PUT
                var updateTask = client.PostAsJsonAsync("allowances/", all);
                updateTask.Wait();

                var result = updateTask.Result;
            }
            getallowances(jt.JobTitleId);
            filterdata();
        }