public void loadRole(int id)
 {
     try
     {
         adminTableAdapters.GetRolesTableAdapter roles = new adminTableAdapters.GetRolesTableAdapter();
         admin.GetRolesDataTable tbl = roles.GetRolesDetail(id);
         if (tbl.Rows.Count > 0)
         {
             txtrole.Value            = tbl[0].datDescription.ToString();
             txtApprovalLimit.Value   = tbl[0].datApprovalLimit.ToString();
             txtSessionDuration.Value = tbl[0].datSessionDuration.ToString();
             txtEmailAddress.Value    = tbl[0].datEmailAddress.ToString();
             this.editskip.Value      = "2";
         }
     }
     catch (Exception ex) { }
 }
 public void loadRole(int id)
 {
     try
     {
         adminTableAdapters.GetRolesTableAdapter roles = new adminTableAdapters.GetRolesTableAdapter();
         admin.GetRolesDataTable tbl = roles.GetRolesDetail(id);
         if (tbl.Rows.Count > 0)
         {
             txtrole.Value = tbl[0].datDescription.ToString();
             txtApprovalLimit.Value = tbl[0].datApprovalLimit.ToString();
             txtSessionDuration.Value = tbl[0].datSessionDuration.ToString();
             txtEmailAddress.Value = tbl[0].datEmailAddress.ToString();
             this.editskip.Value = "2";
         }
     }
     catch (Exception ex) { }
     }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        adminTableAdapters.GetRolesTableAdapter roles = new adminTableAdapters.GetRolesTableAdapter();

        if (!(type == "update"))
        {
            roles.InsertRole(txtrole.Value.Trim(),
                             Convert.ToDecimal(txtApprovalLimit.Value.Trim()),
                             Convert.ToInt32(txtSessionDuration.Value.Trim()),
                             txtEmailAddress.Value.Trim());
        }
        else if (type == "update")
        {
            roles.UpdateRoles(txtrole.Value.Trim(),
                              Convert.ToDecimal(txtApprovalLimit.Value.Trim()),
                              Convert.ToInt32(txtSessionDuration.Value.Trim()),
                              txtEmailAddress.Value.Trim(),
                              id);
        }

        Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "redit"));
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        adminTableAdapters.GetRolesTableAdapter roles = new adminTableAdapters.GetRolesTableAdapter(); 

        if (!(type == "update"))
        {
            roles.InsertRole(txtrole.Value.Trim(),
                             Convert.ToDecimal(txtApprovalLimit.Value.Trim()),
                             Convert.ToInt32(txtSessionDuration.Value.Trim()),
                             txtEmailAddress.Value.Trim());
                            
          
        }
        else if (type == "update")
        {
            roles.UpdateRoles(txtrole.Value.Trim(),
                             Convert.ToDecimal(txtApprovalLimit.Value.Trim()),
                             Convert.ToInt32(txtSessionDuration.Value.Trim()),
                             txtEmailAddress.Value.Trim(),
                             id);
        }

        Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "redit"));
    }