Exemplo n.º 1
0
 private static bool validateEmployee(DataTransferObject.Organization.EmployeeDetailInfo employee, string password, bool validatePassword, IPAddress ipaddress, out string message)
 {
     if (employee == null)
     {
         message = "用户名不存在,请核对后输入";
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(employee.IpLimitation) && employee.IpLimitation != ipaddress.ToString())
     {
         message = "不允许在此IP上登录";
         return(false);
     }
     if (validatePassword && employee.UserPassword != Utility.MD5EncryptorService.MD5FilterZero(password, "utf-8"))
     {
         message = "登录密码错误,请重新输入";
         return(false);
     }
     if (!employee.Enabled)
     {
         message = "账号未启用,请联系管理员";
         return(false);
     }
     message = string.Empty;
     return(true);
 }
Exemplo n.º 2
0
 private static DateTime saveEmployeeLogonInfo(DataTransferObject.Organization.EmployeeDetailInfo employee, DataTransferObject.Organization.CompanyDetailInfo company, IPAddress ipAddress)
 {
     try {
         var ipLocation = AddressLocator.CityLocator.GetIPLocation(ipAddress);
         var logonTime  = EmployeeService.Login(new DataTransferObject.Organization.LoginInfo()
         {
             CompanyId = company.CompanyId,
             UserName  = employee.UserName,
             IP        = ipAddress.ToString(),
             Location  = ipLocation.ToString()
         });
         Service.LogService.SaveLogonLog(new Service.Log.Domain.LogonLog {
             Account     = employee.UserName,
             Company     = company.CompanyId,
             CompanyName = company.AbbreviateName,
             Mode        = Service.Log.Domain.LogonMode.B3B,
             IPAddress   = ipAddress.ToString(),
             Address     = ipLocation.ToString(),
             Time        = logonTime
         });
         return(logonTime);
     } catch (Exception ex) {
         Service.LogService.SaveExceptionLog(ex);
         return(DateTime.Now);
     }
 }
Exemplo n.º 3
0
        private static Service.Permission.Domain.PermissionCollection getPermission(DataTransferObject.Organization.EmployeeDetailInfo employee, DataTransferObject.Organization.CompanyDetailInfo company)
        {
            var userRole = DataTransferObject.Permission.UserRole.Purchaser;

            if (company.Audited && !isExpired(company))
            {
                userRole = getUserRole(company);
            }
            return(Service.Permission.PermissionService.QueryPermissionOfUser(employee.Owner,
                                                                              userRole, employee.Id, employee.IsAdministrator, DataTransferObject.Permission.Website.Maintenance));
        }
Exemplo n.º 4
0
        private void BindEmployeeInfo(DataTransferObject.Organization.EmployeeDetailInfo info)
        {
            this.lblName.Text      = info.Name;
            this.lblAccountNo.Text = info.UserName;
            bool bnlGender = info.Gender == Gender.Male ? this.rdoMan.Checked = true : this.rdoWoan.Checked = true;

            this.txtCellPhone.Text = info.Cellphone;
            this.txtPhone.Text     = info.OfficePhone;
            this.txtEmail.Text     = info.Email;
            bool bnlEnabled = info.Enabled ? this.rdoEnabled.Checked = true : this.rdoOnEnabled.Checked = true;

            this.rdoEnabled.Enabled   = false;
            this.rdoOnEnabled.Enabled = false;
            this.remark.InnerText     = info.Remark;
        }
Exemplo n.º 5
0
        private static Service.Permission.Domain.PermissionCollection getPermission(DataTransferObject.Organization.EmployeeDetailInfo employee, DataTransferObject.Organization.CompanyDetailInfo company)
        {
            var userRole = DataTransferObject.Permission.UserRole.Purchaser;

            //company.Audited = company.Audited || company.CompanyType == CompanyType.Purchaser;
            if (company.Audited && !isExpired(company))
            {
                userRole = getUserRole(company);
            }
            if (company.IsOem && !isExpired(company))
            {
                userRole |= DataTransferObject.Permission.UserRole.DistributionOEM;
            }
            return(Service.Permission.PermissionService.QueryPermissionOfUser(employee.Owner,
                                                                              userRole, employee.Id, employee.IsAdministrator, DataTransferObject.Permission.Website.Transaction));
        }
