Exemplo n.º 1
0
 private void SelectedIndex(int val)
 {
     if (val == 0)
     {
         CODE.Text = "";
         DESC.Text = "";
         return;
     }
     dbtimeout  = (int)Session["dbTimeOut"];
     ConnString = (string)Session["ConnString"];
     using (conn = new DbConnection(ConnString))
     {
         string qry = _query;
         if (qry == null || qry.Trim() == "")
         {
             qry = "select " + _fldid + ", " + _flddesc + " from " + _tblname;
             if (_cond != null && _cond.Trim() != "")
             {
                 qry += " where (" + _cond + ") ";
             }
             if (_orderby != null && _orderby.Trim() != "")
             {
                 qry += " order by " + _orderby + " ";
             }
         }
         ListItemCollection items = new ListItemCollection();
         MyPage.fillRefList(items, qry, null, dbtimeout, false, conn);
         CODE.Text = items[val].Value;
         DESC.Text = items[val].Text;
     }
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            dbtimeout = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);

            if (!IsPostBack)
            {
                conn = new DbConnection(Session["ConnStringLogin"].ToString());

                MyPage.fillRefList(DDL_MODULEID, Q_RFMODULE + " and moduleid in (" + MaintainedModuleIDs + ")", null, dbtimeout, false, conn);
                conn.ExecReader(Q_RFMODULE + " and moduleid in (" + MaintainedModuleIDs + ")", null, dbtimeout);
                while (conn.hasRow())
                {
                    CHK_MODULEID.Items.Add(new ListItem(conn.GetFieldValue(1), conn.GetFieldValue(0)));
                }
                string cond = " order by sg_grpname ";
                MyPage.fillRefList(DDL_SG_GRPUPLINER, Q_GROUP + cond, null, dbtimeout, true, conn);

                ClearEntries();

                orderby = "";
                ViewState["orderby"] = orderby;

                conn.Dispose();
            }
            else
            {
                orderby = (string)ViewState["orderby"];
            }

            LBL_RESULT.Text = "";
            BTN_SAVE.Attributes.Add("onclick", "if(!cek_mandatory(document.form1)){return false;} else {simpan();};");
            IFR_MODULE.Attributes.Add("onload", "resizeFrame()");
        }
Exemplo n.º 3
0
 private void SelectedValue(string val)
 {
     if (val.Trim() == "" || val.Trim() == " ")
     {
         CODE.Text = "";
         DESC.Text = "";
         return;
     }
     dbtimeout  = (int)Session["dbTimeOut"];
     ConnString = (string)Session["ConnString"];
     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 + " = '" + val + "'";
             }
             else
             {
                 qry += " where " + _fldid + " = '" + val + "'";
             }
             conn.ExecReader(qry, null, dbtimeout);
             if (conn.hasRow())
             {
                 CODE.Text = conn.GetFieldValue(0);
                 DESC.Text = conn.GetFieldValue(1);
             }
         }
         else
         {
             ListItemCollection items = new ListItemCollection();
             MyPage.fillRefList(items, _query, null, dbtimeout, false, conn);
             CODE.Text = "";
             DESC.Text = "";
             for (int i = 0; i < items.Count; i++)
             {
                 if (items[i].Value == val)
                 {
                     CODE.Text = items[i].Value;
                     DESC.Text = items[i].Text;
                     break;
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            dbtimeout  = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);
            ConnString = Session["ConnStringLogin"].ToString();
            if (!IsPostBack)
            {
                string user = (string)Session["UserID"];
                conn = new DbConnection(ConnString);

                uREF_BRANCH.fillRefList(Q_RFBRANCH, true);
                uREF_BRANCHID.fillRefList(Q_RFBRANCH, true);
                uREF_AREAID.fillRefList(Q_RFAREA, true);

                MyPage.fillRefList(DDL_RFMODULE, Q_RFMODULE + " and moduleid in (" + MaintainedModuleIDs + ")", null, dbtimeout, false, conn);
                ArrayList arrddl = new ArrayList();
                arrddl.Add(DDL_RFGROUP);
                arrddl.Add(DDL_GROUPID);
                string cond = " where moduleid in (" + MaintainedModuleIDs + ") ";
                MyPage.fillRefList(arrddl, Q_MODULEGROUPDDL + cond, null, dbtimeout, false, conn);

                orderby = "";
                ViewState["orderby"] = orderby;

                // dummy query to show the grid
                DatGrd.DataSource = conn.GetDataTable(Q_MODULEUSER + " WHERE 1 = 2 ", null, dbtimeout);
                try
                {
                    DatGrd.DataBind();
                }
                catch { }

                ClearEntries();
                conn.Dispose();
            }
            else
            {
                orderby = (string)ViewState["orderby"];
            }

            BTN_SAVE.Attributes.Add("onclick", "if(!cek_mandatory(document.form1)){return false;} else {simpan();};");
            //BTN_SAVE.Attributes.Add("onclick", "simpan();");
        }
Exemplo n.º 5
0
 protected void CHK_MODULEID_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (conn = new DbConnection(Session["ConnStringLogin"].ToString()))
     {
         string cond = " and moduleid in (''";
         for (int i = 0; i < CHK_MODULEID.Items.Count; i++)
         {
             if (CHK_MODULEID.Items[i].Selected)
             {
                 cond += ", '" + CHK_MODULEID.Items[i].Value + "'";
             }
         }
         cond += ")";
         MyPage.fillRefList(RBL_MODULE.Items, Q_RFMODULE + cond, conn);
         RBL_MODULE.Items.RemoveAt(0);
         try { RBL_MODULE.SelectedIndex = 0; RBL_MODULE_SelectedIndexChanged(null, null); }
         catch { }
     }
     MyPage.SetFocus(this, BTN_SAVE);
 }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         object[] par = new object[2] {
             groupid, moduleid
         };
         modconn.ExecNonQuery(SP_RSTDUPAUTH, par, dbtimeout);
         MyPage.fillRefList(dfc_MENUID, Q_RFDUPREJECT, modconn);
         ViewData();
         //BindData();
         BindData2();
         //BindData3();
     }
     else
     {
         if (Request.Form["sta"] == "save")
         {
             SaveData();
         }
     }
 }
Exemplo n.º 7
0
        protected void CODE_TextChanged(object sender, EventArgs e)
        {
            if (CODE.Text.Trim() == "")
            {
                CODE.Text = "";
                DESC.Text = "";
                return;
            }

            dbtimeout  = (int)Session["dbTimeOut"];
            ConnString = (string)Session["ConnString"];
            //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, ctrl);
                    }
                    else
                    {
                        CODE.Text = "";
                        DESC.Text = "";
                        clientmsg = "Kode tidak ditemukan";
                        MyPage.SetFocus(this, CODE);
                    }
                }
                else
                {
                    DropDownList DDL = new DropDownList();
                    MyPage.fillRefList(DDL.Items, _query, null, dbtimeout, false, conn);
                    try
                    {
                        DDL.SelectedValue = CODE.Text;
                        DESC.Text         = DDL.SelectedItem.Text;
                        //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE);
                        //if (ctrl != null)
                        //	MyPage.SetFocus(this, ctrl);
                    }
                    catch
                    {
                        CODE.Text = "";
                        DESC.Text = "";
                        clientmsg = "Kode tidak ditemukan";
                        MyPage.SetFocus(this, CODE);
                    }
                }
            }
        }