Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            ljxpower.BLL.com_user bll = new ljxpower.BLL.com_user();
            if (context.Request.QueryString["type"] == "pass")//修改密码
            {
                userinfo userobj = (userinfo)context.Session["userobj"];
                string   Userid  = userobj.userid;
                string   pass    = context.Request.QueryString["pass"];

                ljxpower.Model.com_user model = new ljxpower.Model.com_user();
                string myid = ljxpower.Common.DbHelperMySQL.getvalue("select id from com_user where userid='" + Userid + "'");
                if (myid == "")
                {
                    myid = "0";
                }
                model          = bll.GetModel(int.Parse(myid));
                model.password = ljxpower.Common.DESEncrypt.Encrypt(pass);
                if (bll.Update1(model))
                {
                    context.Response.Write("true");
                }
                else
                {
                    context.Response.Write("false");
                }
            }
            if (context.Request.QueryString["type"] == "login")//修改密码
            {
                string Userid = context.Request.QueryString["userid"];
                string pass   = context.Request.QueryString["pass"];

                context.Session.RemoveAll();
                string name = Userid.Replace("'", "").Replace(" ", "");
                pass = pass.Replace("'", "").Replace(" ", "");
                //string strwhere = "";
                //string username = "";
                pass = ljxpower.Common.DESEncrypt.Encrypt(pass);

                #region  login ....


                #endregion login....
            }
            if (context.Request.QueryString["type"] == "edit")//获取要编辑的用户信息
            {
                string  Userid = context.Request.QueryString["Id"];
                DataSet ds     = ljxpower.Common.DbHelperMySQL.Query("select RolesId,UserId from tb_rolesadduser where UserId = '" + Userid + "'");
                string  IdList = "";
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (IdList != "")
                    {
                        IdList += ",";
                    }
                    IdList += dr["RolesId"].ToString();
                }
                context.Response.Write(IdList);
            }
            else if (context.Request.QueryString["type"] == "role")//
            {
                string Userid = context.Request.QueryString["Userid"];
                string role   = context.Request.QueryString["role"];
                if (Userid != null && Userid != "null" && Userid != "undefined")//
                {
                    saveRole(Userid, role);
                }
            }
            else if (Convert.ToString(context.Request.Form["action"]) == "query" || context.Request.Form["OrgId"] != null)
            {
                int    row      = int.Parse(context.Request["rows"].ToString());
                int    page     = int.Parse(context.Request["page"].ToString());
                string strorgid = "";
                string strWhere = "";
                if (context.Request["OrgId"] != null)
                {
                    strorgid = zhangte.Common.DbHelperMySQL.getvalue("select OrgId from com_organization where   id=" + context.Request["OrgId"].ToString());
                    strorgid = strorgid.Replace("0", " ").TrimEnd();
                    strorgid = strorgid.Replace(" ", "0");
                    strWhere = " orgid like '" + strorgid + "%'";
                }

                string retstr = "";
                retstr = bll.GetListByPageColumns_tojson("*", strWhere, "userid desc", row, page);

                context.Response.Write(retstr);
            }
        }