Exemplo n.º 6
0
 private static void saveEmployeeLogonInfo(DataTransferObject.Organization.EmployeeDetailInfo employee, DataTransferObject.Organization.CompanyDetailInfo company, IPAddress ipAddress)
 {
     try {
         var ipLocation = ChinaPay.AddressLocator.CityLocator.GetIPLocation(ipAddress);
         Service.Organization.EmployeeService.Login(new DataTransferObject.Organization.LoginInfo()
         {
             UserName = employee.UserName,
             IP       = ipAddress.ToString(),
             Location = ipLocation.ToString()
         });
         Service.LogService.SaveLogonLog(new Service.Log.Domain.LogonLog()
         {
             Account     = employee.UserName,
             Company     = company.CompanyId,
             CompanyName = company.AbbreviateName,
             Mode        = Service.Log.Domain.LogonMode.B3B,
             IPAddress   = ipAddress.ToString(),
             Address     = ipLocation.ToString(),
             Time        = DateTime.Now
         });
     } catch { }
 }
Exemplo n.º 7
0
        private static void processScore(DataTransferObject.Organization.CompanyDetailInfo company, DataTransferObject.Organization.EmployeeDetailInfo employee, DateTime logonTime)
        {
            // 目前只有采购登录才有积分
            if (company.CompanyType != CompanyType.Purchaser)
            {
                return;
            }
            // 如果当天已经登录过,则不再处理
            var prevLogonTime = company.LastLoginTime;

            if (prevLogonTime.HasValue && prevLogonTime.Value.Date == logonTime.Date)
            {
                return;
            }
            try {
                Service.Integral.IntegralServer.InsertIntegralInfo(company.CompanyId, employee.UserName, prevLogonTime, logonTime);
            } catch (Exception ex) {
                Service.LogService.SaveExceptionLog(ex);
            }
        }
Exemplo n.º 8
0
        internal static ExternalOrder NewExternalOrder(OrderView orderView, PolicyMatch.MatchedPolicy matchedPolicy, DataTransferObject.Organization.EmployeeDetailInfo employee, AuthenticationChoise choise = AuthenticationChoise.NoNeedAUTH)
        {
            if (!orderView.Flights.Any())
            {
                throw new ArgumentNullException("orderView", "缺少航段信息");
            }
            if (!orderView.Passengers.Any())
            {
                throw new ArgumentNullException("orderView", "缺少乘机人信息");
            }
            if (matchedPolicy == null)
            {
                throw new CustomException("无相关政策信息");
            }

            #region  构造BASE
            var result = new ExternalOrder
            {
                Contact          = orderView.Contact,
                ReservationPNR   = PNRPair.IsNullOrEmpty(orderView.PNR) ? null : orderView.PNR,
                IsReduce         = orderView.IsReduce,
                IsTeam           = orderView.IsTeam,
                AssociateOrderId = orderView.AssociateOrderId,
                AssociatePNR     = orderView.AssociatePNR,
                Source           = orderView.Source,
                Choise           = choise,
                CustomNo         = matchedPolicy.OriginalPolicy == null ? string.Empty : matchedPolicy.OriginalPolicy.CustomCode,
                VisibleRole      = OrderRole.Platform | OrderRole.Purchaser,
                ForbidChangPNR   = false,
                NeedAUTH         = matchedPolicy.OriginalPolicy == null ? matchedPolicy.NeedAUTH : matchedPolicy.OriginalPolicy.NeedAUTH
            };
            var deduction      = Deduction.GetDeduction(matchedPolicy);
            var product        = ProductInfo.GetProductInfo(matchedPolicy);
            var specialProduct = product as SpeicalProductInfo;
            if (specialProduct != null && !hasETDZPermission(matchedPolicy.Provider, specialProduct))
            {
                result.Supplier = getSupplierInfo(matchedPolicy, specialProduct);
            }
            else
            {
                result.Provider = getProvider(matchedPolicy, product);
            }
            result.IsCustomerResource = ProductInfo.IsCustomerResource(matchedPolicy);
            result.IsStandby          = ProductInfo.IsStandby(matchedPolicy);
            result.Purchaser          = getPurchaserInfo(employee, deduction);
            var pnrInfo = PNRInfo.GetPNRInfo(orderView, matchedPolicy);
            result.AddPNRInfo(pnrInfo);
            result.TripType = pnrInfo.TripType;
            result.Status   = result.RequireConfirm ? OrderStatus.Applied : OrderStatus.Ordered;
            if (result.Status == OrderStatus.Applied)
            {
                result.VisibleRole |= result.IsThirdRelation ? OrderRole.Supplier : OrderRole.Provider;
            }
            #endregion
            return(result);
        }