示例#1
0
 private void BatchImportCustomer_Loaded(object sender, RoutedEventArgs e)
 {
     Loaded        -= new RoutedEventHandler(BatchImportCustomer_Loaded);
     CustomerFacade = new CustomerFacade(CPApplication.Current.CurrentPage);
     BatchVM        = new BatchImportCustomerVM();
     fromLinkList   = new List <ValidationEntity>();
 }
示例#2
0
        public ActionResult Ajax_QueryMyFavorite()
        {
            var result = new AjaxResult {
                Success = true
            };
            int pageIndex = int.Parse(Request["PageIndex"]);

            Nesoft.ECWeb.Entity.PageInfo pageInfo = new Entity.PageInfo();
            pageInfo.PageIndex = pageIndex;
            pageInfo.PageSize  = 10;

            var user = UserManager.ReadUserInfo();

            var data       = CustomerFacade.GetMyFavoriteProductList(user.UserSysNo, pageInfo);
            var wishSysNos = CookieHelper.GetCookie <List <int> >("DeletedFavorite") ?? new List <int>();

            data.ResultList.RemoveAll(p => wishSysNos.Any(q => p.WishSysNo == q));
            data.ResultList.ForEach(p =>
            {
                p.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P60, p.DefaultImage);
            });
            result.Data = data;

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#3
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     if (!AuthMgr.HasFunctionPoint(AuthKeyConst.Customer_AgentInfo_Edit))
     {
         CPApplication.Current.CurrentPage.Context.Window.Alert(ResAgentInfo.rightmsg_NoRight);
         return;
     }
     if (ValidationManager.Validate(this.LayoutRoot))
     {
         AgentInfoVM    vm     = this.DataContext as AgentInfoVM;
         CustomerFacade facade = new CustomerFacade();
         if (vm.TransactionNumber.HasValue && vm.TransactionNumber > 0)
         {
             facade.UpdateAgent(vm, (obj, args) =>
             {
                 if (args.FaultsHandle())
                 {
                     return;
                 }
                 CPApplication.Current.CurrentPage.Context.Window.Alert(ResCustomerMaintain.Info_SaveSuccessfully);
             });
         }
         else
         {
             facade.CreateAgent(vm, (obj, args) =>
             {
                 if (args.FaultsHandle())
                 {
                     return;
                 }
                 CPApplication.Current.CurrentPage.Context.Window.Alert(ResCustomerMaintain.Info_SaveSuccessfully);
             });
         }
     }
 }
