Пример #1
0
        /// <summary>
        /// 添加 沙龙环境图等
        /// </summary>
        /// <param name="mod"></param>
        /// <returns></returns>
        public int AddAllSalon(AllSalon mod)
        {
            var model = new t_salonimageinfo()
            {
                si_kind   = mod.SiKind,
                si_photo  = mod.Photo,
                si_s_uid  = mod.Suid,
                si_status = 1
            };
            int count = 0;

            try
            {
                _db.t_salonimageinfo.Add(model);
                return(_db.SaveChanges());
            }
            catch (Exception ex)
            {
                _db.t_salonimageinfo.Remove(model);
                _err.AddError("AddSalon", ex.Message);
            }
            return(count);
        }
Пример #2
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="loginID">登录名(手机号)</param>
        /// <param name="PWD">密码</param>
        /// <param name="B_Name">沙龙名称</param>
        /// <param name="B_Phone">沙龙电话</param>
        /// <param name="B_LinkRealName">沙龙联系人</param>
        /// <param name="add">沙龙地址</param>
        /// <param name="B_Summary">沙龙简介</param>
        /// <param name="B_Image1">营业执照</param>
        /// <param name="B_Image2">Logo</param>
        /// <param name="B_Image3">环境照</param>
        /// <param name="B_Image4">环境照</param>
        /// <param name="B_Image5">环境照</param>
        /// <returns></returns>
        public string CHKregister(string loginID, string PWD, string B_Name, string B_Phone, string B_LinkRealName, string add, string B_Summary, string B_Image1, string B_Image2, string B_Image3, string B_Image4, string B_Image5, string B_Wxname, string Lng, string Lat, int istemporary, string recommend)
        {
            SalonService salon = new SalonService();
            SalonSimple  ss    = new SalonSimple();

            if (Session["W_B_UID"] != null && Session["W_B_UID"].ToString() != "")
            {
                ss = salon.GetSalonSimpleInfo(new Guid(Session["W_B_UID"].ToString()));
            }
            if (string.IsNullOrEmpty(loginID))
            {
                return("登录名不能为空");
            }
            if (string.IsNullOrEmpty(PWD))
            {
                return("密码不能为空");
            }
            if (string.IsNullOrEmpty(B_Phone))
            {
                return("电话号码不能为空");
            }
            if (string.IsNullOrEmpty(add))
            {
                return("地址不能为空");
            }
            if (string.IsNullOrEmpty(B_LinkRealName))
            {
                return("联系人不能为空");
            }
            if (string.IsNullOrEmpty(B_Image1))
            {
                return("营业执照不能为空");
            }
            if (string.IsNullOrEmpty(B_Image2))
            {
                return("LOGO不能为空");
            }
            try
            {
                //解密参数值
                loginID = WeiSalonV2.Models.AESHelper.DecryptString(loginID);
                PWD     = WeiSalonV2.Models.AESHelper.DecryptString(PWD);
                //去掉参数中的转移字符
                loginID = new string((from c in loginID.ToCharArray() where !char.IsControl(c) select c).ToArray());
                PWD     = new string((from c in PWD.ToCharArray() where !char.IsControl(c) select c).ToArray());
                if (string.IsNullOrEmpty(loginID))
                {
                    return("登录名验证失败");
                }
                if (string.IsNullOrEmpty(PWD))
                {
                    return("密码验证失败");
                }
            }
            catch
            {
                return("验证帐号/密码失败");
            }
            SalonSimple sal = new SalonSimple();

            sal.Status       = 1;
            sal.Cell         = B_Phone.Trim();
            sal.Date         = DateTime.Now;
            sal.Email        = loginID;
            sal.Pwd          = MD5.MDString(PWD);
            sal.Kind         = istemporary == 1 ? 0 : 1;
            sal.Logo         = B_Image2.Replace("http://bobosquad.qiniudn.com", "");
            sal.Nickname     = B_Name;
            sal.Address      = add;
            sal.LinkName     = B_LinkRealName;
            sal.Summary      = SQLFilter.checkStr(SQLFilter.ReplaceUnStr(SQLFilter.ReplaceStr(Server.UrlDecode(B_Summary.Trim()))));
            sal.Lat          = Lat;
            sal.Lon          = Lng;
            sal.Price        = "";
            sal.Businessdate = "10:00~22:00";
            sal.Opendate     = null;
            sal.Wxname       = string.IsNullOrEmpty(B_Wxname) ? "" : B_Wxname;
            sal.Recommend    = string.IsNullOrEmpty(recommend) ? "" : recommend;
            int         ADDCou = 0;
            SalonSimple salc   = salon.CHKInfo(loginID);

            if (salc == null)
            {
                //不是修改
                //未注册过
                AllSalon alls = new AllSalon();
                try
                {
                    sal.Uid = Guid.NewGuid();
                    ADDCou  = salon.AddSalon(sal);
                    if (ADDCou > 0)
                    {
                        ADDCou = 0;
                        //注册成功 添加环境图等
                        //添加营业执照图片
                        alls.SiKind   = 1;
                        alls.Suid     = sal.Uid;
                        alls.Sistatus = 1;
                        alls.Photo    = B_Image1.Replace("http://bobosquad.qiniudn.com", "");
                        salon.AddAllSalon(alls);

                        //添加环境图
                        alls          = new AllSalon();
                        alls.SiKind   = 3;
                        alls.Suid     = sal.Uid;
                        alls.Sistatus = 1;
                        alls.Photo    = B_Image3.Replace("http://bobosquad.qiniudn.com", "");
                        salon.AddAllSalon(alls);
                        alls.Photo = B_Image4.Replace("http://bobosquad.qiniudn.com", "");
                        salon.AddAllSalon(alls);
                        alls.Photo = B_Image5.Replace("http://bobosquad.qiniudn.com", "");
                        ADDCou     = salon.AddAllSalon(alls);
                        if (ADDCou > 0)
                        {
                            Session["W_B_UID"] = sal.Uid.ToString();
                            //所有信息添加成功
                            return("1");
                        }
                        else
                        {
                            return("基本信息添加成功 图片可能添加失败");
                            //基本信息添加成功 图片可能添加失败
                        }
                    }
                    else
                    {
                        return("信息添加失败");
                    }
                }
                catch (Exception ex)
                {
                    return("异常:信息添加失败");
                }
            }
            else
            {
                //防恶意修改
                if (ss.Uid != salc.Uid)
                {
                    return("帐号信息和提交信息不符");
                }
                //修改
                //如果是重新提交
                sal.Uid   = ss.Uid;
                sal.Email = salc.Email;
                ADDCou    = salon.UpdateRegSalon(sal);
                if (ADDCou > 0)
                {
                    try
                    {
                        ADDCou = 0;
                        List <AllSalon> lis = new List <AllSalon>();
                        lis = salon.GetSalonInfo(ss.Uid, 1); //营业执照
                        salon.UpdateImageInfo(lis[0].Id.ToString(), B_Image1, 1);
                        lis = salon.GetSalonInfo(ss.Uid, 3); //营业执照
                        salon.UpdateImageInfo(lis[0].Id.ToString(), B_Image3, 1);
                        salon.UpdateImageInfo(lis[1].Id.ToString(), B_Image4, 1);
                        ADDCou = salon.UpdateImageInfo(lis[2].Id.ToString(), B_Image5, 1);
                        return(ADDCou.ToString());
                    }
                    catch
                    { }
                }
                else
                {
                    return("信息修改失败");
                }
            }
            return("未知错误");
        }