Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int seq;

            for (int x = 0; x < i; x++)
            {
                CheckBox        c  = Page.FindControl("CK_" + x.ToString()) as CheckBox;
                HtmlInputHidden hd = Page.FindControl("HD_" + x.ToString()) as HtmlInputHidden;
                if (c != null)
                {
                    seq = x + 1;
                    string selection = "1";
                    string chkSeq    = "";
                    if (c.Checked)
                    {
                        selection = "1";
                    }
                    else
                    {
                        selection = "0";
                    }
                    chkSeq = hd.Value;
                    string   SP    = "exec SLIK_UPDATE_SELECTION @1,@2,@3";
                    object[] prmtr = new object[] { appid.Value, chkSeq, selection };
                    conn.ExecuteNonQuery(SP, prmtr, dbtimeout);
                }
            }
            runcreditpolicy(appid.Value);
            MyPage.popMessage(this, "Data Saved & Recalculated.");
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();

            int dbtimeout = int.Parse(ConfigurationManager.AppSettings["dbTimeOut"]);
            string connString = EncryptDecrypt.decryptConnStr(ConfigurationManager.AppSettings["AuthConnString"]);            
            string nexturl = "";
            using (DbConnection conn = new DbConnection(connString))
            {
                conn.ExecReader(Q_LOGINSCR, parmodule, dbtimeout);
                if (conn.hasRow())
                {
                    string uid = TextBox1.Text,
                        dbip = connESecurity.GetFieldValue(1),
                        dbname = connESecurity.GetFieldValue(2),
                        dbuid = connESecurity.GetFieldValue(3),
                        dbpwd = authenticate.decryptMyStr(connESecurity.GetFieldValue(4));

                    if (AddSession(uid, "Data Source=" + dbip + ";Initial Catalog=" + dbname + ";uid=" + dbuid + ";pwd=" + dbpwd + ";Pooling=true", dbtimeout))
                    {
                        FormsAuthentication.SetAuthCookie(uid, false);
                        nexturl = TextBox2.Text;
                    }
                }


                conn.Dispose();
                if (nexturl != "")
                    Response.Redirect(nexturl, true);
                else
                    MyPage.popMessage(this, "User not found");
            }
           
            
        }
 protected void cb_logon_CheckedChanged(object sender, System.EventArgs e)
 {
     object[] paruser = new object[1] {
         TXT_USERID.Text
     };
     using (conn = new DbConnection(ConnString))
     {
         conn.ExecuteNonQuery(U_RESETLOGON, paruser, dbtimeout);
         BindData();
     }
     MyPage.popMessage(this, "Logon flag resetted!");
 }
Beispiel #4
0
 protected void BTN_SAVE_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateMenuAccess();
         ViewData();
         MyPage.popMessage(this, "Group Menu Access Updated!");
     }
     catch (Exception ex)
     {
         Response.Write("<!-- " + ex.Message + " -->\n");
         MNTTools.LogError(this, (string)Session["UserID"], ex);
         MyPage.popMessage(this, "Update Failed...");
     }
 }
Beispiel #5
0
 protected void BTN_SAVE_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateMenuAccess();
         ViewData("pending");
         MyPage.popMessage(this, "Menu Access submitted! Awaiting approval..\nPlease click save again on group level...");
     }
     catch (Exception ex)
     {
         Response.Write("<!-- " + ex.Message + " -->\n");
         MNTTools.LogError(this, (string)Session["UserID"], ex);
         MyPage.popMessage(this, "Failed...");
     }
 }