示例#4
0
        public void GetCustommerByIdAsync_GetFromCache_Test()
        {
            // Arrange
            Customer        customer           = _dataFixture.GetCustomer();
            long            customerId         = 0;
            List <Customer> cachedCustomerList = new List <Customer> {
                customer
            };

            _dataFixture.GetMocks <Customer>(out var mockRepository, out var mockCacheManager, out var mockOptions);

            mockCacheManager
            .Setup(cache => cache.GetFromCacheAsync <List <Customer> >(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(cachedCustomerList);

            mockRepository
            .Setup(repo => repo.GetAsync <Customer>(customer => customer.Sid == customerId, CancellationToken.None))
            .ReturnsAsync((Customer)null);

            var customerFacade = new CustomerFacade(mockRepository.Object, mockCacheManager.Object, mockOptions.Object);

            // Act
            var result = customerFacade.GetCustommerByIdAsync(customerId, CancellationToken.None).Result;

            // Assert
            Assert.NotNull(result);
            Assert.Equal("Alberto", result.FirstName);
            Assert.Equal("Castro", result.LastName);
            Assert.Equal("password", result.Password);
            Assert.Equal("admin", result.Username);
            Assert.Equal(0, result.Sid);
        }
示例#5
0
        public ActionResult AjaxFindPasswordByPhone(FormCollection form)
        {
            string validatedCode = Request["ValidatedCode"].ToString();

            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() == validatedCode.ToLower())
            {
                string customerStr = Request["CustomerID"].ToString();
                if (LoginFacade.IsExistCustomer(customerStr))//存在该用户名
                {
                    CustomerInfo customer = CustomerFacade.GetCustomerByID(customerStr);
                    if (string.IsNullOrEmpty(customer.CellPhone))
                    {
                        return(Json("不存在该用户的手机号码", JsonRequestBehavior.AllowGet));
                    }
                    if (!CustomerFacade.CheckCustomerPhoneValided(customer.SysNo))
                    {
                        return(Json("用户手机密码没有通过验证", JsonRequestBehavior.AllowGet));
                    }

                    CookieHelper.SaveCookie <string>("FindPasswordCustomerID", customerStr);
                    CookieHelper.SaveCookie <string>("FindPasswordCustomerCellPhone", customer.CellPhone);
                    CookieHelper.SaveCookie <string>("FindPasswordCustomerSysNo", customer.SysNo.ToString());
                    return(Json(customer.CellPhone, JsonRequestBehavior.AllowGet));
                }
                return(Json("不存在该用户", JsonRequestBehavior.AllowGet));
            }
            return(Json("验证码不正确", JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public async Task CreateTest()
        {
            //Arrange
            var customer = new CustomerMngt.Domain.Entities.Customer
            {
                Id        = 1,
                Password  = "******",
                Email     = "*****@*****.**",
                Surname   = "Surname",
                FirstName = "First Name"
            };

            var customerRequestDto = new CustomerRequestDto
            {
                Email           = "*****@*****.**",
                Surname         = "Surname",
                FirstName       = "First Name",
                Password        = "******",
                ConfirmPassword = "******",
            };

            //Act
            const long id          = 1;
            var        mockService = new Mock <ICustomerService>();
            var        mockMapper  = new Mock <IMapper>();

            mockMapper.Setup(x => x.Map <CustomerMngt.Domain.Entities.Customer>(customerRequestDto)).Returns(customer);
            mockService.Setup(x => x.CreateAsync(customer)).ReturnsAsync(id);
            //Assert
            var mockFacade = new CustomerFacade(mockService.Object, mockMapper.Object);
            var result     = await mockFacade.CreateAsync(customerRequestDto);

            Assert.Equal(id, result);
        }
        public ActionResult AjaxValidateCustomerEmail(FormCollection form)
        {
            string Email         = Request["Email"].ToString();
            string ValidatedCode = Request["ValidatedCode"].ToString();

            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() == ValidatedCode.ToLower())
            {
                if (!string.IsNullOrEmpty(Email))
                {
                    string imgBaseUrl = ConfigurationManager.AppSettings["CDNWebDomain"].ToString();//图片根目录
                    string domain     = ConfigurationManager.AppSettings["WebDomain"].ToString();

                    if (CustomerFacade.CheckEmail(Email))
                    {
                        return(Json("此邮箱已经被验证过,请使用其它邮箱", JsonRequestBehavior.AllowGet));
                    }
                    if (CustomerFacade.SendEmailValidatorMail(CurrUser.UserID, Email, imgBaseUrl, domain))
                    {
                        CustomerInfo info = CustomerFacade.GetCustomerByID(CurrUser.UserID);
                        if (Email != info.Email)
                        {
                            CustomerFacade.UpdateCustomerEmailAddress(CurrUser.UserID, Email);
                        }
                        return(Json("s", JsonRequestBehavior.AllowGet));
                    }
                    return(Json("短信校验码不正确或不存在", JsonRequestBehavior.AllowGet));
                }
                return(Json("短信校验码不正确或不存在", JsonRequestBehavior.AllowGet));
            }
            return(Json("验证码不正确", JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxSendValidateEmail(FormCollection form)
        {
            string email      = Request["Email"].ToString();
            string imgBaseUrl = ConfigurationManager.AppSettings["CDNWebDomain"].ToString();//图片根目录
            string domain     = ConfigurationManager.AppSettings["WebDomain"].ToString();

            CustomerInfo info = CustomerFacade.GetCustomerByID(CurrUser.UserID);

            if (!string.IsNullOrEmpty(info.Email) && email != info.Email)
            {
                return(Json("修改邮件地址,请先保存再发送验证邮件", JsonRequestBehavior.AllowGet));
            }
            if (CustomerFacade.CheckEmail(email))
            {
                return(Json("此邮箱已经被验证过,请使用其它邮箱", JsonRequestBehavior.AllowGet));
            }
            if (CustomerFacade.SendEmailValidatorMail(CurrUser.UserID, email, imgBaseUrl, domain))
            {
                if (email != info.Email)
                {
                    CustomerFacade.UpdateCustomerEmailAddress(CurrUser.UserID, email);
                }
                return(Json("s", JsonRequestBehavior.AllowGet));
            }
            return(Json("服务器繁忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxChangePassword(FormCollection form)
        {
            string OldPassword = Request["OldPassword"].ToString();
            string Password    = Request["Password"].ToString();
            string RePassword  = Request["RePassword"].ToString();


            //string salt = LoginFacade.GetCustomerPasswordSalt(CurrUser.UserID);
            //OldPassword = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(OldPassword.Replace("+", "%2b")) + salt);
            // [2014/12/22 by Swika]增加支持第三方系统导入的账号的密码验证
            var encryptMeta = LoginFacade.GetCustomerEncryptMeta(CurrUser.UserID);

            OldPassword = PasswordHelper.GetEncryptedPassword(HttpUtility.UrlDecode(OldPassword.Replace("+", "%2b")), encryptMeta);


            if (LoginFacade.CustomerLogin(CurrUser.UserID, OldPassword) == null)
            {
                return(Json("旧密码不正确", JsonRequestBehavior.AllowGet));
            }
            else
            {
                string encryptPassword = string.Empty;
                string passwordSalt    = string.Empty;
                PasswordHelper.GetNewPasswordAndSalt(ref Password, ref encryptPassword, ref passwordSalt);
                //重置密码
                if (CustomerFacade.UpdateCustomerPassword(CurrUser.UserID, encryptPassword, passwordSalt))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
                return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
            }
        }
示例#10
0
        /// <summary>
        /// 插入用户留言
        /// </summary>
        /// <param name="leaveWordsModel"></param>
        /// <returns></returns>
        public bool InsertLeaveWords(UserLeaveWordsModel leaveWordsModel)
        {
            if (!leaveWordsModel.UserEmail.IsEmail())
            {
                throw new BusinessException("请输入有效的邮箱地址。");
            }
            if (string.IsNullOrWhiteSpace(leaveWordsModel.Content))
            {
                throw new BusinessException("请输入反馈内容。");
            }
            CustomerLeaveWords entity = new CustomerLeaveWords();

            entity.InDate           = DateTime.Now;
            entity.Subject          = HeaderHelper.GetClientType().ToString();
            entity.LeaveWords       = leaveWordsModel.Content;
            entity.CustomerEmail    = leaveWordsModel.UserEmail;
            entity.CompanyCode      = ConstValue.CompanyCode;
            entity.LanguageCode     = ConstValue.LanguageCode;
            entity.StoreCompanyCode = ConstValue.StoreCompanyCode;

            var loginedUser = UserMgr.ReadUserInfo();

            if (loginedUser != null)
            {
                entity.CustomerSysNo = loginedUser.UserSysNo;
                entity.CustomerName  = loginedUser.UserID;
            }

            return(CustomerFacade.InsertCustomerLeaveWords(entity));
        }
示例#11
0
        public ActionResult Ajax_VoidOrder()
        {
            var result = new AjaxResult {
                Success = true
            };

            string strOrderSysNo = Request["OrderSysNo"];
            string message       = Request["Message"] ?? "";
            int    orderSysNo;

            if (int.TryParse(strOrderSysNo, out orderSysNo))
            {
                LoginUser suer = UserManager.ReadUserInfo();
                var       m    = CustomerFacade.VoidedOrder(orderSysNo, message, suer.UserSysNo);
                if (!string.IsNullOrWhiteSpace(m))
                {
                    result.Success = false;
                    result.Message = string.Format("作废失败:{0}", m);
                }
            }
            else
            {
                result.Success = false;
                result.Data    = "无效的订单编号";
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#12
0
        public ActionResult AjaxValidateCellphoneByCode(FormCollection form)
        {
            string CellPhoneNumber = Request["CellPhoneNumber"].ToString();
            string SmsCode         = Request["SmsCode"].ToString();

            if (!string.IsNullOrEmpty(SmsCode) && !string.IsNullOrEmpty(CellPhoneNumber))
            {
                //送积分因为注册手机验证时用户还不存在所以没办法这个时候送积分
                //Point point = new Point();
                //point.CustomerSysNo = CurrUser.UserSysNo;
                //point.AvailablePoint = ConstValue.GetPointByValidatePhone;
                //point.ExpireDate = DateTime.Now.AddYears(1);
                //point.InDate = DateTime.Now;
                //point.InUser = CurrUser.UserID;
                //point.Memo = EnumHelper.GetDescription(PointType.MobileVerification);
                //point.ObtainType = (int)PointType.MobileVerification;
                //point.Points = ConstValue.GetPointByValidatePhone;
                //point.IsFromSysAccount = 1;
                //point.SysAccount = int.Parse(ConstValue.PointAccountSysNo);

                if (CustomerFacade.ValidateCustomerPhoneWithoutPoint(CellPhoneNumber, SmsCode.ToLower()))
                {
                    CookieHelper.SaveCookie("ValidatePhone", true);
                    CookieHelper.SaveCookie("CanceledPhoneValidate", false);

                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
                return(Json("短信校验码不正确或不存在", JsonRequestBehavior.AllowGet));
            }
            return(Json("短信校验码不正确或不存在", JsonRequestBehavior.AllowGet));
        }
示例#13
0
        public ActionResult Ajax_QueryOrder()
        {
            var pageIndex = int.Parse(Request["PageIndex"]);
            var queryType = int.Parse(Request["QueryType"]);

            SOQueryInfo query = new SOQueryInfo();

            //搜索类型,默认是搜索[最近三个月的-15][14-所有订单]
            query.SearchType = queryType == 1 ?
                               SOSearchType.LastThreeMonths : SOSearchType.ALL;
            query.PagingInfo           = new PageInfo();
            query.PagingInfo.PageSize  = 5;
            query.PagingInfo.PageIndex = pageIndex;
            query.CustomerID           = CurrUser.UserSysNo;
            query.Status = null;

            QueryResult <OrderInfo> orders = CustomerFacade.GetOrderList(query);

            //如果查询类型是【三个月内】下单,则需要合并最近下单的数据
            if (query.SearchType == SOSearchType.LastThreeMonths && pageIndex == 0)
            {
                var recentOrderSysNoes = CookieHelper.GetCookie <string>("SoSysNo");
                if (!string.IsNullOrWhiteSpace(recentOrderSysNoes))
                {
                    var soSysNoes    = recentOrderSysNoes.Split(',').ToList <string>();
                    var recentOrders = CustomerFacade.GetCenterOrderMasterList(query.CustomerID, soSysNoes);
                    if (recentOrders != null && orders != null && orders.ResultList != null)
                    {
                        //排除掉orders中已经存在的数据
                        recentOrders.RemoveAll(p => orders.ResultList.Any(q => q.SoSysNo == p.SoSysNo));
                        //将最近的订单加载到orders中
                        for (var i = recentOrders.Count - 1; i >= 0; i--)
                        {
                            orders.ResultList.Insert(0, recentOrders[i]);
                        }
                    }
                }
            }
            if (orders != null)
            {
                if (orders.ResultList != null)
                {
                    for (var i = 0; i < orders.ResultList.Count; i++)
                    {
                        orders.ResultList[i] = CustomerFacade.GetCenterSODetailInfo(CurrUser.UserSysNo, orders.ResultList[i].SoSysNo);
                        orders.ResultList[i].SOItemList.ForEach(q =>
                        {
                            q.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P60, q.DefaultImage);
                        });
                    }
                }
            }


            var result = new AjaxResult {
                Success = true, Data = orders
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#14
0
        public ActionResult AjaxDeleteSelectedItems()
        {
            bool   isSuccess = true;
            string message   = "操作已成功,稍候生效!";
            string data      = Request["SelectList"].ToString();

            try
            {
                if (string.IsNullOrEmpty(data))
                {
                    isSuccess = false;
                    message   = "请选择要删除的收藏!";
                }
                else
                {
                    string[] strList = data.Split(',');
                    for (int i = 0; i < strList.Length; i++)
                    {
                        CustomerFacade.DeleteMyFavorite(Convert.ToInt32(strList[i]));
                    }
                }
            }
            catch
            {
                isSuccess = false;
                message   = "系统异常,请稍候重试!";
            }
            return(Json(new
            {
                Result = isSuccess,
                Message = message
            }));
        }
示例#15
0
 protected CustomerInfoViewModel MappingCustomerInfoView(int customerId)
 {
     using (var customerFacade = new CustomerFacade())
     {
         // CustomerInfo
         CustomerEntity        customerEntity = customerFacade.GetCustomerByID(customerId);
         CustomerInfoViewModel custInfoVM     = new CustomerInfoViewModel();
         custInfoVM.Account          = customerEntity.Account;
         custInfoVM.AccountNo        = customerEntity.AccountNo;
         custInfoVM.BirthDate        = customerEntity.BirthDate;
         custInfoVM.CardNo           = customerEntity.CardNo;
         custInfoVM.CreateUser       = customerEntity.CreateUser;
         custInfoVM.CustomerId       = customerEntity.CustomerId;
         custInfoVM.CustomerType     = customerEntity.CustomerType;
         custInfoVM.Email            = customerEntity.Email;
         custInfoVM.Fax              = customerEntity.Fax;
         custInfoVM.FirstNameEnglish = customerEntity.FirstNameEnglish;
         custInfoVM.FirstNameThai    = customerEntity.FirstNameThai;
         custInfoVM.LastNameEnglish  = customerEntity.LastNameEnglish;
         custInfoVM.LastNameThai     = customerEntity.LastNameThai;
         custInfoVM.FirstNameThaiEng = customerEntity.FirstNameThaiEng;
         custInfoVM.LastNameThaiEng  = customerEntity.LastNameThaiEng;
         custInfoVM.PhoneList        = customerEntity.PhoneList;
         custInfoVM.Registration     = customerEntity.Registration;
         custInfoVM.SubscriptType    = customerEntity.SubscriptType;
         custInfoVM.TitleEnglish     = customerEntity.TitleEnglish;
         custInfoVM.TitleThai        = customerEntity.TitleThai;
         custInfoVM.UpdateUser       = customerEntity.UpdateUser;
         return(custInfoVM);
     }
 }
示例#16
0
        public JsonResult AjaxAddProductToWishList()
        {
            int productSysNo = 0;

            int.TryParse(Request.Params["productSysNo"], out productSysNo);
            LoginUser user = UserMgr.ReadUserInfo();

            //if (user == null)
            //{
            //    return new JsonResult() { Data = BuildAjaxErrorObject("请先登录!") };
            //}
            //商品已经被收藏
            if (ProductFacade.IsProductWished(productSysNo, user.UserSysNo))
            {
                return(new JsonResult()
                {
                    Data = 0
                });
            }
            CustomerFacade.AddProductToWishList(user.UserSysNo, productSysNo);
            return(new JsonResult()
            {
                Data = 1
            });
        }
示例#17
0
        public ActionResult AjaxSendValidateCellphoneByCode(FormCollection form)
        {
            string cell = Request["CellPhoneNumber"].ToString();

            if (!string.IsNullOrEmpty(cell))
            {
                //判断手机号码是否被验证过
                if (CustomerFacade.PhoneIsValidate(cell))
                {
                    return(Json("此手机号码已经被验证过,不能进行重复验证", JsonRequestBehavior.AllowGet));
                }
                CellPhoneConfirm item = new CellPhoneConfirm();
                item.CustomerSysNo = CurrUser.UserSysNo;
                item.CellPhone     = cell;

                string code = VerifyImage.CreateRandomNumber();

                item.ConfirmKey = code;
                int CellPhoneSysNo = CustomerFacade.CreateCellPhoneConfirm(item).SysNo;
                if (CellPhoneSysNo > 0)
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }

                if (CellPhoneSysNo == -99999)
                {
                    return(Json("同一个IP地址24小时内只能请求验证码10次,同一个手机号码请求验证码5次。", JsonRequestBehavior.AllowGet));
                }
                return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
示例#18
0
        public JsonResult CreateDynamicConfirmInfo()
        {
            string ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_SOURCE_IP"];

            if (string.IsNullOrEmpty(ip))
            {
                ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

                if (string.IsNullOrEmpty(ip))
                {
                    ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                    if (string.IsNullOrEmpty(ip))
                    {
                        ip = System.Web.HttpContext.Current.Request.UserHostAddress;
                    }
                }
                else
                {
                    // 取逗号分隔第一个 IP 为客户端IP
                    string[] tmp = ip.Split(new char[] { ',' });
                    ip = tmp[0];
                }
            }
            else
            {
                // 取逗号分隔第一个 IP 为客户端IP
                string[] tmp = ip.Split(new char[] { ',' });
                ip = tmp[0];
            }
            int          CustomerSysNo = CookieHelper.GetCookie <int>("CustomerID");
            string       CellPhone     = Request["CellPhone"];
            string       ConfirmKey    = Request["ConfirmKey"];
            CustomerInfo customer      = CustomerFacade.GetCustomerInfo(CustomerSysNo);

            JsonResult result = new JsonResult();

            /*PhoneDynamicValidationInfo dynamicValidation = new PhoneDynamicValidationInfo();
             * dynamicValidation.CustomerSysNo = CookieHelper.GetCookie<int>("CustomerID");
             * dynamicValidation.FromIP = ip;
             * dynamicValidation.CellPhone = CellPhone;
             * dynamicValidation.ConfirmKey = ConfirmKey;
             *
             * dynamicValidation.IntervalMinute = 5;
             * dynamicValidation.IntervalSecond = 10;
             * dynamicValidation.IsRepeatTimes = 10;
             * dynamicValidation.TotalSendTimes = 100;
             * dynamicValidation.InvalidateMinute = 3;
             * CreateDynamicStatus dynamicStatus = CustomerFacade.CreateDynamicConfirmInfo(dynamicValidation);
             * if(dynamicStatus== CreateDynamicStatus.ValidatePass)
             * {
             *
             * }
             */
            //您已验证过手机,请先取消验证InvalidAuth
            //您在短时间内获取短信验证码次数过多,请稍后再试OverTotalTimes
            //{0}秒内不能重复获取,请稍后再获取RepeatClick
            //手机验证码稍后会以短信形式发送到您的手机上,请耐心等待!
            return(result);
        }
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         CustomerFacade facade = new CustomerFacade(uow);
         RetrieveInstances(facade);
     }
 }
示例#20
0
        public Stream GetSlcCustomer(Core.Model.mdlBranchParam param)
        {
            string json = Core.Services.RestPublisher.Serialize(CustomerFacade.getSlcCustomerbyBranchID(param.BranchID));

            WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8";
            MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));

            return(ms);
        }
示例#21
0
        /// <summary>
        /// 第三方登录回调
        /// </summary>
        /// <param name="identify">第三方标识</param>
        /// <param name="collection">回调参数</param>
        /// <returns></returns>
        public PartnerBackResult LoginBack(string identify, NameValueCollection collection)
        {
            PartnerBackContext context = new PartnerBackContext();

            context.PartnerIdentify = identify;
            context.ResponseParam   = collection;

            Partners partner = Partners.GetInstance(context);

            if (!partner.BackVerifySign(context))
            {
                Logger.WriteLog(string.Format("第三方登录回调非法请求,第三方标识:{0}", identify), "Passport", "LoginBack");
                throw new BusinessException("登录失败!");
            }

            CustomerInfo customer = null;

            if (context.ActionType == PassportActionType.Accept)
            {
                partner.GetResponseUserInfo(context);

                customer = new CustomerInfo()
                {
                    CustomerID    = context.CustomerID,
                    CustomerName  = context.CustomerName,
                    CustomersType = (int)context.CustomerSouce,
                    InitRank      = 1,
                    Password      = "",
                    CellPhone     = context.CellPhone,
                    Email         = context.Email
                };

                var existsCustomer = CustomerFacade.GetCustomerByID(context.CustomerID);
                if (existsCustomer == null)
                {
                    int customerSysNo = LoginFacade.CreateCustomer(customer).SysNo;
                    if (customerSysNo <= 0)
                    {
                        Logger.WriteLog(string.Format("第三方登录回调注册用户失败,第三方标识:{0}", identify), "Passport", "LoginBack");
                        throw new BusinessException("第三方登录注册用户失败!");
                    }
                    customer.SysNo = customerSysNo;
                }
                else
                {
                    customer.SysNo = existsCustomer.SysNo;
                }
            }
            PartnerBackResult result = new PartnerBackResult()
            {
                Customer   = customer,
                ReturnUrl  = context.ReturnUrl,
                ActionType = context.ActionType
            };

            return(result);
        }
示例#22
0
        public Stream GetUserLicence(Core.Model.mdlLicenceKey mdlLicenceKey)
        {
            string json = Core.Services.RestPublisher.Serialize(CustomerFacade.LoadCustomerLicenseKey(mdlLicenceKey.LicenceType));

            WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8";
            MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));

            return(ms);
        }
示例#23
0
        private StoreBasicInfoModel Transformstoreinfo(StoreBasicInfo storeinfo)
        {
            StoreBasicInfoModel result = new StoreBasicInfoModel();

            result.Address             = storeinfo.Address;
            result.BrandAuthorize      = storeinfo.BrandAuthorize;
            result.ContactName         = storeinfo.ContactName;
            result.CooperationMode     = storeinfo.CooperationMode;
            result.CurrentECChannel    = storeinfo.CurrentECChannel;
            result.ECExpValue          = storeinfo.ECExpValue;
            result.EditDate            = storeinfo.EditDate;
            result.EditUserName        = storeinfo.EditUserName;
            result.EditUserSysNo       = storeinfo.EditUserSysNo;
            result.Email               = storeinfo.Email;
            result.ExportExpValue      = storeinfo.ExportExpValue;
            result.HaveECExp           = storeinfo.HaveECExp;
            result.HaveExportExp       = storeinfo.HaveExportExp;
            result.InDate              = storeinfo.InDate;
            result.InUserName          = storeinfo.InUserName;
            result.InUserSysNo         = storeinfo.InUserSysNo;
            result.MainBrand           = storeinfo.MainBrand;
            result.MainProductCategory = storeinfo.MainProductCategory;
            result.Mobile              = storeinfo.Mobile;
            result.Name        = storeinfo.Name;
            result.Phone       = storeinfo.Phone;
            result.QQ          = storeinfo.QQ;
            result.Remark      = storeinfo.Remark;
            result.SellerSysNo = storeinfo.SellerSysNo;
            result.Site        = storeinfo.Site;
            result.Status      = storeinfo.Status;
            result.StoreName   = storeinfo.StoreName;
            result.SysNo       = storeinfo.SysNo;
            result.ValidDate   = storeinfo.ValidDate;

            //构造商品图片
            ImageSize imageSizeMiddle = ImageUrlHelper.GetImageSize(ImageType.Middle);

            result.LogoURL = ProductFacade.BuildProductImage(imageSizeMiddle, storeinfo.LogoURL);


            //是否被收藏
            #region 是否被收藏
            LoginUser CurrUser      = UserMgr.ReadUserInfo();
            bool      StoreIsWished = false;
            if (CurrUser == null || CurrUser.UserSysNo < 0)
            {
                StoreIsWished = false;
            }
            else
            {
                StoreIsWished = CustomerFacade.IsMyFavoriteSeller(CurrUser.UserSysNo, storeinfo.SellerSysNo.Value);
            }
            #endregion
            result.StoreIsWished = StoreIsWished;
            return(result);
        }
示例#24
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         CustomerFacade facade   = new CustomerFacade(uow);
         CustomerDto    instance = facade.RetrieveOrNewCustomer(InstanceId, new CustomerConverter());
         CurrentInstance         = instance;
         ucIEdit.CurrentInstance = instance;
     }
 }
示例#25
0
        public MainWindow()
        {
            cf = new CustomerFacade();
            af = new AppointmentFacade(cf);
            InitializeComponent();
            customersList = cf.LoadAllCustomers();

            customersDataGrid.ItemsSource = customersList;
            GetAppointments();
        }
示例#26
0
        public ActionResult AjaxChangeCustomerAvatar(FormCollection form)
        {
            string AvatarImg = Request["AvatarImg"].ToString();

            if (CustomerFacade.ChangeCustomerAvatarImg(AvatarImg, CurrUser.UserSysNo, AvtarImageStatus.D))
            {
                return(Json("s", JsonRequestBehavior.AllowGet));
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
示例#27
0
        public ActionResult AjaxSendValidateCellphoneByCode(FormCollection form)
        {
            //return Json("s", JsonRequestBehavior.AllowGet);
            string validatedCode = Request["ValidateCode"].ToString();

            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() != validatedCode.ToLower())
            {
                return(Json(new JsonResult()
                {
                    ContentType = "验证码不正确", Data = ""
                }, JsonRequestBehavior.AllowGet));
            }


            string cell = Request["CellPhoneNumber"].ToString();

            if (!string.IsNullOrEmpty(cell))
            {
                //判断手机号码是否被验证过
                //if (CustomerFacade.PhoneIsValidate(cell))
                //{
                //    return Json(new JsonResult(){ContentType="此手机号码已经被验证过,不能进行重复验证"} , JsonRequestBehavior.AllowGet);
                //}
                CellPhoneConfirm item = new CellPhoneConfirm();
                item.CustomerSysNo = 0;
                item.CellPhone     = cell;

                string code = VerifyImage.CreateRandomNumber();

                item.ConfirmKey = code;
                int CellPhoneSysNo = CustomerFacade.CreateCellPhoneConfirm(item).SysNo;
                if (CellPhoneSysNo > 0)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "s", Data = CellPhoneSysNo
                    }, JsonRequestBehavior.AllowGet));
                }
                if (CellPhoneSysNo == -99999)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "同一个IP地址24小时内只能请求验证码10次,同一个手机号码请求验证码5次。"
                    }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new JsonResult()
                {
                    ContentType = "服务器忙,稍后重试"
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonResult()
            {
                ContentType = "服务器忙,稍后重试"
            }, JsonRequestBehavior.AllowGet));
        }
示例#28
0
        public void PostCustomer([FromBody] Customer customer)
        {
            object ClientId;

            Request.Properties.TryGetValue("id", out ClientId);
            if (ClientId != null)
            {
                ICustomerFacade cusFacade = new CustomerFacade((int)ClientId);
                cusFacade.SaveCustomer(customer);
            }
        }
示例#29
0
        public void GetAllCustomers(int id)
        {
            object ClientId;

            Request.Properties.TryGetValue("id", out ClientId);
            if (ClientId != null)
            {
                ICustomerFacade cusFacade = new CustomerFacade((int)ClientId);
                cusFacade.DeleteCustomer(id);
            }
        }
示例#30
0
        public ActionResult AjaxUpdateCustomerInvoice(string invoiceTitle)
        {
            CustomerInvoiceInfo customerInvoiceInfo = new CustomerInvoiceInfo()
            {
                CustomerSysNo = CurrUser.UserSysNo,
                InvoiceTitle  = invoiceTitle
            };

            CustomerFacade.UpdateCustomerInvoice(customerInvoiceInfo);
            return(Json(customerInvoiceInfo));
        }