Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = new eUser("Manage");
            edt  = new eForm("a_eke_sysUsers", user);
            //edt.AutoRedirect = false;
            if (act.Length == 0)
            {
                List(user);
                return;
            }
            if (act == "getrole")
            {
                string    roleid    = eParameters.QueryString("roleid");
                DataTable rolePower = eBase.getUserPowerDefault(roleid, "", "");
                eJson     json      = new eJson(rolePower);
                eBase.Write(json.ToString());
                Response.End();
            }
            #region 信息添加、编辑
            if (act == "active") //是否显示
            {
                string sql = eParameters.Replace("update a_eke_sysUsers set Active='{querystring:value}' where UserID='{querystring:id}'", null, null);
                eOleDB.Execute(sql);
                Response.Redirect(Request.ServerVariables["HTTP_REFERER"] == null ? "Default.aspx" : Request.ServerVariables["HTTP_REFERER"].ToString(), true);
                eBase.End();
            }
            if (act == "getuser")
            {
                sql = "select count(*) from a_eke_sysUsers where yhm='" + eParameters.QueryString("value") + "'";
                string temp = eOleDB.getValue(sql);
                if (temp == "0")
                {
                    Response.Write("true");
                }
                else
                {
                    Response.Write("false");
                }
                Response.End();
            }
            if (act == "edit")
            {
                f1.Attributes = " readOnly";
            }

            edt.AddControl(eFormControlGroup);
            eFormControl _roles = new eFormControl("Roles");
            _roles.Field = "RoleID";
            edt.AddControl(_roles);
            edt.onChange += new eFormTableEventHandler(edt_onChange);
            edt.Handle();
            #endregion
            if (act == "add" || act == "edit")
            {
                eBase.clearDataCache("a_eke_sysPowers");
                LitRoles.Text = getRoles(_roles.Value.ToString()); //edt.Fields["RoleID"].ToString()
            }
        }
Exemplo n.º 2
0
        protected void Action_Actioning(string Actioning)
        {
            string sql = "";

            eform         = new eForm("a_eke_sysModels", user);
            eform.ModelID = "1";
            if (Actioning.ToLower() == "view")
            {
                eFormControl uc = new eFormControl("f0");
                uc.Field = "Type";
                eform.Controls.Add("f0", uc);
            }
            if (Actioning.ToLower() == "setsort")
            {
                string  ParentID = eParameters.QueryString("pid").Replace("NULL", "");
                int     index    = Convert.ToInt32(eParameters.QueryString("index"));
                DataRow dr       = eOleDB.getDataTable("SELECT * FROM a_eke_sysModels where ModelID='" + id + "'").Select()[0];
                string  oldpid   = dr["ParentID"].ToString();
                int     oldindex = Convert.ToInt32(dr["px"]);


                if (ParentID == oldpid)   //父级不变
                {
                    if (oldindex < index) //小变大
                    {
                        sql = "update a_eke_sysModels set PX=PX-1 where delTag=0 " + (ParentID.Length == 0 ? " and ParentID IS NULL" : " and ParentID='" + ParentID + "'") + " and PX>" + oldindex.ToString() + " and PX<=" + index.ToString();
                        eOleDB.Execute(sql);
                    }
                    else //大变小
                    {
                        sql = "update a_eke_sysModels set PX=PX+1 where delTag=0 " + (ParentID.Length == 0 ? " and ParentID IS NULL" : " and ParentID='" + ParentID + "'") + " and PX>=" + index.ToString() + " and PX<" + oldindex.ToString();
                        eOleDB.Execute(sql);
                    }
                    sql = "update a_eke_sysModels set PX='" + index.ToString() + "' where ModelID='" + id + "'";
                    eOleDB.Execute(sql);
                }
                else
                {
                    sql = "update a_eke_sysModels set PX=PX-1 where delTag=0 " + (oldpid.Length == 0 ? " and ParentID IS NULL" : " and ParentID='" + oldpid + "'") + " and PX>" + oldindex.ToString();
                    eOleDB.Execute(sql);

                    sql = "update a_eke_sysModels set PX=PX+1 where delTag=0 " + (ParentID.Length == 0 ? " and ParentID IS NULL" : " and ParentID='" + ParentID + "'") + " and PX>=" + index.ToString();
                    eOleDB.Execute(sql);

                    sql = "update a_eke_sysModels set PX='" + index.ToString() + "',ParentID=" + (ParentID.Length == 0 ? "NULL" : "'" + ParentID + "'") + " where ModelID='" + id + "'";
                    eOleDB.Execute(sql);
                }
                eBase.clearDataCache("a_eke_sysModels");
                eBase.End();
            }
            if (Actioning.Length > 0)
            {
                eform.onChange += new eFormTableEventHandler(eform_onChange);
                eform.AddControl(eFormControlGroup);
                eform.Handle();
            }
        }