Beispiel #6
0
        private void lb_Click(object sender, System.EventArgs e)
        {
            LinkButton lbl = (LinkButton)sender;

            object[] modname = new object[1] {
                lbl.Text
            };
            string moduleid = null, url = "";

            connESecurity.ExecReader(Q_GETMODULE, modname, dbtimeout);
            if (connESecurity.hasRow())
            {
                moduleid = connESecurity.GetFieldValue(0);
            }

            Guid token = System.Guid.NewGuid();

            object[] objtkn = new object[3] {
                token, Session["UserID"], moduleid
            };

            connESecurity.ExecReader(SP_SAVETOKEN, objtkn, dbtimeout);
            if (connESecurity.hasRow())
            {
                string tempurl = connESecurity.GetFieldValue(0);
                if (tempurl.IndexOf("?") >= 0)
                {
                    url = tempurl + "&tkn=" + token.ToString() + "&sessionid=" + Session["sessionid"];
                }
                else
                {
                    url = tempurl + "?tkn=" + token.ToString() + "&sessionid=" + Session["sessionid"];
                }
            }
            connESecurity.Dispose();

            if (url != "")
            {
                RemoveSession();
                Response.Redirect(url, true);
            }
            else
            {
                MyPage.popMessage(this, "Invalid Server State!");
            }
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                string strFileName      = Session["userid"] + "_" + DateTime.Now.ToString("yyMMddhhmmss");
                string strFilePath      = Server.MapPath(svrpathurl) + "\\" + strFileName + ".xls";
                System.IO.FileStream fs = new System.IO.FileStream(strFilePath, System.IO.FileMode.Create, System.IO.FileAccess.Write);

                gridExport.WriteXls(fs);
                fs.Dispose();

                Response.Write("<script for=window event=onload language='JavaScript'>");
                Response.Write("window.open('" + svrpathurl + "/" + strFileName + ".xls" + "');");
                Response.Write("</script>");
            } catch (Exception ex)
            {
                MyPage.popMessage(Page, ex.Message);
            }
        }
        protected void DDL_GROUPID_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (TXT_USERID.Text.Trim() == "")
            {
                MyPage.popMessage(this, "Please enter UserID First.");
                DDL_GROUPID.SelectedIndex = 0;
                return;
            }
            using (conn = new DbConnection(ConnString))
            {
                if (LBL_SAVEMODE.Text == "1")                   //insert new user
                {
                    object[] par = new object[1] {
                        TXT_USERID.Text
                    };
                    conn.ExecReader(Q_CEKUSER, par, dbtimeout);
                    if (conn.hasRow())
                    {
                        if (conn.GetFieldValue(0) == "1")
                        {
                            MyPage.popMessage(this, "UserID exists in existing system.");
                            DDL_GROUPID.SelectedIndex = 0;
                            return;
                        }
                        else if (conn.GetFieldValue(1) == "2")
                        {
                            MyPage.popMessage(this, "UserID is in the pending list.");
                            DDL_GROUPID.SelectedIndex = 0;
                            return;
                        }
                    }
                }
                TXT_USERID.ReadOnly  = true;
                TXT_SU_FULLNAME.Text = hdn_nama.Value;
                TXT_SU_EMAIL.Text    = hdn_email.Value;
                InitializeModule();
                FillUpliner(DDL_GROUPID.SelectedValue, uREF_BRANCHID.SelectedValue);

                MyPage.SetFocus(this, BTN_CANCEL);
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int          dbtimeout = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);
            DbConnection conn      = new DbConnection(Session["ConnStringLogin"].ToString());

            conn.ExecReader("select jenisuser from scalluser where userid=@1", new object[] { Session["USERID"] }, dbtimeout);
            if (conn.hasRow())
            {
                if (conn.GetFieldValue(0) != null)
                {
                    if (conn.GetFieldValue(0).ToString() == "1")
                    {
                        MyPage.popMessage(this, "User Active Directory cannot changes password here. Please contact IT Admin..");
                        TXT_OLD.Enabled    = false;
                        TXT_NEW.Enabled    = false;
                        TXT_VERIFY.Enabled = false;
                        BTN_CHANGE.Enabled = false;
                    }
                }
            }
        }
Beispiel #10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();

            int          dbtimeout     = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);
            DbConnection connESecurity = new DbConnection(getConnStringLogin());

            string nexturl = "";

            object[] parmodule = new object[1] {
                ConfigurationSettings.AppSettings["ModuleID"]
            };

            connESecurity.ExecReader(Q_LOGINSCR, parmodule, dbtimeout);
            if (connESecurity.hasRow())
            {
                string uid    = TextBox1.Text,
                       dbip   = connESecurity.GetFieldValue(1),
                       dbname = connESecurity.GetFieldValue(2),
                       dbuid  = connESecurity.GetFieldValue(3),
                       dbpwd  = connESecurity.GetFieldValue(4);

                if (AddSession(uid, "Data Source=" + dbip + ";Initial Catalog=" + dbname + ";uid=" + dbuid + ";pwd=" + dbpwd + ";Pooling=true", dbtimeout))
                {
                    FormsAuthentication.SetAuthCookie(uid, false);
                    nexturl = "main.html";
                }
            }


            connESecurity.Dispose();
            if (nexturl != "")
            {
                Response.Redirect(nexturl, true);
            }
            else
            {
                MyPage.popMessage(this, "User not found");
            }
        }