Exemplo n.º 2
0
        public override void ProcessRequest(HttpContext context)
        {
            ljxpower.BLL.com_user bll = new ljxpower.BLL.com_user(context);
            base.ProcessRequest(context);
            context.Response.ContentType = "text/plain";

            mycommonClass mycommonClassobj = new mycommonClass();

            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            if (context.Request.QueryString["type"] == "edit")//获取编辑信息
            {
                if (context.Request.QueryString["Id"] != null)
                {
                    string strret = bll.Geteditdata(context.Request.QueryString["Id"].ToString());//aa1
                    context.Response.Write(strret);
                }
            }
            else if (context.Request.QueryString["type"] == "del")//删除信息
            {
                if (context.Request.QueryString["Id"] == null)
                {
                    return;
                }
                string Id = context.Request.QueryString["Id"].ToString();
                bll.Delete(int.Parse(Id));
                kyfly.Common.DbHelperMySQL.ExecuteSql("delete from  Com_OrgAddUser where UserId=" + Id);
            }
            else if (context.Request.QueryString["type"] == "combox")//保存修改或添加 信息 aa2
            {
                if (context.Request.QueryString["comboxname"] == "status")
                {
                    ljxpower.BLL.com_zidian bllzd = new ljxpower.BLL.com_zidian();
                    string strret = bllzd.GetListByColumn_tojson("Id,xianshizhi", "leibie='人员状态'", "");
                    context.Response.Write(strret);
                    //context.Response.Write("");
                }

                if (context.Request.QueryString["comboxname"] == "orgid")
                {
                    ljxpower.BLL.com_organization bllzd = new ljxpower.BLL.com_organization();
                    string strret = bllzd.GetListByColumn_tojson("Id,Agency,orgid,Person", "1=1", "");
                    context.Response.Write(strret);
                }
            }
            else if (context.Request.QueryString["type"] == "comboxtree")
            {
                //string str = "";
                //str =  ljxpower.Common.DbHelperMySQL.getvalue("select mycontent from temp1");
                //context.Response.Write(str);
                //return;

                StringBuilder sb = new StringBuilder();

                ljxpower.BLL.com_organization orgbll = new ljxpower.BLL.com_organization();

                DataSet ds = new DataSet();
                ds = orgbll.GetAllList();
                if (ds.Tables.Count > 0)
                {
                    sb.Append("[");
                    DataView dv = new DataView(ds.Tables[0]);
                    dv.RowFilter = "ParentId=0";
                    dv.Sort      = " Sort ";
                    for (int i = 0; i < dv.Count; i++)
                    {
                        sb.Append("{");
                        sb.Append("\"id\":" + dv[i]["orgid"] + ",");
                        sb.Append("\"text\":\"" + dv[i]["Agency"] + "\"");

                        DataView dv2 = new DataView(ds.Tables[0]);
                        dv2.RowFilter = "ParentId=" + dv[i]["Id"];
                        dv2.Sort      = " Sort ";
                        if (dv2.Count > 0)
                        {
                            sb.Append(GetChlid(dv2, ds));
                        }
                        sb.Append("},");
                    }
                    sb.Remove(sb.Length - 1, 1);
                    sb.Append("]");
                }
                context.Response.Write(sb.ToString());
            }

            else if (context.Request.QueryString["type"] == "powersave")//保存修改或添加
            {
                string   userstr = context.Request.QueryString["idlist"].ToString();
                string   roleid  = context.Request.QueryString["roleid"].ToString();
                string[] userid;
                if (userstr != "" && roleid != "")
                {
                    userid = userstr.Split(':');
                    for (int i = 0; i < userid.Length; i++)
                    {
                        if (userid[i] == "")
                        {
                            continue;
                        }
                        saveRole(userid[i], roleid);
                    }
                }
            }

            else if (context.Request.QueryString["type"] == "save")//保存修改或添加
            {
                string userid        = context.Request.QueryString["userid"];
                string logincount    = context.Request.QueryString["logincount"];
                string username      = context.Request.QueryString["username"];
                string orgid         = context.Request.QueryString["orgid"];
                string password      = context.Request.QueryString["password"];
                string usertype      = context.Request.QueryString["usertype"];
                string status        = context.Request.QueryString["status"];
                string gongsibianhao = context.Request.QueryString["gongsibianhao"];
                string orgname       = context.Request.QueryString["orgname"];
                if (password.Trim() != "")
                {
                    password = ljxpower.Common.DESEncrypt.Encrypt(password);
                }
                else
                {
                    password = kyfly.Common.DbHelperMySQL.getvalue("select password from com_user where   UserId=" + userid);
                }
                if (context.Request.QueryString["Id"] != null && context.Request.QueryString["Id"] != "")
                {
                    if (kyfly.Common.DbHelperMySQL.getvalue("select id from Com_OrgAddUser where   UserId=" + userid) == "")
                    {
                        kyfly.Common.DbHelperMySQL.ExecuteSql("insert into  Com_OrgAddUser(orgid,UserId) values('" + orgid + "','" + userid + "')");
                    }
                    else
                    {
                        bll.Update(context.Request.QueryString["Id"].ToString(), userid, logincount, username, orgid, password, usertype, status, gongsibianhao, orgname);
                        kyfly.Common.DbHelperMySQL.ExecuteSql("update  Com_OrgAddUser set orgid='" + orgid + "' where UserId=" + userid);
                    }
                }//(string Id, string userid, string logincount, string username, string orgid, string password, string usertype, string status, string gongsibianhao)
                else
                {
                    bll.Add(userid, logincount, username, orgid, password, usertype, status, gongsibianhao, username);
                }

                context.Response.Write("true");
            }
            else if (Convert.ToString(context.Request.Form["action"]) == "query")
            {
                //string strret = bll.GetListByPageColumns_tojson("id,产品名称,产品数量,产品规格,备注", "1=1", "产品数量"); 加权限, 1=1 改为:部门编号 like '1010%'
                string strret = bll.GetListByPageColumns_tojson("Id,userid,logincount,username,orgid,password,usertype,status,gongsibianhao,orgname", pagestrif, "Id");
                context.Response.Write(strret);
                return;
            }
            else
            {
            }
        }