public void approve_discrepency(HttpContext context)
        {
            User    user    = getUserByAccessToken(context.Request.Form["access_token"]);
            Message message = new Message(false);

            if (user != null)
            {
                if (user.user_type != 5 || user.user_type != 6)
                {
                    DiscrepencyController discrepencyController = new DiscrepencyController();
                    String[] id = context.Request.Form.GetValues("id");

                    for (int i = 0; i < id.Length; i++)
                    {
                        discrepencyController.actionApproveDiscrepancies(Convert.ToInt32(id[i]));
                    }
                    message.condition = true;
                    message.message   = "Successfully Approved.";
                }
                else
                {
                    message.message = "Access denied!";
                }
            }
            else
            {
                message.message = "User token is invilid!";
            }

            context.Response.Write(JsonConvert.SerializeObject(message));
        }
コード例 #2
0
 protected void ApproveAll_Button_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in discrepancyListView.Rows)
     {
         CheckBox cb = (CheckBox)row.FindControl("selector");
         if (cb.Checked)
         {
             id = Convert.ToInt32(row.Cells[1].Text);
             discrepancyController.actionApproveDiscrepancies(id);
         }
     }
     Response.Cookies.Add(new HttpCookie("flash_message", "Approved.")
     {
         Path = "/"
     });
     Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-success")
     {
         Path = "/"
     });
     Response.Redirect(Request.RawUrl);
 }