/// <summary>
        /// 提交升级申请
        /// </summary>
        /// <returns></returns>
        public ActionResult toApplyUpgrade(int C_UserTypeID)
        {
            if (C_UserTypeID == 0)
            {
                return(Content("申请的等级有误"));
            }
            C_UserType userType = C_UserType.GetEntityByLever(C_UserTypeID);

            if (userType == null)
            {
                return(Content("申请的等级有误"));
            }

            int ordercnt = Order.GetUserOrderCnt(CurrentUser.UserName);

            if (ordercnt <= 0)
            {
                return(Content("您从来没下过单,不能升级!快去下单吧!"));
            }

            //C_UserVM P_user = C_UserVM.GetVMByID(CurrentUser.Chief);
            //if (userType.Lever <= P_user.userTypeLever)
            //{
            //    return Content("您暂时不能升级到" + userType.Name);
            //}

            string rtn = C_UserUpGrade.toUpGrade(CurrentUser.UserName, C_UserTypeID);

            return(Content(rtn));
        }
        public RequestResult AddUser(int typeid, string name, string contact, string phone, string area, string address)
        {
            RequestResult result = new RequestResult();

            try
            {
                #region 验证
                string msg  = string.Empty;
                bool   IsOK = VerifyAddInfo(typeid, name, contact, phone, area, address, out msg);
                if (!IsOK)
                {
                    result.message = msg;
                    result.success = false;
                    return(result);
                }
                #endregion

                C_User user = new C_User();
                user.C_UserTypeID = typeid;
                user.Name         = name;
                user.wxNo         = contact;
                user.Phone        = phone;

                string[] AreaArray = area.Split(',');
                user.Province     = AreaArray[0] != null ? AreaArray[0] : "";
                user.City         = AreaArray[1] != null ? AreaArray[1] : "";
                user.Area         = AreaArray[2] != null ? AreaArray[2] : "";
                user.WxQRCode     = address;
                user.DatPwdChange = DateTime.Now;
                user.DatCreate    = DateTime.Now;
                user.IsValid      = true;
                user.PassWord     = user.Phone.Substring(user.Phone.Length - 6, 6);
                user.Chief        = MobileUser.ID;
                user.state        = "已审核";
                user.ID           = user.InsertAndReturnIdentity();

                C_UserType usertype = C_UserType.GetEntityByLever(typeid);
                int        idLen    = user.ID.ToString().Length;
                string     idDQ     = user.ID.ToString();
                if (idLen < 5)
                {
                    string zero = new string('0', 5 - idLen);
                    idDQ = zero + idDQ;
                }
                user.UserName   = usertype.TypeCode + idDQ;
                user.Identifier = usertype.TypeCode + idDQ;
                user.UpdateByID();

                result.data    = user.ID;
                result.message = "成功";
                result.success = true;
            }
            catch (Exception ex)
            {
                result.message = "失败,error:" + ex.Message;
                result.success = false;
            }
            return(result);
        }