Beispiel #11
0
 protected void BTN_SUBMIT_Click(object sender, EventArgs e)
 {
     conn = new DbConnection(Session["ConnStringLogin"].ToString());
     try
     {
         bool result = ProcessPending();
         if (result == true)
         {
             MyPage.popMessage(this, "Update Complete...");
         }
         else
         {
             MyPage.popMessage(this, "Update failed, Checker maker must be done by different ID ...");
         }
     }
     catch (Exception ex)
     {
         Response.Write("<!-- " + ex.Message + " -->\n");
         MNTTools.LogError(this, (string)Session["UserID"], ex);
         MyPage.popMessage(this, "Update Failed...");
     }
     BindData();
     conn.Dispose();
 }
Beispiel #12
0
        private void ViewData(string key)
        {
            string src = "";

            try
            {
                DataTable dt = conn.GetDataTable("select * from slik_resultmatch where appid = @1", new object[] { key }, dbtimeout);
                listvaluestring.Value = "";
                for (i = 0; i <= dt.Rows.Count - 1; i++)
                {
                    string nik      = dt.Rows[i]["nik"].ToString();
                    string detailid = dt.Rows[i]["trn_ideb_detail_id"].ToString();
                    string idebid   = dt.Rows[i]["trn_ideb_id"].ToString();
                    //string pdfviewsite = ConfigurationSettings.AppSettings["pdfviewsite"];
                    string pdfviewsite = "ViewPDF.aspx?";

                    TB_SIDLIST.Rows.Add(new TableRow());
                    TB_SIDLIST.Rows[i].Cells.Add(new TableCell());
                    //checkbox
                    System.Web.UI.WebControls.CheckBox ck = new CheckBox();
                    ck.ID = "CK_" + i.ToString();
                    ck.Attributes.Add("onclick", "ceknik('" + dt.Rows[i]["nik"].ToString() + "',this);");
                    if ((bool)dt.Rows[i]["selected"])
                    {
                        ck.Checked             = true;
                        listvaluestring.Value += dt.Rows[i]["nik"].ToString() + ":1,";
                    }
                    else
                    {
                        ck.Checked             = false;
                        listvaluestring.Value += dt.Rows[i]["nik"].ToString() + ":0,";
                    }
                    TB_SIDLIST.Rows[i].Cells[0].Controls.Add(ck);
                    System.Web.UI.WebControls.HyperLink h = new HyperLink();
                    h.ID     = "HL_" + i.ToString();
                    h.Target = "IFR_TEXT";
                    h.Text   = dt.Rows[i]["linkname"].ToString();
                    h.Attributes.Add("style", "cursor:hand");
                    string urlnavigate = "notyetuploaded.html";
                    if (!String.IsNullOrEmpty(idebid) && !String.IsNullOrEmpty(detailid))
                    {
                        urlnavigate = pdfviewsite + "idebid=" + idebid + "&detailid=" + detailid;
                    }
                    h.Attributes.Add("onclick", "javascript:kliklink('HL_" + i.ToString() + "','" + urlnavigate + "')");
                    if (dt.Rows[i]["POLRES"].ToString() != "1")
                    {
                        h.ForeColor = System.Drawing.Color.Red;
                    }
                    h.ToolTip = dt.Rows[i]["result_name"].ToString();
                    TB_SIDLIST.Rows[i].Cells[0].Controls.Add(h);
                    if (i == 0)
                    {
                        src            = urlnavigate;
                        urlframe.Value = urlnavigate;
                    }
                    //hyperlink matching score
                    System.Web.UI.WebControls.HyperLink h2 = new HyperLink();
                    h2.ID   = "HLmatch_" + i.ToString();
                    h2.Text = " (" + dt.Rows[i]["match_level"].ToString() + ")";
                    //h2.Font.Underline = true;
                    h2.Attributes.Add("style", "cursor:hand");
                    h2.Attributes.Add("onclick", "javascript:PopupPage('DetailValidation.aspx?id=" + dt.Rows[i]["resultid"].ToString() + "',800,600)");
                    TB_SIDLIST.Rows[i].Cells[0].Controls.Add(h2);
                }
            }
            catch (Exception ex)
            {
                MyPage.popMessage(this, ex.Message);
            }
            nikcount.Value = i.ToString();
            if (i == 0)
            {
                dv_found.Attributes.Add("style", "display:none");
            }
            else
            {
                TR_MSG.Visible   = false;
                TR_FRAME.Visible = true;
                IFR_TEXT.Attributes.Add("src", src);
                btnpdf.Style.Add("display", "none");
                dv_found.Attributes.Remove("style");
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //dbtimeout = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);//1200;//
            if (!IsPostBack)
            {
                FormsAuthentication.SignOut();
                TXT_USERNAME.Text = (string)Session["UserID"];
                hash_password     = (string)Session["sha1"];
                RemoveSession();
                if (Request.QueryString.Count != 0 && Request.QueryString[0] == "logon")
                {
                    if (hash_password != null)
                    {
                        logon = true;
                        BTN_SUBMIT_Click(null, null);
                        return;
                    }
                }
                if ((TXT_USERNAME.Text == null) || (TXT_USERNAME.Text == ""))
                {
                    MyPage.SetFocus(this, TXT_USERNAME);
                }
                else
                {
                    MyPage.SetFocus(this, TXT_PASSWORD);
                }
            }
            if (Request.QueryString.Count > 0)
            {
                if (!String.IsNullOrEmpty(Request.QueryString["callback"]))
                {
                    callback.Value = Request.QueryString["callback"];
                }

                if (Request.QueryString["msg"] != null && Request.QueryString["msg"] != "")
                {
                    MyPage.popMessage(this, Request.QueryString["msg"]);
                }
                else if (Request.QueryString["menu"] == "0")
                {
                    LogonMessage(loginResult.logNoMenuAccess);
                }
                else if (Request.QueryString[0] == "logon")
                {
                    LogonMessage(loginResult.logReLogin);
                }
                else if (Request.QueryString[0] == "lost")
                {
                    LogonMessage(loginResult.logSessionLost);
                }
                else if (Request.QueryString[0] == "new")
                {
                    LogonMessage(loginResult.logNewLogin);
                }
                else if (Request.QueryString["tkn"] != null && Request.QueryString["tkn"] != "")
                {
                    using (DbConnection conn = new DbConnection(getConnString()))
                    {
                        try
                        {
                            object[] token = new object[1] {
                                new Guid(Request.QueryString["tkn"])
                            };
                            conn.ExecuteNonQuery(SP_TOKENDELETE, token, dbtimeout);
                            LogonMessage(loginResult.logAuthFail);
                        }
                        catch (Exception ex)
                        {
                            Response.Write("<!-- ex msg: " + ex.Message.Replace("-->", "--)") + " -->\n");
                            LogonMessage(loginResult.logAuthFail);
                        }
                    }
                }
                else
                {
                    LogonMessage(loginResult.logSessionLost);
                }
            }
            //BTN_SUBMIT.Attributes.Add("onclick","return proceeding();");
        }
Beispiel #14
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool flag_sameuser = false;

            string[] keyREJCT = hREJCT.Value.Split(',');
            string[] keyAPPRV = hAPPRV.Value.Split(',');

            for (int i = 0; i < keyREJCT.Length; i++)
            {
                if (keyREJCT[i] != "")
                {
                    conn.ExecNonQuery(U_DELPARAMTMP, new object[] { keyREJCT[i] }, dbtimeout);
                }
            }

            for (int i = 0; i < keyAPPRV.Length; i++)
            {
                if (keyAPPRV[i] != "")
                {
                    conn.ExecReader(Q_PARAMTMP, new object[] { keyAPPRV[i] }, dbtimeout);
                    if (conn.hasRow())
                    {
                        switch (conn.GetFieldValue("Status"))
                        {
                        case "Insert":
                        case "Update":
                            if (conn.GetFieldValue("CreatedBy") == Session["USERID"].ToString())
                            {
                                flag_sameuser = true;
                            }
                            else
                            {
                                save(keyAPPRV[i]);
                            }
                            break;

                        case "Delete":
                            if (conn.GetFieldValue("CreatedBy") == Session["USERID"].ToString())
                            {
                                flag_sameuser = true;
                            }
                            else
                            {
                                delete(keyAPPRV[i]);
                            }
                            break;
                        }
                    }
                }
            }
            dtbindpending(gridpending);
            if (gridpending.GroupCount > 0)
            {
                funcpendCss = "";
            }
            hAPPRV.Value = "";
            hREJCT.Value = "";
            hCANCL.Value = "";
            if (flag_sameuser)
            {
                MyPage.popMessage(this, "Update failed, Checker maker must be done by different ID ...");
            }
        }
