Exemplo n.º 1
0
    /// <summary>
    /// 更新信息
    /// </summary>
    public void SaveData()
    {
        var json         = Request["data"];
        var areaData     = Request["areaData"];
        var roleValue    = Request["roleValue"];
        var provinceData = areaData.Split('|')[0];
        var cityData     = areaData.Split('|')[1];
        var area         = areaData.Split('|')[2];
        var rows         = (ArrayList)PluSoft.Utils.JSON.Decode(json);
        var bll          = new Sys.BLL.UserInfo();

        Sys.Model.UserInfo model;
        foreach (Hashtable row in rows)
        {
            var id = row["ID"] != null ? row["ID"].ToString() : "";
            //根据记录状态,进行不同的增加、删除、修改操作
            var state = row["_state"] != null ? row["_state"].ToString() : "";
            if (state == "added" || id == "")           //新增:id为空,或_state为added
            {
                model              = new Sys.Model.UserInfo();
                model.UserName     = row["UserName"].ToString();
                model.RealName     = row["RealName"].ToString();
                model.CompanyName  = row["CompanyName"].ToString();
                model.ProvinceId   = Utils.StrToInt(row["ProvinceId"], 0);
                model.ProvinceName = provinceData.Split(':')[1];
                model.CityId       = Utils.StrToInt(row["CityId"], 0);
                model.CityName     = cityData.Split(':')[1];
                model.AreaId       = Utils.StrToInt(row["AreaId"], 0);
                model.AreaName     = area.Split(':')[1];
                model.Address      = row["Address"].ToString();
                model.RoleId       = Utils.StrToInt(row["RoleId"], 0);
                model.TypeKey      = row["TypeKey"].ToString();
                model.TypeValue    = roleValue.Split(':')[1];
                model.CreateTime   = DateTime.Now;

                var result = new Sys.BLL.UserInfo().Add(model, Utils.MD5(row["Password"].ToString()));
            }
            else if (state == "modified" || state == "") //更新:_state为空或modified
            {
                model = bll.GetModel(Utils.StrToInt(row["ID"], 0));
                if (model != null)
                {
                    model.UserName     = row["UserName"].ToString();
                    model.RealName     = row["RealName"].ToString();
                    model.CompanyName  = row["CompanyName"].ToString();
                    model.ProvinceId   = Utils.StrToInt(row["ProvinceId"], 0);
                    model.ProvinceName = provinceData.Split(':')[1];
                    model.CityId       = Utils.StrToInt(row["CityId"], 0);
                    model.CityName     = cityData.Split(':')[1];
                    model.AreaId       = Utils.StrToInt(row["AreaId"], 0);
                    model.AreaName     = area.Split(':')[1];
                    model.Address      = row["Address"].ToString();
                    model.RoleId       = Utils.StrToInt(row["RoleId"], 0);
                    model.TypeKey      = row["TypeKey"].ToString();
                    model.TypeValue    = roleValue.Split(':')[1];
                    bll.Update(model);
                }
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 订单人员分配
    /// </summary>
    public void GetUserInfoByArea()
    {
        var condition = "1=1";

        if (!string.IsNullOrEmpty(Request["proId"]))
        {
            condition += " and ProvinceId=" + Request["proId"];
        }
        if (!string.IsNullOrEmpty(Request["cityId"]))
        {
            condition += " and CityId=" + Request["cityId"];
        }
        if (!string.IsNullOrEmpty(Request["areaId"]))
        {
            condition += " and AreaId=" + Request["areaId"];
        }
        var dt = new Sys.BLL.UserInfo().GetList(condition).Tables[0];
        List <Sys.Model.DicModel> lis = new List <Sys.Model.DicModel>();

        foreach (DataRow row in dt.Rows)
        {
            lis.Add(new DicModel()
            {
                Key = row["UserName"].ToString(), Value = row["RealName"].ToString()
            });
        }
        var json = PluSoft.Utils.JSON.Encode(lis);

        Response.Write(json);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 查询具体的信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public void GetView()
    {
        var id   = PageRequest.GetInt("id", 0);
        var dt   = new Sys.BLL.UserInfo().GetUserInfoById(id);
        var data = MyDBUtils.DataTable2ArrayList(dt);
        var user = data.Count > 0 ? (Hashtable)data[0] : null;
        var json = PluSoft.Utils.JSON.Encode(user);

        Response.Write(json);
        Response.End();
    }
Exemplo n.º 4
0
    public void PasswordUpdateInit()
    {
        var id    = PageRequest.GetInt("id", 0);
        var model = new Sys.BLL.UserInfo().GetModel(id);
        var json  = string.Empty;

        if (model != null)
        {
            json = PluSoft.Utils.JSON.Encode(model);
        }
        Response.Write(json);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 查询
    /// </summary>
    public void SearchData()
    {
        //查询条件
        var key      = Utils.SqlStringFormat(PageRequest.GetString("key"), 2);
        var userType = PageRequest.GetString("userType");
        //分页
        var pageIndex = PageRequest.GetInt("pageIndex", 1) + 1;
        var pageSize  = PageRequest.GetInt("pageSize", 1);
        //字段排序
        var sortField = PageRequest.GetString("sortField");
        var sortOrder = PageRequest.GetString("sortOrder");
        var order     = "";

        if (String.IsNullOrEmpty(sortField) == false)
        {
            if (sortOrder != "desc")
            {
                sortOrder = "asc";
            }
            order = " u." + sortField + " " + sortOrder;
        }
        else
        {
            order += " u.createtime desc";
        }
        var strWhere = "1=1";

        if (!string.IsNullOrEmpty(userType))
        {
            strWhere += " and  u.RoleId=" + userType;
        }
        if (!string.IsNullOrEmpty(key))
        {
            strWhere += " and  charIndex('" + key + "',u.UserName) > 0";
        }

        if (pageSize == 1)
        {
            pageSize = 100;
        }
        var dt      = new Sys.BLL.UserInfo().GetListForMoreTable(pageSize, pageIndex, strWhere, order);
        var dataAll = MyDBUtils.DataTable2ArrayList(dt);
        var result  = new Hashtable();

        result["data"] = dataAll;
        var total = new Sys.BLL.Common().GetCount("UserInfo u", strWhere);

        result["total"] = total;
        //JSON
        var json = PluSoft.Utils.JSON.Encode(result);

        Response.Write(json);
    }
Exemplo n.º 6
0
    public void StatusInit()
    {
        var id    = PageRequest.GetInt("id", 0);
        var model = new Sys.BLL.UserInfo().GetModel(id);
        var json  = string.Empty;

        if (model != null)
        {
            var userId      = model.UserId;
            var memberModel = new Sys.BLL.Member().GetModel(userId);
            json = PluSoft.Utils.JSON.Encode(memberModel);
        }
        Response.Write(json);
    }
Exemplo n.º 7
0
    /// <summary>
    /// 注册
    /// </summary>
    /// <param name="dicParams"></param>
    /// <returns></returns>
    public Dictionary <string, object> Register(Dictionary <string, object> dicParams)
    {
        Dictionary <string, object> dicResult = new Dictionary <string, object>();
        var dt = JsonHelper.JsonToDataTable(dicParams["user_info"].ToString());

        if (dt != null && dt.Rows.Count > 0)
        {
            var row    = dt.Rows[0];
            var dtUser = new Sys.BLL.Account().GetUserInfoByUserLoginId(row["USERLOGINID"].ToString());
            if (dtUser != null && dtUser.Rows.Count > 0)
            {
                dicResult.Add("response_id", 0);
                dicResult.Add("response_msg", "手机号重复,不能注册!");
                return(dicResult);
            }

            var modelUserInfo = new Sys.Model.UserInfo()
            {
                UserName     = row["USERLOGINID"].ToString(),
                RealName     = row["USERNAME"].ToString(),
                CompanyName  = row["CompanyName"].ToString(),
                ProvinceId   = !string.IsNullOrEmpty(row["ProvinceId"].ToString()) ? Convert.ToInt32(row["ProvinceId"].ToString()) : 0,
                ProvinceName = row["ProvinceName"].ToString(),
                CityId       = !string.IsNullOrEmpty(row["CityId"].ToString()) ? Convert.ToInt32(row["CityId"].ToString()) : 0,
                CityName     = row["CityName"].ToString(),
                AreaId       = !string.IsNullOrEmpty(row["AreaId"].ToString()) ? Convert.ToInt32(row["AreaId"].ToString()) : 0,
                AreaName     = row["AreaName"].ToString(),
                Address      = row["Address"].ToString(),
                contact      = row["contact"].ToString(),
                TypeKey      = row["TypeKey"].ToString(),
                TypeValue    = row["TypeValue"].ToString(),
                RoleId       = !string.IsNullOrEmpty(row["RoleId"].ToString()) ? Convert.ToInt32(row["RoleId"].ToString()) : 0,
            };
            var result = new Sys.BLL.UserInfo().Add(modelUserInfo, Utils.MD5(row["PASSWORD"].ToString()));
            if (result > 0)
            {
                dicResult.Add("response_id", 1);
                dicResult.Add("response_msg", "注册成功!");
            }
            else
            {
                dicResult.Add("response_id", 0);
                dicResult.Add("response_msg", "注册失败!");
            }
        }

        return(dicResult);
    }