Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     moduleid      = Request.QueryString["moduleid"];
     groupid       = Request.QueryString["grpid"];
     dbtimeout     = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);
     ConnString    = Session["ConnStringLogin"].ToString();
     ModConnString = MNTTools.GetConnString(moduleid);
     if (!IsPostBack)
     {
         using (modconn = new DbConnection(ModConnString))
         {
             //ViewData();
         }
     }
     else
     {
         if (Request.Form["sta"] == "save")
         {
             using (modconn = new DbConnection(ModConnString))
             {
                 SaveData();
             }
         }
     }
 }
Esempio n. 2
0
 protected override void OnLoad(EventArgs e)
 {
     moduleid      = Request.QueryString["moduleid"];
     groupid       = Request.QueryString["gid"];
     dbtimeout     = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);
     ModConnString = MNTTools.GetConnString(moduleid);
     modconn       = new DbConnection(ModConnString);
     base.OnLoad(e);
 }
Esempio n. 3
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);
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            string modid = "61";

            if (Request.QueryString["moduleid"] != null && Request.QueryString["moduleid"].Trim() != "")
            {
                modid = Request.QueryString["moduleid"];
            }
            conn = new DbConnection(MNTTools.GetConnString(modid));
            base.OnLoad(e);
        }
Esempio n. 5
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...");
     }
 }
Esempio n. 6
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...");
     }
 }
Esempio n. 7
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);
     }
 }
Esempio n. 8
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);
            }
        }
Esempio n. 9
0
        private bool ProcessPending()
        {
            bool flag_sameuser = false;

            for (int i = 0; i < DG_REQUEST.Items.Count; i++)
            {
                RadioButton rdA = (RadioButton)DG_REQUEST.Items[i].FindControl("RDO_APPROVE"),
                            rdR = (RadioButton)DG_REQUEST.Items[i].FindControl("RDO_REJECT");

                if (rdA.Checked == true)
                {
                    if (DG_REQUEST.Items[i].Cells[5].Text == Session["USERID"].ToString())
                    {
                        flag_sameuser = true;
                    }
                    else
                    {
                        if (DG_REQUEST.Items[i].Cells[3].Text == "2")
                        {
                            MNTTools.RemoveUser(DG_REQUEST.Items[i].Cells[0].Text, DG_REQUEST.Items[i].Cells[9].Text, (string)Session["UserID"]);
                        }
                        if (DG_REQUEST.Items[i].Cells[3].Text == "3")
                        {
                            MNTTools.RestoreUser(DG_REQUEST.Items[i].Cells[0].Text, DG_REQUEST.Items[i].Cells[9].Text, (string)Session["UserID"]);
                        }
                        else if (DG_REQUEST.Items[i].Cells[3].Text == "0" || DG_REQUEST.Items[i].Cells[3].Text == "1")
                        {
                            MNTTools.ApproveUser(DG_REQUEST.Items[i].Cells[0].Text, DG_REQUEST.Items[i].Cells[9].Text, (string)Session["UserID"]);
                        }
                    }
                }
                else if (rdR.Checked == true)
                {
                    object[] parreject = new object[1] {
                        DG_REQUEST.Items[i].Cells[0].Text
                    };
                    conn.ExecuteNonQuery(U_DELPENDING, parreject, dbtimeout);
                }
            }
            return(!flag_sameuser);
        }
Esempio n. 10
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            string modid = "61";

            if (Request.QueryString["moduleid"] != null && Request.QueryString["moduleid"].Trim() != "")
            {
                modid = Request.QueryString["moduleid"];
            }
            conn    = new DbConnection(MNTTools.GetConnString(modid));
            TableNm = Request.QueryString["TBLNM"];

            object[] param = new object[] { TableNm };

            dtparam       = conn.GetDataTable(Q_PARAMSYS, param, dbtimeout);
            dtparamschema = conn.GetDataTable("SELECT TOP 0 * FROM " + TableNm, null, dbtimeout, true, true);

            clrButton.Attributes["onclick"] = createcontrol();

            creategridquery();
        }
Esempio n. 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();
 }
Esempio n. 12
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();
        }