示例#1
0
        private static DataTransferObject.Permission.UserRole getUserRole(DataTransferObject.Organization.CompanyDetailInfo company)
        {
            DataTransferObject.Permission.UserRole userRole;
            switch (company.CompanyType)
            {
            case CompanyType.Provider:
                userRole = DataTransferObject.Permission.UserRole.Provider;
                break;

            case CompanyType.Purchaser:
                userRole = DataTransferObject.Permission.UserRole.Purchaser;
                break;

            case CompanyType.Supplier:
                userRole = DataTransferObject.Permission.UserRole.Supplier;
                break;

            case CompanyType.Platform:
                userRole = DataTransferObject.Permission.UserRole.Platform;
                break;

            default:
                throw new NotSupportedException();
            }
            return(userRole);
        }
示例#2
0
 private void BindCompany(DataTransferObject.Organization.CompanyDetailInfo info)
 {
     if (info.AccountType == Common.Enums.AccountBaseType.Individual)
     {
         this.lblCompanyInfo.Visible = false;
         this.lblContactInfo.Visible = false;
         lblType.Text            = "身份证";
         this.lblTrueName.Text   = info.CompanyName;
         this.lblCertNo.Text     = info.CertNo;
         this.hfdValid.Value     = "false";
         this.txtFixedPhone.Text = info.OfficePhones;
     }
     else
     {
         this.fixedPhoneTitle.Visible = false;
         this.fixedPhoneValue.Visible = false;
         this.lblIndividual.Visible   = false;
         if (info.CompanyType == CompanyType.Provider)
         {
             this.bussnessTime.Visible = false;
         }
         if (info.CompanyType == CompanyType.Supplier)
         {
             this.hfdValid.Value = "false";
         }
         txtManagerName.Text      = info.ManagerName;
         txtManagerPhone.Text     = info.ManagerCellphone;
         txtEmergencyContact.Text = info.EmergencyContact;
         txtEmergencyCall.Text    = info.EmergencyCall;
         lblAbbreviation.Text     = info.AbbreviateName;
         lblCompanyPhone.Text     = info.OfficePhones;
         lblIdCode.Text           = info.OrginationCode;
     }
 }
示例#3
0
 private static bool isExpired(DataTransferObject.Organization.CompanyDetailInfo company)
 {
     if (company.PeriodStartOfUse.HasValue && company.PeriodStartOfUse.Value.Date > DateTime.Today)
     {
         return(true);
     }
     if (company.PeriodEndOfUse.HasValue && company.PeriodEndOfUse.Value.Date < DateTime.Today)
     {
         return(true);
     }
     return(false);
 }
示例#4
0
 private static bool validateCompany(DataTransferObject.Organization.CompanyDetailInfo company, out string message)
 {
     if (company == null)
     {
         message = "加载单位信息失败";
         return(false);
     }
     if (!company.Enabled)
     {
         message = "单位已被禁用";
         return(false);
     }
     message = string.Empty;
     return(true);
 }
示例#5
0
 private void BindContact(DataTransferObject.Organization.CompanyDetailInfo info)
 {
     if (info.AccountType == Common.Enums.AccountBaseType.Enterprise)
     {
         txtManagerName.Value      = info.ManagerName;
         txtManagerCellphone.Value = info.ManagerCellphone;
         txtEmergencyContact.Value = info.EmergencyContact;
         txtEmergencyCall.Value    = info.EmergencyCall;
         this.fixedPhone.Visible   = false;
     }
     else
     {
         this.txtFixedPhone.Value = info.OfficePhones;
         enterprise.Visible       = false;
     }
 }
示例#6
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);
            }
        }
示例#7
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);
     }
 }
示例#8
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));
        }
示例#9
0
 private void BindAddress(DataTransferObject.Organization.CompanyDetailInfo info)
 {
     hfldAddressCode.Value = ChinaPay.B3B.TransactionWeb.PublicClass.AddressShow.GetAddressJson(info.Area, info.Province, info.City, info.District);
 }
示例#10
0
 /// <summary>
 /// 验证公司是否过期没有
 /// </summary>
 /// <param name="company"></param>
 /// <returns></returns>
 private bool isExpired(DataTransferObject.Organization.CompanyDetailInfo company)
 {
     return(company.PeriodStartOfUse > DateTime.Now || DateTime.Now > company.PeriodEndOfUse);
 }
示例#11
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 { }
 }
示例#12
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));
        }