Beispiel #15
0
        protected void CODE_TextChanged(object sender, System.EventArgs e)
        {
            if (CODE.Text.Trim() == "")
            {
                CODE.Text = "";
                DESC.Text = "";
                if (AutoPostBack && _oldvalue != CODE.Text)
                {
                    _oldvalue = CODE.Text;
                    OnSelectedIndexChanged(e);
                }
                return;
            }

            dbtimeout  = (int)Session["dbTimeOut"];
            ConnString = (string)ConfigurationSettings.AppSettings["connString"].ToString();
            //WebControl ctrl;
            using (conn = new DbConnection(ConnString))
            {
                if (_query == null || _query.Trim() == "")
                {
                    string qry = "select " + _fldid + ", " + _flddesc + " from " + _tblname;
                    if (_cond != null && _cond.Trim() != "")
                    {
                        qry += " where (" + _cond + ") and " + _fldid + " = '" + CODE.Text + "'";
                    }
                    else
                    {
                        qry += " where " + _fldid + " = '" + CODE.Text + "'";
                    }
                    conn.ExecReader(qry, null, dbtimeout);
                    if (conn.hasRow())
                    {
                        DESC.Text = conn.GetFieldValue(1);
                        //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE);
                        //if (ctrl != null)
                        //	MyPage.SetFocus(this.Parent.Page, ctrl);
                    }
                    else
                    {
                        CODE.Text = "";
                        DESC.Text = "";
                        MyPage.popMessage(this.Parent.Page, "Kode tidak ditemukan");
                        MyPage.SetFocus(this.Parent.Page, CODE);
                    }
                }
                else
                {
                    ListItemCollection items = new ListItemCollection();
                    MyPage.fillRefListINA(items, _query, null, dbtimeout, false, conn);
                    try
                    {
                        int i = 0;
                        for (i = 0; i < items.Count; i++)
                        {
                            if (items[i].Value.ToLower() == CODE.Text.ToLower())        //found
                            {
                                CODE.Text = items[i].Value;
                                DESC.Text = items[i].Text;
                                break;
                            }
                        }
                        //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE);
                        //if (ctrl != null)
                        //	MyPage.SetFocus(this.Parent.Page, ctrl);

                        if (i == items.Count)           // not found
                        {
                            CODE.Text = "";
                            DESC.Text = "";
                            MyPage.popMessage(this.Parent.Page, "Kode tidak ditemukan");
                            MyPage.SetFocus(this.Parent.Page, CODE);
                        }
                    }
                    catch
                    {
                        CODE.Text = "";
                        DESC.Text = "";
                        MyPage.popMessage(this.Parent.Page, "Kode tidak ditemukan");
                        MyPage.SetFocus(this.Parent.Page, CODE);
                    }
                }
            }
            if (AutoPostBack && _oldvalue != CODE.Text)
            {
                _oldvalue = CODE.Text;
                OnSelectedIndexChanged(e);
            }
        }
        protected void DatGrd_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            ClearEntries();
            conn = new DbConnection(ConnString);
            switch (e.CommandName)
            {
            case "edit":
                BTN_NEW.Visible    = false;
                BTN_NEW_AD.Visible = false;
                BTN_SAVE.Visible   = true;
                BTN_CANCEL.Visible = true;
                LBL_SAVEMODE.Text  = "0";
                SetEnable(true);
                TXT_USERID.ReadOnly = true;

                object[] paruser = new object[1] {
                    e.Item.Cells[2].Text
                };
                conn.ExecReader(Q_USERDATA, paruser, dbtimeout);
                if (conn.hasRow())
                {
                    if (conn.GetFieldValue("SU_REVOKE") == "1")
                    {
                        cb_revoke.Checked = true;
                        cb_revoke.Text    = "(clear to reset)";
                    }
                    else
                    {
                        cb_revoke.Checked = false;
                    }

                    if (conn.GetFieldValue("SU_LOGON") == "1")
                    {
                        cb_logon.Checked = true;
                    }
                    else
                    {
                        cb_logon.Checked = false;
                    }

                    if (conn.GetFieldValue("SU_ACTIVE") == "1")
                    {
                        CHK_SU_ACTIVE.Checked = true;
                    }
                    else
                    {
                        CHK_SU_ACTIVE.Checked = false;
                    }

                    TXT_USERID.Text             = conn.GetFieldValue("USERID");
                    TXT_SU_FULLNAME.Text        = conn.GetFieldValue("SU_FULLNAME");
                    TXT_SU_HPNUM.Text           = conn.GetFieldValue("SU_HPNUM");
                    TXT_SU_EMAIL.Text           = conn.GetFieldValue("SU_EMAIL");
                    uREF_BRANCHID.SelectedValue = conn.GetFieldValue("BRANCHID");
                    uREF_AREAID.SelectedValue   = conn.GetFieldValue("AREAID");
                    ddl_JenisUser.SelectedValue = conn.GetFieldValue("JenisUser");
                    if (conn.GetFieldValue("JenisUser") == "1")
                    {
                        //userAD tidak bisa reset password
                        SetADMode(true);
                        btn_cekAD.Visible = false;
                    }
                    else
                    {
                        SetADMode(false);
                    }
                    try
                    {
                        DDL_GROUPID.SelectedValue = conn.GetFieldValue("GROUPID");
                        string spv  = conn.GetFieldValue("SU_UPLINER");
                        string spv2 = conn.GetFieldValue("SU_UPLINER2");
                        string spv3 = conn.GetFieldValue("SU_UPLINER3");
                        string spv4 = conn.GetFieldValue("SU_UPLINER4");
                        string spv5 = conn.GetFieldValue("SU_UPLINER5");
                        FillUpliner(DDL_GROUPID.SelectedValue, uREF_BRANCHID.SelectedValue);
                        try { uREF_UPLINER.SelectedValue = spv; } catch { }
                        try { uREF_UPLINER2.SelectedValue = spv2; } catch { }
                        try { uREF_UPLINER3.SelectedValue = spv3; } catch { }
                        try { uREF_UPLINER4.SelectedValue = spv4; } catch { }
                        try { uREF_UPLINER5.SelectedValue = spv5; } catch { }
                        InitializeModule(true);
                    }
                    catch (Exception ex)
                    {
                        MyPage.popMessage(this, "Error initializing group/module screen");
                        Response.Write("<!-- " + ex.Message.Replace("-->", "--)") + " -->\n");
                        MNTTools.LogError(this, (string)Session["UserID"], ex);
                    }
                }

                pwdmsg.Value = "Leave password blank to use old password!";
                MyPage.SetFocus(this, BTN_CANCEL);

                break;

            case "delete":
                object[] pardel = new object[5] {
                    e.Item.Cells[2].Text, e.Item.Cells[4].Text,
                    "1", e.Item.Cells[3].Text, Session["USerID"]
                };
                try
                {
                    conn.ExecuteNonQuery(SP_DELETE, pardel, dbtimeout);
                    LBL_RESULT.Text      = "Request Submitted! Awaiting Approval ... ";
                    LBL_RESULT.ForeColor = System.Drawing.Color.Green;
                }
                catch (Exception ex)
                {
                    if (ex.Message.IndexOf("Last Query:") > 0)
                    {
                        LBL_RESULT.Text = ex.Message.Substring(0, ex.Message.IndexOf("Last Query:"));
                    }
                    else
                    {
                        LBL_RESULT.Text = ex.Message;
                    }
                    LBL_RESULT.ForeColor = System.Drawing.Color.Red;
                }
                break;

            case "undelete":
                object[] parundel = new object[5] {
                    e.Item.Cells[2].Text, e.Item.Cells[4].Text,
                    "1", e.Item.Cells[3].Text, Session["UserID"]
                };
                try
                {
                    conn.ExecuteNonQuery(SP_UNDELETE, parundel, dbtimeout);
                    LBL_RESULT.Text      = "Request Submitted! Awaiting Approval ... ";
                    LBL_RESULT.ForeColor = System.Drawing.Color.Green;
                }
                catch (Exception ex)
                {
                    if (ex.Message.IndexOf("Last Query:") > 0)
                    {
                        LBL_RESULT.Text = ex.Message.Substring(0, ex.Message.IndexOf("Last Query:"));
                    }
                    else
                    {
                        LBL_RESULT.Text = ex.Message;
                    }
                    LBL_RESULT.ForeColor = System.Drawing.Color.Red;
                }
                break;
            }
            BindData();
            conn.Dispose();
        }