private void btnAddInstruction_Click(object sender, System.EventArgs e)
 {
     try
     {
         instruct = new clsInstructions();
         instruct.iOrgId = OrgId;
         instruct.cAction = "U";
         instruct.iId = 0;
         instruct.iTypeId = Convert.ToInt32(ddlInstructionTypes.SelectedValue);
         instruct.sInstructionText = tbInstructionText.Text;
         instruct.InstructionDetail();
         dgInstructions.EditItemIndex = -1;
         dgInstructions.DataSource = new DataView(instruct.GetInstructionList());
         dgInstructions.DataBind();
         tbInstructionText.Text = "";
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_kiosk_customtext.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(instruct != null)
             instruct.Dispose();
     }
 }
 private void dgInstructions_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         instruct = new clsInstructions();
         instruct.iOrgId = OrgId;
         dgInstructions.EditItemIndex = -1;
         dgInstructions.DataSource = new DataView(instruct.GetInstructionList());
         dgInstructions.DataBind();
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_kiosk_customtext.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(instruct != null)
             instruct.Dispose();
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(!IsPostBack)
                {
                    instruct = new clsInstructions();
                    instruct.iOrgId = OrgId;
                    dtTypes = instruct.GetInstructionTypeList();
                    ddlInstructionTypes.DataSource = new DataView(dtTypes);
                    ddlInstructionTypes.DataBind();
                    ViewState["InstructionTypes"] = dtTypes;
                    dgInstructions.DataSource = instruct.GetInstructionList();
                    dgInstructions.DataBind();
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = ParentPageURL;
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(instruct != null)
                    instruct.Dispose();
            }
        }
 private void dgInstructions_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         instruct = new clsInstructions();
         instruct.iOrgId = OrgId;
         instruct.cAction = "U";
         instruct.iId = Convert.ToInt32(e.CommandArgument);
         instruct.iTypeId = Convert.ToInt32(((DropDownList)e.Item.FindControl("dg_ddlInstructionTypes")).SelectedValue);
         instruct.sInstructionText = ((TextBox)e.Item.FindControl("dg_tbInstructionText")).Text;
         if(instruct.InstructionDetail() == -1)
         {
             Header.ErrorMessage = _functions.ErrorMessage(168);
         }
         else
         {
             dgInstructions.EditItemIndex = -1;
             dgInstructions.DataSource = new DataView(instruct.GetInstructionList());
             dgInstructions.DataBind();
         }
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_kiosk_customtext.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(instruct != null)
             instruct.Dispose();
     }
 }