Exemple #3
0
        public ActionResult GetLeverList(string SelVal, int Lever)
        {
            List <C_UserType> cType = C_UserType.GetEntitysAll().ToList();
            List <C_UserType> nType = new List <C_UserType>();

            if (SelVal == "授权链接")
            {
                nType = cType.Where(m => m.Lever > Lever).ToList();
            }
            else
            {
                nType = cType.Where(m => m.Lever <= Lever).ToList();
            }
            return(Json(nType, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult GetTypeAdd(C_UserType Types)
        {
            if (string.IsNullOrWhiteSpace(Types.Name))
            {
                return(Content("类型名称不能为空"));
            }
            if (Types.Lever <= 0)
            {
                return(Content("类型级别必须大于0"));
            }
            if (C_UserType.GetEntittyInt(Types.Lever))
            {
                return(Content("已经有这个级别请重新输入!!"));
            }
            int rtn = Types.InsertAndReturnIdentity();

            return(Content(rtn > 0 ? "ok" : "添加出错了!!"));
        }
        public ContentResult edit(int id, decimal price)
        {
            C_UserType type = C_UserType.GetEntityByID(id);

            if (type == null)
            {
                return(Content("该客户级别不存在"));
            }

            int rtn = C_UserType.EditMinOrderPriceByID(id, price);

            if (rtn > 0)
            {
                SYSLog.add("修改[" + type.Name + "]订单最小金额从[" + type.MinOrderPrice + "]修改为[" + price + "]", "后台用户" + CurrentUser.UserName + "(" + CurrentUser.Name + ")", CurrentURL, "订单最小金额", "电脑端后台");
            }

            return(Content(rtn > 0?"ok":"修改出错啦"));
        }
        public RequestResult GetUserSubType()
        {
            RequestResult result = new RequestResult();

            try
            {
                List <C_UserType_Simple> UserTypeList = C_UserType.GetLowerByUserID(MobileUser.C_UserTypeID);
                result.data    = UserTypeList;
                result.message = "成功";
                result.success = true;
            }
            catch (Exception ex)
            {
                result.message = "失败,error:" + ex.Message;
                result.success = false;
            }
            return(result);
        }
Exemple #7
0
        public ActionResult GetTypeEdit(C_UserType Types)
        {
            if (string.IsNullOrWhiteSpace(Types.Name))
            {
                return(Content("类型名称不能为空"));
            }
            C_UserType oldType = C_UserType.GetEntityByID(Types.ID);

            oldType.Name     = Types.Name;
            oldType.TypeCode = Types.TypeCode;
            int rtn = oldType.UpdateByID();

            if (rtn > 0)
            {
                SYSLog.add("将代理类型[" + oldType.Name + "]从[" + oldType.Name + "]修改为[" + Types.Name + "]", "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "修改代理类型", "电脑后台");
            }

            return(Content(rtn > 0 ? "ok" : "修改出错了!!"));
        }
        /// <summary>
        /// 申请升级
        /// </summary>
        /// <returns></returns>
        public ActionResult ApplyUpgrade()
        {
            C_UserVM user = C_UserVM.GetVMByID(CurrentUser.ID);

            ViewData["user"] = user;
            //List<C_UserType> userTypes = C_UserType.GetLowerByUserID(user.Chief,CurrentUser.ID);
            List <C_UserType> userTypes = C_UserType.GetEntitysAll();

            if (userTypes != null)
            {
                userTypes = userTypes.OrderByDescending(m => m.Lever).ToList();
                userTypes = userTypes.FindAll(m => m.Lever < user.userTypeLever).ToList();
            }
            ViewData["userTypes"] = userTypes;

            List <C_UserUpGrade> doings = C_UserUpGrade.GetDetailListByAuditStat("未审核", CurrentUser.UserName);

            ViewData["doings"] = doings;
            return(View());
        }
Exemple #9
0
        public ActionResult GetUpdateLever(C_User cUser)
        {
            C_User c_user = C_User.GetEntityByID(cUser.ID);

            string oldC_UserTypeName = C_UserType.GetNameByLever(c_user.C_UserTypeID.ToString());


            c_user.C_UserTypeID = cUser.C_UserTypeID;


            string newC_UserTypeName = C_UserType.GetNameByLever(c_user.C_UserTypeID.ToString());

            int rtn = c_user.UpdateByID();

            if (rtn > 0)
            {
                SYSLog.add("将经销商[" + c_user.Name + "]的等级从[" + oldC_UserTypeName + "]修改为[" + newC_UserTypeName + "]", "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "修改经销商级别", "电脑后台");
            }

            return(Content(rtn > 0 ? "ok" : "出错了"));
        }
Exemple #10
0
        /// <summary>
        /// 推荐码
        /// </summary>
        /// <returns></returns>
        public ActionResult IntroducerCode()
        {
            ViewData["user"] = C_UserVM.GetVMByID(CurrentUser.ID);
            InviteCode code = WeModels.InviteCode.GetListByUserName(CurrentUser.UserName, "推荐");

            if (code == null || code.ValidDat < DateTime.Now)
            {
                code          = new InviteCode();
                code.UserName = CurrentUser.UserName;
                code.ValidDat = DateTime.Now.AddMinutes(20);//二十分钟有效
                code.Type     = "推荐";
                code.ID       = code.InsertAndReturnIdentity();
            }
            ViewData["code"] = code;

            List <C_UserType> userTypes = C_UserType.GetC_UserTypeHeighter(CurrentUser.ID).ToList();

            userTypes             = userTypes.OrderByDescending(m => m.Lever).ToList();
            ViewData["userTypes"] = userTypes;

            return(View());
        }
Exemple #11
0
        /// <summary>
        /// 被推荐的申请
        /// </summary>
        /// <param name="id"></param>
        /// <param name="key"></param>
        /// <param name="type"> code为具有有效期 </param>
        /// <param name="usertype">申请等级</param>
        /// <returns></returns>
        public ActionResult Index_Recommended(string id, string key, string type, string usertype)
        {
            if (type == null)
            {
                type = "";
            }

            ViewData["type"] = type;
            int lever = 0;

            int.TryParse(usertype, out lever);

            C_UserType applyUserType = C_UserType.GetEntityByLever(lever);

            if (applyUserType == null)
            {
                return(View(ErrorPage.ViewName, new ErrorPage {
                    Message = "您申请的等级已经不存在啦"
                }));
            }

            C_UserVM user = new C_UserVM();

            user = C_UserVM.GetVMByUserNameOrPhone(id);//推荐人信息
            if (user == null)
            {
                return(View(ErrorPage.ViewName, new ErrorPage {
                    Message = "推荐人不存在"
                }));
            }

            C_UserVM P_User   = user;
            int      P_Chief  = 0;
            int      MaxLevel = C_UserType.GetMaxLevel();//最大等级


            if (applyUserType.Lever == MaxLevel || user.Chief == 0)
            {
                P_User  = null;
                P_Chief = 0;
            }
            else
            {
                while (true)
                {
                    P_User = C_UserVM.GetVMByID(P_User.Chief);//推荐人的上级
                    if (applyUserType.Lever > P_User.userTypeLever)
                    {
                        P_Chief = P_User.ID;
                        break;
                    }
                }
            }

            ViewData["Introducer"]     = id;   //推荐人账号
            ViewData["IntroducerData"] = user; //推荐人信息
            ViewData["applyUserType"]  = applyUserType;

            ViewData["P_User"] = P_User;//上级信息
            return(View());
        }
Exemple #12
0
        public ActionResult GetTypeDel(int ID)
        {
            int rtn = C_UserType.DeleteByID(ID);

            return(Content(rtn > 0 ? "ok" : "删除出错了!!"));
        }
        public ActionResult Index()
        {
            List <C_UserType> usertype = C_UserType.GetEntitysAll().OrderByDescending(m => m.Lever).ToList();

            return(View(usertype));
        }
Exemple #14
0
        public ActionResult TypeEditIndex(int ID)
        {
            C_UserType Types = C_UserType.GetEntityByID(ID);

            return(View(Types));
        }
Exemple #15
0
        public ActionResult DirectlyIndex_inport()
        {
            C_UserType usertype = C_UserType.GetMaxLevel_UserType();



            int    idLen = C_User.GetTopUseID().ToString().Length;
            string idDQ  = (C_User.GetTopUseID() + 1).ToString();

            if (idLen < 5)
            {
                string zero = new string('0', 5 - idLen);
                idDQ = zero + idDQ;
            }
            string msg = "";

            try
            {
                var    file = Request.Files[0];
                string path = Request.MapPath("~/");
                string ext  = Path.GetExtension(file.FileName);//获得文件扩展名
                if (!Directory.Exists(Server.MapPath("~/Codetxt/")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/Codetxt/"));
                }
                if (file.ContentLength == 0 || file == null)
                {
                    msg = "上传的文件没有内容!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                if (file.ContentLength > 3242880)
                {
                    msg = "上传的文件不能超过3MB!!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                if (ext != ".txt")
                {
                    msg = "上传文件格式不对!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                string DatNow = DateTime.Now.ToString("yyyyMMddHHmmss");
                file.SaveAs(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
                StreamReader sr = new StreamReader(Server.MapPath("~/Codetxt/" + DatNow + ".txt"), Encoding.Default);
                String       line;
                var          i        = 0;
                int          idDQ_num = 0;
                while ((line = sr.ReadLine()) != null)
                {
                    i++;
                    if (i == 1)
                    {
                        continue;
                    }
                    try
                    {
                        string[] list = line.ToString().Split(',');
                        if (string.IsNullOrWhiteSpace(list[0]) || string.IsNullOrWhiteSpace(list[1]))
                        {
                            continue;
                        }
                        if (C_User.GetPhoneCnt(list[1]) > 0 || C_User.GetNameCnt(list[0]) > 0)
                        {
                            SYSLog.add("导入失败(数据重复):手机号-" + list[1] + "||经销商名称-" + list[0], "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "导入用户", "电脑后台");
                            DAL.Log.Instance.Write("数据重复:手机号-" + list[1] + "||经销商名称-" + list[0], "导入用户失败");
                            continue;
                        }

                        /* var ls = idDQ.Length;
                         * if (Convert.ToInt32(idDQ)==idDQ_num)
                         * {
                         *   idDQ = (idDQ_num + 1).ToString();
                         *   idDQ_num = Convert.ToInt32(idDQ);
                         * }
                         * else
                         * {
                         *   idDQ_num = Convert.ToInt32(idDQ);0
                         * }
                         * if (ls > idDQ.ToString().Length)
                         * {
                         *   int length1 = ls - idDQ.ToString().Length;
                         *   if (length1 == 5) idDQ = "00000" + idDQ;
                         *   if (length1 == 4) idDQ = "0000" + idDQ;
                         *   if (length1 == 3) idDQ = "000" + idDQ;
                         *   if (length1 == 2) idDQ = "00" + idDQ;
                         *   if (length1 == 1) idDQ = "0" + idDQ;
                         * }*/
                        C_User para = new C_User();
                        para.state        = "已审核";
                        para.Chief        = 0;
                        para.C_UserTypeID = 1;
                        para.UserName     = usertype.TypeCode + (C_User.GetTopUseID() + 1 + 10000);
                        //经销商名称 联系人 联系方式 省份 市区 城镇 详细地址

                        para.Name       = list[0];
                        para.Phone      = list[2];
                        para.PassWord   = para.Phone.Substring(para.Phone.Length - 6, 6);
                        para.Card       = "";
                        para.Identifier = usertype.TypeCode + (C_User.GetTopUseID() + 1 + 10000);
                        para.wxNo       = list[1];
                        if (list.Count() > 4)
                        {
                            para.Province = string.IsNullOrWhiteSpace(list[3]) ? "" : list[4];
                        }
                        if (list.Count() > 5)
                        {
                            para.City = string.IsNullOrWhiteSpace(list[4]) ? "" : list[5];
                        }
                        if (list.Count() > 6)
                        {
                            para.Area = string.IsNullOrWhiteSpace(list[5]) ? "" : list[6];
                        }
                        if (list.Count() > 7)
                        {
                            para.WxQRCode = string.IsNullOrWhiteSpace(list[6]) ? "" : list[7];
                        }
                        para.DatCreate = DateTime.Now;
                        if (string.IsNullOrWhiteSpace(para.UserName))
                        {
                            return(Content("经销商编号不能为空"));
                        }
                        if (string.IsNullOrWhiteSpace(para.Name))
                        {
                            return(Content("姓名不能为空"));
                        }
                        if (string.IsNullOrWhiteSpace(para.Identifier))
                        {
                            return(Content("授权编号不能为空"));
                        }
                        if (RepeatHelper.NoRepeat("C_User", "Identifier", para.Identifier, para.ID) > 0)
                        {
                            return(Content("授权编号已存在"));
                        }



                        para.InsertAndReturnIdentity();
                    }
                    catch (Exception e)
                    {
                        DAL.Log.Instance.Write(e.Message, "导入用户失败");
                        continue;
                    }
                }
                sr.Close();
                System.IO.File.Delete(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
                msg = "导入成功!";
                TempData["ToIndex_err"] = msg;
                return(View("DirectlyIndex"));
            }
            catch
            {
                msg = "导入失败,文件太大!!";
                TempData["ToIndex_err"] = msg;
                return(View("DirectlyIndex"));
            }
        }
Exemple #16
0
        public ActionResult Index()
        {
            List <C_UserType> Types = C_UserType.GetEntityList("");

            return(View(Types));
        }
Exemple #17
0
        public ContentResult toApply_Recommended(FormCollection c)
        {
            C_User user         = new C_User();
            int    C_UserTypeID = 0;

            int.TryParse(c["C_UserTypeID"], out C_UserTypeID);
            user.C_UserTypeID = C_UserTypeID;

            string addressStr = c["PCAids"];

            if (string.IsNullOrWhiteSpace(addressStr))
            {
                return(Content("请选择所在地"));
            }
            string[] addre = addressStr.Split(',');

            for (int i = 0; i < addre.Length; i++)
            {
                if (i == 0)
                {
                    user.Province = addre[i];
                }
                else if (i == 1)
                {
                    user.City = addre[i];
                }
                else if (i == 2)
                {
                    user.Area = addre[i];
                }
            }

            user.Introducer = c["Introducer"];
            C_User IntroducerUser = C_User.GetC_UserByUserName(user.Introducer);//推荐人信息

            if (IntroducerUser == null)
            {
                return(Content("推荐人信息有误"));
            }

            string     ChiefUserName = c["ChiefUserName"];
            C_UserType userType      = C_UserType.GetEntityByLever(C_UserTypeID);

            if (userType == null)
            {
                return(Content("代理级别不存在"));
            }

            if (string.IsNullOrWhiteSpace(ChiefUserName))
            {
                user.Chief = 0;
            }
            else
            {
                C_User ChiefC_User = C_User.GetUserByUserName(ChiefUserName);

                if (ChiefC_User == null)
                {
                    return(Content("上级不存在"));
                }
                user.Chief = ChiefC_User.ID;//上级用户
            }

            user.Phone = c["Phone"];
            if (C_User.GetPhoneCnt(user.Phone) > 0)
            {
                return(Content("该手机号已存在"));
            }


            user.Card = c["Card"];
            if (user.Card.Length != 18)
            {
                return(Content("身份证号码有误,请输入有效的二代身份证"));
            }

            if (C_User.GetCardCnt(user.Card) > 0)
            {
                return(Content("该身份证已存在"));
            }

            user.DatCreate   = DateTime.Now;
            user.IsValid     = true;
            user.Name        = c["Name"];
            user.PassWord    = user.Card.SubStringSafe(user.Card.Length - 6, 6);
            user.PortraitUrl = WeConfig.wx_domain + "/images/27.png";


            user.state = "未审核";
            user.wxNo  = c["wxNo"];
            if (string.IsNullOrWhiteSpace(user.wxNo))
            {
                return(Content("微信号不能为空"));
            }

            user.UserName   = "******" + (C_User.GetTopUseID() + 1 + 1000);
            user.Identifier = "FZ" + "00000".Substring(0, 5 - (C_User.GetTopUseID() + 1).ToString().Length) + ((C_User.GetTopUseID() + 1));
            string imgName = DateTime.Now.ToString("yyyy-MM-dd-HH-ss") + DateTime.Now.Ticks;
            bool   flag    = false;

            user.ID = user.InsertAndReturnIdentity();

            try
            {
                if (!Directory.Exists(Server.MapPath("~/File/User/AuthData/")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/File/User/AuthData/"));
                }
                flag = true;
            }
            catch (Exception ex)
            {
                DAL.Log.Instance.Write(ex.ToString(), "agentApply_toApply_error");
            }

            if (flag)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("保存出错"));
            }
        }
Exemple #18
0
        public ActionResult DirectlyIndex_toAdd(C_User para)
        {
            C_UserType usertype = C_UserType.GetMaxLevel_UserType();

            para.state   = "已审核";
            para.Chief   = 0;
            para.IsValid = true;
            var UType = Request.Params["C_UserTypeID"].Split(',')[1] == "" ? 0 : Convert.ToInt32(Request.Params["C_UserTypeID"].Split(',')[1]);

            if (UType > 1)
            {
                para.C_UserTypeID = UType;
            }
            else
            {
                para.C_UserTypeID = usertype.Lever;
            }

            // return Content("用户等级:" + UType);

            para.DatCreate = DateTime.Now;
            if (string.IsNullOrWhiteSpace(para.Name))
            {
                return(Content("姓名不能为空"));
            }
            if (string.IsNullOrWhiteSpace(para.Phone))
            {
                return(Content("手机号不能为空"));
            }
            if (para.Phone.Length != 11)
            {
                return(Content("请输入正确的手机号码"));
            }
            if (para.Province == "请选择")
            {
                return(Content("请选择省份"));
            }
            if (para.City == "请选择")
            {
                return(Content("请选择城市"));
            }
            if (para.Area == "请选择")
            {
                return(Content("请选择地区"));
            }
            if (C_User.GetPhoneCnt(para.Phone) > 0)
            {
                return(Content("手机号码重复!"));
            }

            HttpPostedFileBase upfile = Request.Files["Img"];

            if (upfile != null)
            {
                if (upfile.ContentLength >= (5242880))
                {
                    return(Content("fail|请上传5M以内的文件!"));
                }

                string imgName = DateTime.Now.ToString("yyyy-MM-dd-HH-ss") + DateTime.Now.Ticks;
                string ext     = Path.GetExtension(upfile.FileName);//获得文件扩展名
                para.CardUrl = "/File/C_User/" + CurrentUser.UserName + "_" + imgName + ext;

                try
                {
                    if (!Directory.Exists(Server.MapPath("~/File/C_User/")))
                    {
                        Directory.CreateDirectory(Server.MapPath("~/File/C_User/"));
                    }
                    upfile.SaveAs(Server.MapPath(para.CardUrl));
                }
                catch (Exception ex)
                {
                    DAL.Log.Instance.Write(ex.ToString(), "SYSMArticle_ToSave_error");
                }
            }
            else
            {
                para.CardUrl = "";
            }
            para.PassWord = para.Phone.Substring(para.Phone.Length - 6, 6);


            //if (C_User.GetC_UserByUserName(para.UserName) != null)
            //{
            //    return Content("用户编号已存在,不可重复添加!");
            //}


            para.ID = para.InsertAndReturnIdentity();

            /*自动添加用户编号*/
            int    idLen = para.ID.ToString().Length;
            string idDQ  = para.ID.ToString();

            if (idLen < 5)
            {
                string zero = new string('0', 5 - idLen);
                idDQ = zero + idDQ;
            }
            para.UserName   = usertype.TypeCode + idDQ;
            para.Identifier = usertype.TypeCode + idDQ;

            if (para.UpdateByID() > 0)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("保存出错"));
            }


            //if (para.InsertAndReturnIdentity() > 0)
            //{
            //    return Content("ok");
            //}
            //return Content("添加出错");
        }
Exemple #19
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string id = context.Request["id"].ToString();

            if (string.IsNullOrWhiteSpace(id))
            {
                context.Response.Write("网络出错了!");
            }
            C_User cuser = C_User.GetC_UserByUserName(id);

            if (cuser == null)
            {
                context.Response.Write("没有此用户!");
            }
            if (cuser.state != "已审核")
            {
                context.Response.Write("用户未授权");
            }
            Bitmap   MyMap     = new Bitmap(HttpContext.Current.Server.MapPath("/images/warrant.jpg"));
            Graphics MyG       = Graphics.FromImage(MyMap);
            SizeF    sizeFName = MyG.MeasureString(cuser.Name, new Font("微软雅黑", 5));
            int      NameWidth = Convert.ToInt32((MyMap.Size.Width - sizeFName.Width) / 2);

            //用户名550 850
            MyG.DrawString(cuser.Name, new Font("微软雅黑", 5), new SolidBrush(Color.Black), new Point(NameWidth, 340));
            sizeFName = MyG.MeasureString(cuser.wxNo, new Font("微软雅黑", 5));
            NameWidth = Convert.ToInt32((MyMap.Size.Width - sizeFName.Width) / 2);
            //用户名UserName 1050  1550
            MyG.DrawString(cuser.wxNo, new Font("微软雅黑", 5), new SolidBrush(Color.Black), new Point(NameWidth, 370));
            ////IcCard
            //MyG.DrawString(cuser.Card, new Font("微软雅黑", 30), new SolidBrush(Color.White), new Point(190, 465));
            //级别
            C_UserType type = C_UserType.GetEntittyC_Type(cuser.C_UserTypeID);

            if (type == null)
            {
                context.Response.Write("数据有误!");
            }
            sizeFName = MyG.MeasureString(type.Name, new Font("微软雅黑", 10));
            NameWidth = Convert.ToInt32((MyMap.Size.Width - sizeFName.Width) / 2);
            MyG.DrawString(type.Name, new Font("微软雅黑", 10), new SolidBrush(Color.Red), new Point(NameWidth, 500));
            //授权
            sizeFName = MyG.MeasureString(cuser.Phone, new Font("微软雅黑", 5));
            NameWidth = Convert.ToInt32((MyMap.Size.Width - sizeFName.Width) / 2);
            MyG.DrawString(cuser.Phone, new Font("微软雅黑", 5), new SolidBrush(Color.Black), new Point(NameWidth, 410));
            sizeFName = MyG.MeasureString(cuser.Card.Substring(0, 4) + "***" + cuser.Card.Substring(12, 4), new Font("微软雅黑", 5));
            NameWidth = Convert.ToInt32((MyMap.Size.Width - sizeFName.Width) / 2);
            //授权
            MyG.DrawString(cuser.Card.Substring(0, 4) + "***" + cuser.Card.Substring(12, 4), new Font("微软雅黑", 5), new SolidBrush(Color.Black), new Point(NameWidth, 440));
            //授权
            sizeFName = MyG.MeasureString(cuser.DatVerify.ToString(), new Font("微软雅黑", 5));
            NameWidth = Convert.ToInt32((MyMap.Size.Width - sizeFName.Width) / 2);
            MyG.DrawString(cuser.DatVerify.ToString(), new Font("微软雅黑", 5), new SolidBrush(Color.Black), new Point(NameWidth, 665));
            ////授权
            //MyG.DrawString(cuser.DatVerify.Day.ToString(), new Font("微软雅黑", 16), new SolidBrush(Color.Black), new Point(1000, 2950));
            context.Response.Clear();
            context.Response.ContentType = "Image/jpg";
            MyMap.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
            MyMap.Dispose();
            MyG.Dispose();
            context.Response.End();
        }
Exemple #20
0
        public ContentResult toApply(FormCollection c)
        {
            C_User user         = new C_User();
            int    C_UserTypeID = 0;

            int.TryParse(c["C_UserTypeID"], out C_UserTypeID);
            user.C_UserTypeID = C_UserTypeID;

            string addressStr = c["PCAids"];

            if (string.IsNullOrWhiteSpace(addressStr))
            {
                return(Content("请选择所在地"));
            }
            string[] addre = addressStr.Split(',');

            for (int i = 0; i < addre.Length; i++)
            {
                if (i == 0)
                {
                    user.Province = addre[i];
                }
                else if (i == 1)
                {
                    user.City = addre[i];
                }
                else if (i == 2)
                {
                    user.Area = addre[i];
                }
            }

            string ChiefUserName = c["ChiefUserName"];

            C_UserType usertype = C_UserType.GetEntityByLever(C_UserTypeID);

            user.Phone = c["Phone"];
            if (user.Phone.Length != 11)
            {
                return(Content("手机号有误"));
            }
            if (C_User.GetPhoneCnt(user.Phone) > 0)
            {
                return(Content("该手机号已存在"));
            }
            user.DatPwdChange = DateTime.Now;
            user.DatCreate    = DateTime.Now;
            user.IsValid      = true;
            user.Name         = c["Name"];
            user.C_UserTypeID = C_UserTypeID;
            user.Introducer   = c["Card"];
            user.WxQRCode     = c["WxQRCode"];
            user.Chief        = CurrentUser.ID;
            user.PassWord     = user.Phone.Substring(user.Phone.Length - 6, 6);
            user.state        = "已审核";
            user.wxNo         = c["wxNo"];

            user.ID = user.InsertAndReturnIdentity();

            int    idLen = user.ID.ToString().Length;
            string idDQ  = user.ID.ToString();

            if (idLen < 5)
            {
                string zero = new string('0', 5 - idLen);
                idDQ = zero + idDQ;
            }
            user.UserName   = usertype.TypeCode + idDQ;
            user.Identifier = usertype.TypeCode + idDQ;

            if (user.UpdateByID() > 0)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("保存出错"));
            }
        }