示例#1
0
        private void InitializeModule(bool init)
        {
            try
            {
                RBL_MODULE.Items.Clear();

                string cond = " where groupid = '" + DDL_GROUPID.SelectedValue +
                              "' and moduleid in (" + MaintainedModuleIDs + ") ";
                conn.ExecReader(Q_MODULEGROUP + cond, null, dbtimeout);
                int i = 0;
                while (conn.hasRow())
                {
                    string moduleid = conn.GetFieldValue("moduleid").Trim();
                    string src      = conn.GetFieldValue("usermntpage").Trim();
                    RBL_MODULE.Items.Add(new ListItem(conn.GetFieldValue("modulename"), moduleid));
                    if (i == 0 && src != "")
                    {
                        if (src.IndexOf("?") > 0)
                        {
                            src += "&";
                        }
                        else
                        {
                            src += "?";
                        }
                        src += "moduleid=" + moduleid + "&moddesc=" + RBL_MODULE.Items[0].Text + "&grpid=" + DDL_GROUPID.SelectedValue + "&uid=" + TXT_USERID.Text + "&spv=" + uREF_UPLINER.SelectedValue;
                        IFR_MODULE.Attributes.Remove("src");
                        IFR_MODULE.Attributes.Add("src", src);
                        RBL_MODULE.SelectedIndex = 0;
                        i++;
                    }
                    if (init)
                    {
                        try
                        {
                            using (DbConnection modconn = new DbConnection(MNTTools.GetConnString(moduleid)))
                            {
                                object[] pardata = new object[2] {
                                    TXT_USERID.Text, moduleid
                                };
                                modconn.ExecuteNonQuery(SP_INITPENDINGMODULEUSER, pardata, dbtimeout);
                            }
                        }
                        catch (Exception ex1)
                        {
                            Response.Write("<!-- " + ex1.Message.Replace("-->", "--)") + " -->\n");
                            MNTTools.LogError(this, (string)Session["UserID"], ex1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("<!-- " + ex.Message.Replace("-->", "--)") + " -->\n");
                MNTTools.LogError(this, (string)Session["UserID"], ex);
            }
        }
示例#2
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...");
     }
 }
示例#3
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...");
     }
 }
示例#4
0
 private void DeletePendingUser(string userid)
 {
     try
     {
         object[] pardata = new object[2] {
             userid, ""
         };
         conn.ExecuteNonQuery(SP_USP_DELETE_PENDING, pardata, dbtimeout);
     }
     catch (Exception ex)
     {
         Response.Write("<!-- " + ex.Message.Replace("-->", "--)") + " -->\n");
         MNTTools.LogError(this, (string)Session["UserID"], ex);
     }
 }
示例#5
0
        private void SaveData()
        {
            try
            {
                for (int i = 0; i <= CBL_SEGMEN.Items.Count - 1; i++)
                {
                    object[] p = new object[] { Request.QueryString["uid"], CBL_SEGMEN.Items[i].Value, CBL_SEGMEN.Items[i].Selected };

                    modconn.ExecuteNonQuery(SP_SAVEUSER, p, dbtimeout);
                }

                //MNTTools.InsertModuleUser(Request.QueryString["uid"], moduleid);
            }
            catch (Exception ex)
            {
                Response.Write("<!-- " + ex.Message.Replace("-->", "--)") + " -->\n");
                MNTTools.LogError(this, (string)Session["UserID"], ex);
            }
        }
示例#6
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();
 }
示例#7
0
        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();
        }