/// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id = BaseBusinessLogic.ConvertToInt(dr[BasePermissionScopeEntity.FieldId]);
     ResourceCategory     = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldResourceCategory]);
     ResourceId           = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldResourceId]);
     TargetCategory       = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldTargetCategory]);
     TargetId             = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldTargetId]);
     PermissionId         = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldPermissionId]);
     ContainChild         = BaseBusinessLogic.ConvertToInt(dr[BasePermissionScopeEntity.FieldContainChild]);
     PermissionConstraint = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldPermissionConstraint]);
     Enabled           = BaseBusinessLogic.ConvertToInt(dr[BasePermissionScopeEntity.FieldEnabled]);
     DeletionStateCode = BaseBusinessLogic.ConvertToInt(dr[BasePermissionScopeEntity.FieldDeletionStateCode]);
     Description       = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldDescription]);
     CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[BasePermissionScopeEntity.FieldCreateOn]);
     CreateBy          = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldCreateBy]);
     CreateUserId      = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldCreateUserId]);
     ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[BasePermissionScopeEntity.FieldModifiedOn]);
     ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldModifiedBy]);
     ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[BasePermissionScopeEntity.FieldModifiedUserId]);
     // 获取扩展属性
     GetFromExpand(dr);
     return(this);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dataRow">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     GetFromExpand(dr);
     UserId            = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldUserId]);
     FullName          = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldFullName]);
     Salary            = BaseBusinessLogic.ConvertToNullableDecimal(dr[UserByGUIDEntity.FieldSalary]);
     Age               = BaseBusinessLogic.ConvertToNullableInt(dr[UserByGUIDEntity.FieldAge]);
     Birthday          = BaseBusinessLogic.ConvertToNullableDateTime(dr[UserByGUIDEntity.FieldBirthday]);
     Photo             = BaseBusinessLogic.ConvertToByte(dr[UserByGUIDEntity.FieldPhoto]);
     AllowEdit         = BaseBusinessLogic.ConvertToNullableInt(dr[UserByGUIDEntity.FieldAllowEdit]);
     AllowDelete       = BaseBusinessLogic.ConvertToNullableInt(dr[UserByGUIDEntity.FieldAllowDelete]);
     Enabled           = BaseBusinessLogic.ConvertToInt(dr[UserByGUIDEntity.FieldEnabled]);
     DeletionStateCode = BaseBusinessLogic.ConvertToNullableInt(dr[UserByGUIDEntity.FieldDeletionStateCode]);
     SortCode          = BaseBusinessLogic.ConvertToInt(dr[UserByGUIDEntity.FieldSortCode]);
     Description       = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldDescription]);
     CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[UserByGUIDEntity.FieldCreateOn]);
     CreateUserId      = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldCreateUserId]);
     CreateBy          = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldCreateBy]);
     ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[UserByGUIDEntity.FieldModifiedOn]);
     ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldModifiedUserId]);
     ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[UserByGUIDEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dr">数据行</param>
        protected override BaseEntity GetFrom(IDataRow dr)
        {
            Id = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldId]);

            // 2016-02-14 吉日嘎拉 改进日志的记录数据、把一些核心参数记录下来。
            TaskId       = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldTaskId]);
            Service      = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldService]);
            CompanyId    = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldCompanyId]);
            ElapsedTicks = BaseBusinessLogic.ConvertToInt(dr[BaseLogEntity.FieldElapsedTicks]);
            StartTime    = BaseBusinessLogic.ConvertToDateTime(dr[BaseLogEntity.FieldStartTime]);
            UserId       = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldUserId]);
            UserRealName = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldUserRealName]);
            Parameters   = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldParameters]);
            UrlReferrer  = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldUrlReferrer]);
            WebUrl       = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldWebUrl]);
            ClientIP     = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldClientIP]);
            ServerIP     = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldServerIP]);
            Description  = BaseBusinessLogic.ConvertToString(dr[BaseLogEntity.FieldDescription]);

            // 获取扩展属性
            GetFromExpand(dr);
            return(this);
        }
 /// <summary>
 /// 从数据流读取
 /// </summary>
 /// <param name="dataReader">数据流</param>
 public BaseItemDetailsEntity GetFrom(IDataReader dataReader)
 {
     this.GetFromExpand(dataReader);
     this.Id                = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldId]);
     this.ParentId          = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldParentId]);
     this.ItemCode          = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldItemCode]);
     this.ItemName          = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldItemName]);
     this.ItemValue         = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldItemValue]);
     this.AllowEdit         = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldAllowEdit]);
     this.AllowDelete       = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldAllowDelete]);
     this.IsPublic          = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldIsPublic]);
     this.Enabled           = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldEnabled]);
     this.DeletionStateCode = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldDeletionStateCode]);
     this.SortCode          = BaseBusinessLogic.ConvertToInt(dataReader[BaseItemDetailsEntity.FieldSortCode]);
     this.Description       = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldDescription]);
     this.CreateOn          = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseItemDetailsEntity.FieldCreateOn]);
     this.CreateUserId      = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldCreateUserId]);
     this.CreateBy          = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldCreateBy]);
     this.ModifiedOn        = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseItemDetailsEntity.FieldModifiedOn]);
     this.ModifiedUserId    = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldModifiedUserId]);
     this.ModifiedBy        = BaseBusinessLogic.ConvertToString(dataReader[BaseItemDetailsEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id                = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldId]);
     TableCode         = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldTableCode]);
     ColumnCode        = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldColumnCode]);
     ColumnName        = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldColumnName]);
     IsPublic          = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldIsPublic]);
     Enabled           = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldEnabled]);
     AllowEdit         = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldAllowEdit]);
     AllowDelete       = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldAllowDelete]);
     DeletionStateCode = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldDeletionStateCode]);
     SortCode          = BaseBusinessLogic.ConvertToInt(dr[BaseTableColumnsEntity.FieldSortCode]);
     Description       = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldDescription]);
     CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseTableColumnsEntity.FieldCreateOn]);
     CreateUserId      = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldCreateUserId]);
     CreateBy          = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldCreateBy]);
     ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseTableColumnsEntity.FieldModifiedOn]);
     ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldModifiedUserId]);
     ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[BaseTableColumnsEntity.FieldModifiedBy]);
     // 获取扩展属性
     GetFromExpand(dr);
     return(this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldId]);
     // 2016-03-02 吉日嘎拉 防止程序出错,没有这个字段也可以正常运行
     if (dr.ContainsColumn(BaseUserLogOnEntity.FieldCompanyId))
     {
         CompanyId = BaseBusinessLogic.ConvertToString(dr[BaseUserLogOnEntity.FieldCompanyId]);
     }
     Mobile                 = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldMobile]);
     MobileValiated         = BaseBusinessLogic.ConvertToInt(dr[BaseUserContactEntity.FieldMobileValiated]);
     MobileVerificationDate = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseUserContactEntity.FieldMobileVerificationDate]);
     ShowMobile             = BaseBusinessLogic.ConvertToInt(dr[BaseUserContactEntity.FieldShowMobile]);
     Telephone              = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldTelephone]);
     Extension              = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldExtension]);
     ShortNumber            = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldShortNumber]);
     WW               = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldWW]);
     QQ               = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldQQ]);
     WeChat           = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldWeChat]);
     WeChatOpenId     = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldWeChatOpenId]);
     WeChatValiated   = BaseBusinessLogic.ConvertToInt(dr[BaseUserContactEntity.FieldWeChatValiated]);
     YiXin            = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldYiXin]);
     YiXinValiated    = BaseBusinessLogic.ConvertToInt(dr[BaseUserContactEntity.FieldYiXinValiated]);
     Email            = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldEmail]);
     EmailValiated    = BaseBusinessLogic.ConvertToInt(dr[BaseUserContactEntity.FieldEmailValiated]);
     CompanyMail      = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldCompanyMail]);
     EmergencyContact = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldEmergencyContact]);
     YY               = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldYY]);
     CreateOn         = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseUserContactEntity.FieldCreateOn]);
     CreateUserId     = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldCreateUserId]);
     CreateBy         = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldCreateBy]);
     ModifiedOn       = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseUserContactEntity.FieldModifiedOn]);
     ModifiedUserId   = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldModifiedUserId]);
     ModifiedBy       = BaseBusinessLogic.ConvertToString(dr[BaseUserContactEntity.FieldModifiedBy]);
     // 获取扩展属性
     GetFromExpand(dr);
     return(this);
 }
 /// <summary>
 /// 从数据流读取
 /// </summary>
 /// <param name="dataReader">数据流</param>
 public BaseWorkFlowCurrentEntity GetFrom(IDataReader dataReader)
 {
     this.GetFromExpand(dataReader);;
     this.Id                = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldId]);
     this.CategoryCode      = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldCategoryCode]);
     this.CategoryFullName  = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldCategoryFullName]);
     this.ObjectId          = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldObjectId]);
     this.ObjectFullName    = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldObjectFullName]);
     this.WorkFlowId        = BaseBusinessLogic.ConvertToInt(dataReader[BaseWorkFlowCurrentEntity.FieldWorkFlowId]);
     this.ActivityId        = BaseBusinessLogic.ConvertToInt(dataReader[BaseWorkFlowCurrentEntity.FieldActivityId]);
     this.ActivityFullName  = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldActivityFullName]);
     this.ToDepartmentId    = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldToDepartmentId]);
     this.ToDepartmentName  = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldToDepartmentName]);
     this.ToUserId          = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldToUserId]);
     this.ToUserRealName    = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldToUserRealName]);
     this.ToRoleId          = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldToRoleId]);
     this.ToRoleRealName    = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldToRoleRealName]);
     this.AuditUserId       = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldAuditUserId]);
     this.AuditUserCode     = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldAuditUserCode]);
     this.AuditUserRealName = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldAuditUserRealName]);
     this.SendDate          = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseWorkFlowCurrentEntity.FieldSendDate]);
     this.AuditDate         = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseWorkFlowCurrentEntity.FieldAuditDate]);
     this.AuditIdea         = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldAuditIdea]);
     this.AuditStatus       = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldAuditStatus]);
     this.AuditStatusName   = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldAuditStatusName]);
     this.SortCode          = BaseBusinessLogic.ConvertToInt(dataReader[BaseWorkFlowCurrentEntity.FieldSortCode]);
     this.Enabled           = BaseBusinessLogic.ConvertToInt(dataReader[BaseWorkFlowCurrentEntity.FieldEnabled]);
     this.DeletionStateCode = BaseBusinessLogic.ConvertToInt(dataReader[BaseWorkFlowCurrentEntity.FieldDeletionStateCode]);
     this.Description       = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldDescription]);
     this.CreateOn          = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseWorkFlowCurrentEntity.FieldCreateOn]);
     this.CreateUserId      = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldCreateUserId]);
     this.CreateBy          = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldCreateBy]);
     this.ModifiedOn        = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseWorkFlowCurrentEntity.FieldModifiedOn]);
     this.ModifiedUserId    = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldModifiedUserId]);
     this.ModifiedBy        = BaseBusinessLogic.ConvertToString(dataReader[BaseWorkFlowCurrentEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     GetFromExpand(dr);
     Id                = BaseBusinessLogic.ConvertToDecimal(dr[ItemsSystemEntity.FieldId]);
     ParentId          = BaseBusinessLogic.ConvertToNullableDecimal(dr[ItemsSystemEntity.FieldParentId]);
     Description       = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldDescription]);
     Enabled           = BaseBusinessLogic.ConvertToDecimal(dr[ItemsSystemEntity.FieldEnabled]);
     ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldModifiedUserId]);
     SortCode          = BaseBusinessLogic.ConvertToNullableDecimal(dr[ItemsSystemEntity.FieldSortCode]);
     Ispublic          = BaseBusinessLogic.ConvertToDecimal(dr[ItemsSystemEntity.FieldIspublic]);
     CreateBy          = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldCreateby]);
     CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[ItemsSystemEntity.FieldCreateon]);
     ItemValue         = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldItemValue]);
     CreateUserId      = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldCreateUserId]);
     Logonurl          = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldLogonUrl]);
     AllowDelete       = BaseBusinessLogic.ConvertToDecimal(dr[ItemsSystemEntity.FieldAllowDelete]);
     ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[ItemsSystemEntity.FieldModifiedOn]);
     itemName          = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldItemName]);
     AllowEdit         = BaseBusinessLogic.ConvertToDecimal(dr[ItemsSystemEntity.FieldAllowEdit]);
     ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldModifiedBy]);
     itemCode          = BaseBusinessLogic.ConvertToString(dr[ItemsSystemEntity.FieldItemCode]);
     DeletionStateCode = BaseBusinessLogic.ConvertToNullableDecimal(dr[ItemsSystemEntity.FieldDeletionStateCode]);
     return(this);
 }
Exemplo n.º 9
0
        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dr">数据行</param>
		protected override BaseEntity GetFrom(IDataRow dr)
        {
            Id = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldId]);
            OrganizeId = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldOrganizeId]);
            Code = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldCode]);
            RealName = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldRealName]);
            CategoryCode = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldCategoryCode]);
            AllowEdit = BaseBusinessLogic.ConvertToInt(dr[BaseRoleEntity.FieldAllowEdit]);
            AllowDelete = BaseBusinessLogic.ConvertToInt(dr[BaseRoleEntity.FieldAllowDelete]);
            IsVisible = BaseBusinessLogic.ConvertToInt(dr[BaseRoleEntity.FieldIsVisible]);
            SortCode = BaseBusinessLogic.ConvertToInt(dr[BaseRoleEntity.FieldSortCode]);
            DeletionStateCode = BaseBusinessLogic.ConvertToInt(dr[BaseRoleEntity.FieldDeletionStateCode]);
            Enabled = BaseBusinessLogic.ConvertToInt(dr[BaseRoleEntity.FieldEnabled]);
            Description = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldDescription]);
            CreateOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseRoleEntity.FieldCreateOn]);
            CreateUserId = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldCreateUserId]);
            CreateBy = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldCreateBy]);
            ModifiedOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseRoleEntity.FieldModifiedOn]);
            ModifiedUserId = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldModifiedUserId]);
            ModifiedBy = BaseBusinessLogic.ConvertToString(dr[BaseRoleEntity.FieldModifiedBy]);
            // 获取扩展属性
            GetFromExpand(dr);
            return this;
        }
Exemplo n.º 10
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id                = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldId]);
     CompanyId         = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldCompanyId]);
     CompanyName       = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldCompanyName]);
     DepartmentId      = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldDepartmentId]);
     DepartmentName    = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldDepartmentName]);
     FolderId          = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldFolderId]);
     CategoryCode      = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldCategoryCode]);
     Code              = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldCode]);
     Title             = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldTitle]);
     FilePath          = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldFilePath]);
     Introduction      = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldIntroduction]);
     Contents          = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldContents]);
     Source            = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldSource]);
     Keywords          = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldKeywords]);
     FileSize          = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldFileSize]);
     ImageUrl          = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldImageUrl]);
     SubPage           = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldSubPage]);
     HomePage          = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldHomePage]);
     AuditStatus       = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldAuditStatus]);
     ReadCount         = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldReadCount]);
     DeletionStateCode = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldDeletionStateCode]);
     Description       = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldDescription]);
     Enabled           = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldEnabled]);
     SortCode          = BaseBusinessLogic.ConvertToInt(dr[BaseNewsEntity.FieldSortCode]);
     CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseNewsEntity.FieldCreateOn]);
     CreateBy          = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldCreateBy]);
     CreateUserId      = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldCreateUserId]);
     ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseNewsEntity.FieldModifiedOn]);
     ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldModifiedBy]);
     ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[BaseNewsEntity.FieldModifiedUserId]);
     // 获取扩展属性
     GetFromExpand(dr);
     return(this);
 }
Exemplo n.º 11
0
 /// <summary>
 /// 从数据流读取
 /// </summary>
 /// <param name="dataReader">数据流</param>
 public BaseContactDetailsEntity GetFrom(IDataReader dataReader)
 {
     this.GetFromExpand(dataReader);
     this.Id                = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldId]);
     this.ContactId         = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldContactId]);
     this.Category          = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldCategory]);
     this.ReceiverId        = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldReceiverId]);
     this.ReceiverRealName  = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldReceiverRealName]);
     this.IsNew             = BaseBusinessLogic.ConvertToInt(dataReader[BaseContactDetailsEntity.FieldIsNew]);
     this.NewComment        = BaseBusinessLogic.ConvertToInt(dataReader[BaseContactDetailsEntity.FieldNewComment]);
     this.LastViewIP        = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldLastViewIP]);
     this.LastViewDate      = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldLastViewDate]);
     this.Enabled           = BaseBusinessLogic.ConvertToInt(dataReader[BaseContactDetailsEntity.FieldEnabled]);
     this.DeletionStateCode = BaseBusinessLogic.ConvertToInt(dataReader[BaseContactDetailsEntity.FieldDeletionStateCode]);
     this.SortCode          = BaseBusinessLogic.ConvertToInt(dataReader[BaseContactDetailsEntity.FieldSortCode]);
     this.Description       = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldDescription]);
     this.CreateOn          = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseContactDetailsEntity.FieldCreateOn]);
     this.CreateUserId      = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldCreateUserId]);
     this.CreateBy          = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldCreateBy]);
     this.ModifiedOn        = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseContactDetailsEntity.FieldModifiedOn]);
     this.ModifiedUserId    = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldModifiedUserId]);
     this.ModifiedBy        = BaseBusinessLogic.ConvertToString(dataReader[BaseContactDetailsEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 12
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id                = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowHistoryEntity.FieldId]);
     CurrentFlowId     = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldCurrentFlowId]);
     ProcessId         = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowHistoryEntity.FieldProcessId]);
     ActivityId        = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowHistoryEntity.FieldActivityId]);
     ActivityCode      = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldActivityCode]);
     ActivityFullName  = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldActivityFullName]);
     ToDepartmentId    = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldToDepartmentId]);
     ToDepartmentName  = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldToDepartmentName]);
     ToUserId          = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldToUserId]);
     ToUserRealName    = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldToUserRealName]);
     ToRoleId          = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldToRoleId]);
     ToRoleRealName    = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldToRoleRealName]);
     AuditUserId       = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldAuditUserId]);
     AuditUserCode     = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldAuditUserCode]);
     AuditUserRealName = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldAuditUserRealName]);
     SendDate          = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseWorkFlowHistoryEntity.FieldSendDate]);
     AuditDate         = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseWorkFlowHistoryEntity.FieldAuditDate]);
     AuditIdea         = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldAuditIdea]);
     AuditStatus       = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldAuditStatus]);
     AuditStatusName   = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldAuditStatusName]);
     SortCode          = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowHistoryEntity.FieldSortCode]);
     Enabled           = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowHistoryEntity.FieldEnabled]);
     DeletionStateCode = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowHistoryEntity.FieldDeletionStateCode]);
     Description       = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldDescription]);
     CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseWorkFlowHistoryEntity.FieldCreateOn]);
     CreateUserId      = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldCreateUserId]);
     CreateBy          = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldCreateBy]);
     ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseWorkFlowHistoryEntity.FieldModifiedOn]);
     ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldModifiedUserId]);
     ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowHistoryEntity.FieldModifiedBy]);
     // 获取扩展属性
     GetFromExpand(dr);
     return(this);
 }
Exemplo n.º 13
0
 /// <summary>
 /// 从数据流读取
 /// </summary>
 /// <param name="dataReader">数据流</param>
 public BaseRoleEntity GetFrom(IDataReader dataReader)
 {
     this.GetFromExpand(dataReader);
     this.Id                = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldId]);
     this.SystemId          = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldSystemId]);
     this.OrganizeId        = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldOrganizeId]);
     this.Code              = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldCode]);
     this.RealName          = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldRealName]);
     this.CategoryCode      = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldCategoryCode]);
     this.AllowEdit         = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldAllowEdit]);
     this.AllowDelete       = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldAllowDelete]);
     this.IsVisible         = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldIsVisible]);
     this.SortCode          = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldSortCode]);
     this.DeletionStateCode = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldDeletionStateCode]);
     this.Enabled           = BaseBusinessLogic.ConvertToInt(dataReader[BaseRoleEntity.FieldEnabled]);
     this.Description       = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldDescription]);
     this.CreateOn          = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseRoleEntity.FieldCreateOn]);
     this.CreateUserId      = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldCreateUserId]);
     this.CreateBy          = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldCreateBy]);
     this.ModifiedOn        = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseRoleEntity.FieldModifiedOn]);
     this.ModifiedUserId    = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldModifiedUserId]);
     this.ModifiedBy        = BaseBusinessLogic.ConvertToString(dataReader[BaseRoleEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id                  = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldId]);
     ProcessId           = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldProcessId]);
     Code                = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldCode]);
     FullName            = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldFullName]);
     AuditDepartmentId   = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditDepartmentId]);
     AuditDepartmentName = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditDepartmentName]);
     AuditUserId         = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditUserId]);
     AuditUserCode       = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditUserCode]);
     AuditUserRealName   = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditUserRealName]);
     AuditRoleId         = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditRoleId]);
     AuditRoleRealName   = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldAuditRoleRealName]);
     if (dr.ContainsColumn(BaseWorkFlowStepEntity.FieldActivityId))
     {
         ActivityId = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldActivityId]);
     }
     else
     {
         ActivityId = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldId]);
     }
     ActivityType       = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldActivityType]);
     AllowPrint         = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldAllowPrint]);
     AllowEditDocuments = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldAllowEditDocuments]);
     SortCode           = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldSortCode]);
     Enabled            = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldEnabled]);
     DeletionStateCode  = BaseBusinessLogic.ConvertToInt(dr[BaseWorkFlowStepEntity.FieldDeletionStateCode]);
     Description        = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldDescription]);
     CreateOn           = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseWorkFlowStepEntity.FieldCreateOn]);
     CreateUserId       = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldCreateUserId]);
     CreateBy           = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldCreateBy]);
     ModifiedOn         = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseWorkFlowStepEntity.FieldModifiedOn]);
     ModifiedUserId     = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldModifiedUserId]);
     ModifiedBy         = BaseBusinessLogic.ConvertToString(dr[BaseWorkFlowStepEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 15
0
        /// <summary>
        /// 导入Excel数据到本地数据库
        /// </summary>
        public bool Import()
        {
            if (string.IsNullOrEmpty(txtFileFullPath.Text.Trim()))
            {
                XtraMessageBox.Show(@"请选择录单模板", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnOpenExcel_Click(this, null);
                return(false);
            }
            if (!File.Exists(txtFileFullPath.Text))
            {
                XtraMessageBox.Show(@"选中文件不存在,请重新选择导入Excel文件", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnOpenExcel_Click(this, null);
                return(false);
            }
            var startDateTime = DateTime.Now;

            StartDt = startDateTime;
            if (!splashScreenManagerImportExcel.IsSplashFormVisible)
            {
                splashScreenManagerImportExcel.ShowWaitForm();
            }
            Application.DoEvents();
            splashScreenManagerImportExcel.SetWaitFormCaption("请稍后");
            splashScreenManagerImportExcel.SetWaitFormDescription("开始导入Excel数据...");
            try
            {
                DataTable chooseDt = ExcelHelper.ExcelToDataTable(txtFileFullPath.Text.Trim(), 38, 0, 3);
                if (chooseDt != null && chooseDt.Rows.Count > 0)
                {
                    var           list              = new List <ZtoPrintBillEntity>();
                    int           temp              = 0;
                    var           defaultUserList   = new ZtoUserManager(BillPrintHelper.DbHelper).GetList <ZtoUserEntity>(new KeyValuePair <string, object>(ZtoUserEntity.FieldIsDefault, 1), new KeyValuePair <string, object>(ZtoUserEntity.FieldIssendorreceive, 1));
                    ZtoUserEntity defaultUserEntity = null;
                    if (defaultUserList.Any())
                    {
                        defaultUserEntity = defaultUserList.First();
                    }
                    foreach (DataRow dr in chooseDt.Rows)
                    {
                        ++temp;
                        splashScreenManagerImportExcel.SetWaitFormDescription(string.Format("正在导入Excel数据:{0}/{1}", temp, chooseDt.Rows.Count));
                        ZtoPrintBillEntity entity = new ZtoPrintBillEntity();
                        if (ckTodaySend.Checked)
                        {
                            entity.SendDate = DateTime.Now.ToString(BaseSystemInfo.DateFormat);
                        }
                        if (ckUserDefaultSendMan.Checked)
                        {
                            if (defaultUserEntity != null)
                            {
                                entity.SendMan        = defaultUserEntity.Realname;
                                entity.SendPhone      = defaultUserEntity.Mobile + " " + defaultUserEntity.TelePhone;
                                entity.SendProvince   = defaultUserEntity.Province;
                                entity.SendCity       = defaultUserEntity.City;
                                entity.SendCounty     = defaultUserEntity.County;
                                entity.SendAddress    = defaultUserEntity.Address;
                                entity.SendSite       = "";
                                entity.SendDeparture  = entity.SendProvince;
                                entity.SendCompany    = defaultUserEntity.Company;
                                entity.SendDepartment = defaultUserEntity.Department;
                                entity.SendPostcode   = defaultUserEntity.Postcode;
                            }
                        }
                        else
                        {
                            if (this.Tag != null)
                            {
                                var sendUserEntity = this.Tag as ZtoUserEntity;
                                // 表示选择了一个发件人的信息,这样也不用读取Excel里面的发件人了
                                if (sendUserEntity != null)
                                {
                                    entity.SendMan        = sendUserEntity.Realname;
                                    entity.SendPhone      = sendUserEntity.Mobile + " " + sendUserEntity.TelePhone;
                                    entity.SendProvince   = sendUserEntity.Province;
                                    entity.SendCity       = sendUserEntity.City;
                                    entity.SendCounty     = sendUserEntity.County;
                                    entity.SendAddress    = sendUserEntity.Address;
                                    entity.SendSite       = "";
                                    entity.SendDeparture  = sendUserEntity.Province;
                                    entity.SendCompany    = sendUserEntity.Company;
                                    entity.SendDepartment = sendUserEntity.Department;
                                    entity.SendPostcode   = sendUserEntity.Postcode;
                                }
                            }
                            else
                            {
                                entity.SendMan       = BaseBusinessLogic.ConvertToString(dr[2]);
                                entity.SendPhone     = BaseBusinessLogic.ConvertToString(dr[3]);
                                entity.SendProvince  = BaseBusinessLogic.ConvertToString(dr[4]);
                                entity.SendCity      = BaseBusinessLogic.ConvertToString(dr[5]);
                                entity.SendCounty    = BaseBusinessLogic.ConvertToString(dr[6]);
                                entity.SendAddress   = BaseBusinessLogic.ConvertToString(dr[7]);
                                entity.SendSite      = "";
                                entity.SendDeparture = BaseBusinessLogic.ConvertToString(dr[26]);
                                if (string.IsNullOrEmpty(entity.SendDeparture))
                                {
                                    entity.SendDeparture = entity.SendProvince;
                                }
                                entity.SendCompany    = BaseBusinessLogic.ConvertToString(dr[27]);
                                entity.SendDepartment = BaseBusinessLogic.ConvertToString(dr[28]);
                                entity.SendPostcode   = BaseBusinessLogic.ConvertToString(dr[29]);
                            }
                        }
                        entity.ReceiveMan         = BaseBusinessLogic.ConvertToString(dr[8]);
                        entity.ReceivePhone       = BaseBusinessLogic.ConvertToString(dr[9]);
                        entity.ReceiveProvince    = BaseBusinessLogic.ConvertToString(dr[10]);
                        entity.ReceiveCity        = BaseBusinessLogic.ConvertToString(dr[11]);
                        entity.ReceiveCounty      = BaseBusinessLogic.ConvertToString(dr[12]);
                        entity.ReceiveAddress     = BaseBusinessLogic.ConvertToString(dr[13]);
                        entity.ReceiveDestination = BaseBusinessLogic.ConvertToString(dr[30]);
                        if (string.IsNullOrEmpty(entity.ReceiveDestination))
                        {
                            entity.ReceiveDestination = entity.ReceiveProvince;
                        }
                        entity.ReceiveCompany  = BaseBusinessLogic.ConvertToString(dr[31]);
                        entity.ReceivePostcode = BaseBusinessLogic.ConvertToString(dr[32]);
                        entity.GoodsName       = BaseBusinessLogic.ConvertToString(dr[14]);
                        entity.Weight          = BaseBusinessLogic.ConvertToString(dr[15]);
                        entity.TranFee         = BaseBusinessLogic.ConvertToString(dr[16]);
                        entity.GOODS_PAYMENT   = BaseBusinessLogic.ConvertToDecimal(dr[17]);
                        entity.TOPAYMENT       = BaseBusinessLogic.ConvertToDecimal(dr[18]);
                        entity.Length          = BaseBusinessLogic.ConvertToString(dr[33]);
                        entity.Width           = BaseBusinessLogic.ConvertToString(dr[34]);
                        entity.Height          = BaseBusinessLogic.ConvertToString(dr[35]);
                        entity.TotalNumber     = BaseBusinessLogic.ConvertToString(dr[36]);
                        entity.OrderNumber     = BaseBusinessLogic.ConvertToString(dr[37]);
                        entity.Remark          = BaseBusinessLogic.ConvertToString(dr[22]);
                        entity.CreateUserName  = "";
                        entity.CreateSite      = "";
                        entity.CreateOn        = DateTime.Now;
                        entity.PaymentType     = "现金";
                        // 如果Excel里面没有填写订单号系统自动生成一个订单号,这样提取电子面单单号就不用怕了,2016-1-23 14:07:12
                        if (string.IsNullOrEmpty(entity.OrderNumber))
                        {
                            // 导入自动生成订单号(电子面单)79170-南昌昌南  18779176845 这个qq提供的思路,2016-1-20 20:08:50
                            entity.OrderNumber = Guid.NewGuid().ToString("N").ToLower();
                        }
                        if (!ckGetServerPrintMark.Checked)
                        {
                            entity.BigPen = string.Format("{0} {1} {2}", entity.ReceiveProvince, entity.ReceiveCity, entity.ReceiveCounty);
                        }
                        else
                        {
                            entity.BigPen = "";
                        }
                        list.Add(entity);
                    }
                    if (!ckGetServerPrintMark.Checked)
                    {
                        var manager = new ZtoPrintBillManager(BillPrintHelper.DbHelper);
                        foreach (ZtoPrintBillEntity ztoPrintBillEntity in list)
                        {
                            manager.Add(ztoPrintBillEntity, true);
                        }
                        if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
                        {
                            splashScreenManagerImportExcel.CloseWaitForm();
                        }
                        GridDataBind();
                        var ts = DateTime.Now - startDateTime;
                        lblTime.Text = string.Format("耗时:{0}时{1}分{2}秒{3}毫秒", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
                        Close();
                    }
                    else
                    {
                        splashScreenManagerImportExcel.SetWaitFormDescription("正在联网获取大头笔信息,请稍后......");
                        // 开线程去读取大头笔的
                        CheckBillCode(list);
                    }
                }
                else
                {
                    XtraMessageBox.Show(@"模板没有填写任何数据,导入失败", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
                return(false);
            }
            finally
            {
                if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
                {
                    splashScreenManagerImportExcel.CloseWaitForm();
                }
            }
            return(true);
        }
Exemplo n.º 16
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     GetFromExpand(dr);
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldId))
     {
         Id = BaseBusinessLogic.ConvertToDecimal(dr[ZtoPrintBillEntity.FieldId]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendPostcode))
     {
         SendPostcode = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendPostcode]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveMan))
     {
         ReceiveMan = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveMan]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveProvince))
     {
         ReceiveProvince = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveProvince]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldCreateUserName))
     {
         CreateUserName = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldCreateUserName]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldModifiedSite))
     {
         ModifiedSite = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldModifiedSite]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldModifiedUserName))
     {
         ModifiedUserName = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldModifiedUserName]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldPaymentType))
     {
         PaymentType = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldPaymentType]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldLength))
     {
         Length = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldLength]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendMan))
     {
         SendMan = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendMan]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldModifiedOn))
     {
         ModifiedOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[ZtoPrintBillEntity.FieldModifiedOn]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveAddress))
     {
         ReceiveAddress = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveAddress]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceivePostcode))
     {
         ReceivePostcode = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceivePostcode]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceivePhone))
     {
         ReceivePhone = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceivePhone]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendDepartment))
     {
         SendDepartment = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendDepartment]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendDate))
     {
         SendDate = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendDate]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendProvince))
     {
         SendProvince = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendProvince]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldTranFee))
     {
         TranFee = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldTranFee]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendDeparture))
     {
         SendDeparture = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendDeparture]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendPhone))
     {
         SendPhone = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendPhone]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendCity))
     {
         SendCity = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendCity]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldGoodsName))
     {
         GoodsName = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldGoodsName]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldWeight))
     {
         Weight = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldWeight]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldHeight))
     {
         Height = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldHeight]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveCounty))
     {
         ReceiveCounty = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveCounty]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveDestination))
     {
         ReceiveDestination = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveDestination]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendCompany))
     {
         SendCompany = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendCompany]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldCreateOn))
     {
         CreateOn = BaseBusinessLogic.ConvertToDateTime(dr[ZtoPrintBillEntity.FieldCreateOn]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldBillCode))
     {
         BillCode = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldBillCode]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldTotalNumber))
     {
         TotalNumber = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldTotalNumber]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldRemark))
     {
         Remark = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldRemark]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldCreateSite))
     {
         CreateSite = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldCreateSite]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendSite))
     {
         SendSite = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendSite]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldWidth))
     {
         Width = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldWidth]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveCity))
     {
         ReceiveCity = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveCity]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendAddress))
     {
         SendAddress = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendAddress]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldSendCounty))
     {
         SendCounty = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldSendCounty]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldReceiveCompany))
     {
         ReceiveCompany = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldReceiveCompany]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldBigPen))
     {
         BigPen = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldBigPen]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldOrderNumber))
     {
         OrderNumber = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldOrderNumber]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldExpressId))
     {
         ExpressId = BaseBusinessLogic.ConvertToString(dr[ZtoPrintBillEntity.FieldExpressId]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldToPayMent))
     {
         TOPAYMENT = BaseBusinessLogic.ConvertToDecimal(dr[ZtoPrintBillEntity.FieldToPayMent]);
     }
     if (dr.ContainsColumn(ZtoPrintBillEntity.FieldGoodsPayMent))
     {
         GOODS_PAYMENT = BaseBusinessLogic.ConvertToDecimal(dr[ZtoPrintBillEntity.FieldGoodsPayMent]);
     }
     return(this);
 }
Exemplo n.º 17
0
 /// <summary>
 /// 导入Excel数据到本地数据库
 /// </summary>
 public bool Import()
 {
     if (string.IsNullOrEmpty(txtFileFullPath.Text.Trim()))
     {
         XtraMessageBox.Show(@"请选择录单模板", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnOpenExcel_Click(this, null);
         return(false);
     }
     if (!File.Exists(txtFileFullPath.Text))
     {
         XtraMessageBox.Show(@"选中文件不存在,请重新选择导入Excel文件", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnOpenExcel_Click(this, null);
         return(false);
     }
     if (!splashScreenManagerImportExcel.IsSplashFormVisible)
     {
         splashScreenManagerImportExcel.ShowWaitForm();
     }
     Application.DoEvents();
     splashScreenManagerImportExcel.SetWaitFormCaption("请稍后");
     splashScreenManagerImportExcel.SetWaitFormDescription("开始导入Excel数据...");
     try
     {
         int crossRow = int.Parse(cmbPrintNumber.Text) - 1;
         if (crossRow < 0)
         {
             crossRow = 1;
         }
         DataTable chooseDt = ExcelHelper.ExcelToDataTable(txtFileFullPath.Text.Trim(), 38, 0, crossRow);
         if (chooseDt != null && chooseDt.Rows.Count > 0)
         {
             var list = new List <ZtoUserEntity>();
             int temp = 0;
             foreach (DataRow dr in chooseDt.Rows)
             {
                 ++temp;
                 splashScreenManagerImportExcel.SetWaitFormDescription(string.Format("正在导入Excel数据:{0}/{1}", temp, chooseDt.Rows.Count));
                 var userEntity = new ZtoUserEntity {
                     Realname = BaseBusinessLogic.ConvertToString(dr[8])
                 };
                 if (ValidateUtil.IsMobile(BaseBusinessLogic.ConvertToString(dr[9])))
                 {
                     userEntity.Mobile = BaseBusinessLogic.ConvertToString(dr[9]);
                 }
                 else
                 {
                     userEntity.TelePhone = BaseBusinessLogic.ConvertToString(dr[9]);
                 }
                 var tempProvince = BaseBusinessLogic.ConvertToString(dr[10]);
                 // 收件人地址(有可能用户不填写收件省市区)
                 userEntity.Address = BaseBusinessLogic.ConvertToString(dr[13]);
                 if (tempProvince != null)
                 {
                     userEntity.Province = tempProvince.Trim();
                 }
                 var tempCity = BaseBusinessLogic.ConvertToString(dr[11]);
                 if (tempCity != null)
                 {
                     userEntity.City = tempCity.Trim();
                 }
                 var tempCounty = BaseBusinessLogic.ConvertToString(dr[12]);
                 if (tempCounty != null)
                 {
                     userEntity.County = tempCounty.Trim();
                 }
                 if (string.IsNullOrEmpty(userEntity.Province) && string.IsNullOrEmpty(userEntity.City) && string.IsNullOrEmpty(userEntity.County))
                 {
                     if (!string.IsNullOrEmpty(userEntity.Address))
                     {
                         var result = BaiduMapHelper.GetProvCityDistFromBaiduMap(userEntity.Address);
                         if (result != null)
                         {
                             userEntity.Province = result.Result.AddressComponent.Province;
                             userEntity.City     = result.Result.AddressComponent.City;
                             userEntity.County   = result.Result.AddressComponent.District;
                         }
                     }
                 }
                 userEntity.Company         = BaseBusinessLogic.ConvertToString(dr[31]);
                 userEntity.Postcode        = BaseBusinessLogic.ConvertToString(dr[32]);
                 userEntity.Issendorreceive = "0";
                 if (string.IsNullOrEmpty(userEntity.Postcode))
                 {
                     if (!string.IsNullOrEmpty(userEntity.City) && !string.IsNullOrEmpty(userEntity.County))
                     {
                         userEntity.Postcode = NetworkHelper.GetPostCodeByAddress(userEntity.City, userEntity.County);
                     }
                 }
                 if (!string.IsNullOrEmpty(userEntity.Province))
                 {
                     var areaEntity = _areaManager.GetList <BaseAreaEntity>(new KeyValuePair <string, object>(BaseAreaEntity.FieldFullName, userEntity.Province)).FirstOrDefault();
                     if (areaEntity != null)
                     {
                         userEntity.ProvinceId = areaEntity.Id;
                     }
                 }
                 if (!string.IsNullOrEmpty(userEntity.City))
                 {
                     var areaEntity = _areaManager.GetList <BaseAreaEntity>(new KeyValuePair <string, object>(BaseAreaEntity.FieldFullName, userEntity.City)).FirstOrDefault();
                     if (areaEntity != null)
                     {
                         userEntity.CityId = areaEntity.Id;
                     }
                 }
                 if (!string.IsNullOrEmpty(userEntity.County))
                 {
                     var areaEntity = _areaManager.GetList <BaseAreaEntity>(new KeyValuePair <string, object>(BaseAreaEntity.FieldFullName, userEntity.County)).FirstOrDefault();
                     if (areaEntity != null)
                     {
                         userEntity.CountyId = areaEntity.Id;
                     }
                 }
                 userEntity.CreateOn = DateTime.Now;
                 list.Add(userEntity);
             }
             using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SQLite, BillPrintHelper.BillPrintConnectionString))
             {
                 try
                 {
                     dbHelper.BeginTransaction();
                     var manager = new ZtoUserManager(dbHelper);
                     foreach (ZtoUserEntity ztoUserEntity in list)
                     {
                         manager.Add(ztoUserEntity, true);
                     }
                     dbHelper.CommitTransaction();
                     GridDataBind();
                 }
                 catch (Exception ex)
                 {
                     dbHelper.RollbackTransaction();
                     ProcessException(ex);
                 }
             }
             if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
             {
                 splashScreenManagerImportExcel.CloseWaitForm();
             }
             Close();
         }
         else
         {
             XtraMessageBox.Show(@"模板没有填写任何数据,导入失败", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
         return(false);
     }
     finally
     {
         if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
         {
             splashScreenManagerImportExcel.CloseWaitForm();
         }
     }
     return(true);
 }
Exemplo n.º 18
0
        /// <summary>
        /// 导入Excel数据到本地数据库
        /// </summary>
        public bool Import()
        {
            if (string.IsNullOrEmpty(txtFileFullPath.Text.Trim()))
            {
                XtraMessageBox.Show(@"请选择录单模板", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnOpenExcel_Click(this, null);
                return(false);
            }
            if (!File.Exists(txtFileFullPath.Text))
            {
                XtraMessageBox.Show(@"选中文件不存在,请重新选择导入Excel文件", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnOpenExcel_Click(this, null);
                return(false);
            }
            var startDateTime = DateTime.Now;

            StartDt = startDateTime;
            if (!splashScreenManagerImportExcel.IsSplashFormVisible)
            {
                splashScreenManagerImportExcel.ShowWaitForm();
            }
            Application.DoEvents();
            splashScreenManagerImportExcel.SetWaitFormCaption("请稍后");
            splashScreenManagerImportExcel.SetWaitFormDescription("开始导入Excel数据...");
            try
            {
                DataTable chooseDt = ExcelHelper.ExcelToDataTable(txtFileFullPath.Text.Trim(), 11, 0, 1);
                if (chooseDt != null && chooseDt.Rows.Count > 0)
                {
                    var           list              = new List <ZtoPrintBillEntity>();
                    int           temp              = 0;
                    var           defaultUserList   = new ZtoUserManager(BillPrintHelper.DbHelper).GetList <ZtoUserEntity>(new KeyValuePair <string, object>(ZtoUserEntity.FieldIsDefault, 1), new KeyValuePair <string, object>(ZtoUserEntity.FieldIssendorreceive, 1));
                    ZtoUserEntity defaultUserEntity = null;
                    if (defaultUserList.Any())
                    {
                        defaultUserEntity = defaultUserList.First();
                    }
                    foreach (DataRow dr in chooseDt.Rows)
                    {
                        ++temp;
                        splashScreenManagerImportExcel.SetWaitFormDescription(string.Format("正在导入Excel数据:{0}/{1}", temp, chooseDt.Rows.Count));
                        ZtoPrintBillEntity entity = new ZtoPrintBillEntity();
                        if (ckTodaySend.Checked)
                        {
                            entity.SendDate = DateTime.Now.ToString(BaseSystemInfo.DateFormat);
                        }
                        if (ckUserDefaultSendMan.Checked)
                        {
                            if (defaultUserEntity != null)
                            {
                                entity.SendMan        = defaultUserEntity.Realname;
                                entity.SendPhone      = defaultUserEntity.Mobile + " " + defaultUserEntity.TelePhone;
                                entity.SendProvince   = defaultUserEntity.Province;
                                entity.SendCity       = defaultUserEntity.City;
                                entity.SendCounty     = defaultUserEntity.County;
                                entity.SendAddress    = defaultUserEntity.Address;
                                entity.SendDeparture  = entity.SendProvince;
                                entity.SendCompany    = defaultUserEntity.Company;
                                entity.SendDepartment = defaultUserEntity.Department;
                                entity.SendPostcode   = defaultUserEntity.Postcode;
                            }
                        }
                        else
                        {
                            // 使用Excel里面的发件人
                            entity.SendMan     = BaseBusinessLogic.ConvertToString(dr[6]);
                            entity.SendPhone   = BaseBusinessLogic.ConvertToString(dr[7]);
                            entity.SendAddress = BaseBusinessLogic.ConvertToString(dr[8]);
                            if (string.IsNullOrEmpty(entity.SendProvince) && string.IsNullOrEmpty(entity.SendCity) && string.IsNullOrEmpty(entity.SendCounty))
                            {
                                if (!string.IsNullOrEmpty(entity.SendAddress))
                                {
                                    var baiAddressEntity = BaiduMapHelper.GetProvCityDistFromBaiduMap(entity.SendAddress);
                                    if (baiAddressEntity != null)
                                    {
                                        entity.SendProvince = baiAddressEntity.Result.AddressComponent.Province;
                                        entity.SendCity     = baiAddressEntity.Result.AddressComponent.City;
                                        entity.SendCounty   = baiAddressEntity.Result.AddressComponent.District;
                                    }
                                }
                            }
                            entity.SendDeparture = entity.SendProvince;
                            if (string.IsNullOrEmpty(entity.SendDeparture))
                            {
                                entity.SendDeparture = entity.SendProvince;
                            }
                            entity.SendCompany    = BaseBusinessLogic.ConvertToString(dr[10]);
                            entity.SendDepartment = BaseBusinessLogic.ConvertToString(dr[11]);
                            entity.SendPostcode   = BaseBusinessLogic.ConvertToString(dr[9]);
                        }
                        entity.ReceiveMan     = BaseBusinessLogic.ConvertToString(dr[0]);
                        entity.ReceivePhone   = BaseBusinessLogic.ConvertToString(dr[1]);
                        entity.ReceiveAddress = BaseBusinessLogic.ConvertToString(dr[2]);
                        //if (string.IsNullOrEmpty(entity.ReceiveProvince) && string.IsNullOrEmpty(entity.ReceiveCity) && string.IsNullOrEmpty(entity.ReceiveCounty))
                        //{
                        //    if (!string.IsNullOrEmpty(entity.ReceiveAddress))
                        //    {
                        //        var baiAddressEntity = BaiduHelper.GetProvCityDistFromBaiduMap(entity.ReceiveAddress);
                        //        if (baiAddressEntity != null)
                        //        {
                        //            entity.ReceiveProvince = baiAddressEntity.Result.AddressComponent.Province;
                        //            entity.ReceiveCity = baiAddressEntity.Result.AddressComponent.City;
                        //            entity.ReceiveCounty = baiAddressEntity.Result.AddressComponent.District;
                        //        }
                        //    }
                        //}
                        entity.ReceiveDestination = entity.ReceiveProvince;
                        if (string.IsNullOrEmpty(entity.ReceiveDestination))
                        {
                            entity.ReceiveDestination = entity.ReceiveProvince;
                        }
                        //entity.ReceiveCompany = BaseBusinessLogic.ConvertToString(dr[31]);
                        //entity.ReceivePostcode = BaseBusinessLogic.ConvertToString(dr[32]);
                        //entity.GoodsName = BaseBusinessLogic.ConvertToString(dr[14]);
                        //entity.Weight = BaseBusinessLogic.ConvertToString(dr[15]);
                        //entity.TranFee = BaseBusinessLogic.ConvertToString(dr[16]);
                        //entity.Length = BaseBusinessLogic.ConvertToString(dr[33]);
                        //entity.Width = BaseBusinessLogic.ConvertToString(dr[34]);
                        //entity.Height = BaseBusinessLogic.ConvertToString(dr[35]);
                        //entity.TotalNumber = BaseBusinessLogic.ConvertToString(dr[36]);
                        entity.Remark      = BaseBusinessLogic.ConvertToString(dr[4]);
                        entity.OrderNumber = BaseBusinessLogic.ConvertToString(dr[3]);
                        entity.TranFee     = BaseBusinessLogic.ConvertToString(dr[5]);
                        entity.CreateOn    = DateTime.Now;
                        if (!ckGetServerPrintMark.Checked)
                        {
                            entity.BigPen = string.Format("{0} {1} {2}", entity.ReceiveProvince, entity.ReceiveCity, entity.ReceiveCounty);
                        }
                        else
                        {
                            entity.BigPen = "";
                        }
                        list.Add(entity);
                    }
                    if (!ckGetServerPrintMark.Checked)
                    {
                        var manager = new ZtoPrintBillManager(BillPrintHelper.DbHelper);
                        foreach (ZtoPrintBillEntity ztoPrintBillEntity in list)
                        {
                            manager.Add(ztoPrintBillEntity, true);
                        }
                        if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
                        {
                            splashScreenManagerImportExcel.CloseWaitForm();
                        }
                        GridDataBind();
                        var ts = DateTime.Now - startDateTime;
                        lblTime.Text = string.Format("耗时:{0}时{1}分{2}秒{3}毫秒", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
                        Close();
                    }
                    else
                    {
                        splashScreenManagerImportExcel.SetWaitFormDescription("正在联网获取大头笔信息");
                        if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
                        {
                            splashScreenManagerImportExcel.CloseWaitForm();
                        }
                        // 开线程去读取大头笔的
                        CheckBillCode(list);
                    }
                }
                else
                {
                    XtraMessageBox.Show(@"模板没有填写任何数据,导入失败", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
                return(false);
            }
            finally
            {
                if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
                {
                    splashScreenManagerImportExcel.CloseWaitForm();
                }
            }
            return(true);
        }
Exemplo n.º 19
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     GetFromExpand(dr);
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldSendPhone))
     {
         SendPhone = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldSendPhone]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldReceiveMan))
     {
         ReceiveMan = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldReceiveMan]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldCreateUserName))
     {
         CreateUserName = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldCreateUserName]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldModifiedSite))
     {
         ModifiedSite = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldModifiedSite]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldModifiedUserName))
     {
         ModifiedUserName = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldModifiedUserName]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldCreateOn))
     {
         CreateOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[ZtoPrintCancelEntity.FieldCreateOn]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldOrderNumber))
     {
         OrderNumber = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldOrderNumber]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldBillCode))
     {
         BillCode = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldBillCode]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldSendMan))
     {
         SendMan = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldSendMan]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldRemark))
     {
         Remark = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldRemark]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldModifiedOn))
     {
         ModifiedOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[ZtoPrintCancelEntity.FieldModifiedOn]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldCreateSite))
     {
         CreateSite = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldCreateSite]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldReceiveAddress))
     {
         ReceiveAddress = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldReceiveAddress]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldId))
     {
         Id = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldId]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldReceivePhone))
     {
         ReceivePhone = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldReceivePhone]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldSendAddress))
     {
         SendAddress = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldSendAddress]);
     }
     if (dr.ContainsColumn(ZtoPrintCancelEntity.FieldSendProvince))
     {
         SendProvince = BaseBusinessLogic.ConvertToString(dr[ZtoPrintCancelEntity.FieldSendProvince]);
     }
     return(this);
 }
Exemplo n.º 20
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     GetFromExpand(dr);
     if (dr.ContainsColumn(ZtoUserEntity.FieldId))
     {
         Id = BaseBusinessLogic.ConvertToDecimal(dr[ZtoUserEntity.FieldId]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldPostcode))
     {
         Postcode = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldPostcode]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldRealname))
     {
         Realname = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldRealname]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCreateUserName))
     {
         CreateUserName = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldCreateUserName]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCityId))
     {
         CityId = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldCityId]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldModifiedUserName))
     {
         ModifiedUserName = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldModifiedUserName]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCreateOn))
     {
         CreateOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[ZtoUserEntity.FieldCreateOn]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldDepartment))
     {
         Department = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldDepartment]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldProvince))
     {
         Province = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldProvince]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCounty))
     {
         County = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldCounty]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCountyId))
     {
         CountyId = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldCountyId]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldRemark))
     {
         Remark = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldRemark]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldModifiedOn))
     {
         ModifiedOn = BaseBusinessLogic.ConvertToNullableDateTime(dr[ZtoUserEntity.FieldModifiedOn]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldProvinceId))
     {
         ProvinceId = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldProvinceId]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCity))
     {
         City = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldCity]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldAddress))
     {
         Address = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldAddress]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldIssendorreceive))
     {
         Issendorreceive = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldIssendorreceive]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldTelePhone))
     {
         TelePhone = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldTelePhone]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldMobile))
     {
         Mobile = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldMobile]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldCompany))
     {
         Company = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldCompany]);
     }
     if (dr.ContainsColumn(ZtoUserEntity.FieldIsDefault))
     {
         IsDefault = BaseBusinessLogic.ConvertToString(dr[ZtoUserEntity.FieldIsDefault]);
     }
     return(this);
 }
Exemplo n.º 21
0
        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dr">数据行</param>
        protected override BaseEntity GetFrom(IDataRow dr)
        {
            Id           = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldId]);
            ParentId     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldParentId]);
            ParentName   = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldParentName]);
            Layer        = BaseBusinessLogic.ConvertToInt(dr[BaseOrganizeEntity.FieldLayer]);
            Code         = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCode]);
            FullName     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldFullName]);
            ShortName    = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldShortName]);
            StandardName = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldStandardName]);
            StandardCode = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldStandardCode]);

            QuickQuery     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldQuickQuery]);
            SimpleSpelling = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldSimpleSpelling]);
            CategoryCode   = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCategoryCode]);
            OuterPhone     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldOuterPhone]);
            InnerPhone     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldInnerPhone]);
            Fax            = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldFax]);
            Postalcode     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldPostalcode]);

            ProvinceId = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldProvinceId]);
            Province   = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldProvince]);
            CityId     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCityId]);
            City       = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCity]);
            DistrictId = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldDistrictId]);
            District   = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldDistrict]);
            StreetId   = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldStreetId]);
            Street     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldStreet]);

            Address         = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldAddress]);
            Web             = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldWeb]);
            IsInnerOrganize = BaseBusinessLogic.ConvertToInt(dr[BaseOrganizeEntity.FieldIsInnerOrganize]);
            Bank            = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldBank]);
            BankAccount     = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldBankAccount]);

            CompanyId   = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCompanyId]);
            CompanyCode = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCompanyCode]);
            CompanyName = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCompanyName]);

            if (dr.ContainsColumn(BaseOrganizeEntity.FieldCostCenterId))
            {
                CostCenterId = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCostCenterId]);
            }
            CostCenter = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCostCenter]);
            if (dr.ContainsColumn(BaseOrganizeEntity.FieldFinancialCenterId))
            {
                FinancialCenterId = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldFinancialCenterId]);
            }
            FinancialCenter = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldFinancialCenter]);
            if (dr.ContainsColumn(BaseOrganizeEntity.FieldManageId))
            {
                ManageId = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldManageId]);
            }
            if (dr.ContainsColumn(BaseOrganizeEntity.FieldManageName))
            {
                ManageName = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldManageName]);
            }
            Area           = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldArea]);
            JoiningMethods = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldJoiningMethods]);

            DeletionStateCode = BaseBusinessLogic.ConvertToInt(dr[BaseOrganizeEntity.FieldDeletionStateCode]);
            Enabled           = BaseBusinessLogic.ConvertToInt(dr[BaseOrganizeEntity.FieldEnabled]);
            SortCode          = BaseBusinessLogic.ConvertToInt(dr[BaseOrganizeEntity.FieldSortCode]);
            Description       = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldDescription]);
            CreateOn          = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseOrganizeEntity.FieldCreateOn]);
            CreateUserId      = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCreateUserId]);
            CreateBy          = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldCreateBy]);
            ModifiedOn        = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseOrganizeEntity.FieldModifiedOn]);
            ModifiedUserId    = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldModifiedUserId]);
            ModifiedBy        = BaseBusinessLogic.ConvertToString(dr[BaseOrganizeEntity.FieldModifiedBy]);
            // 获取扩展属性
            GetFromExpand(dr);
            return(this);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public BaseUserEntity GetFrom(IDataReader dataReader)
        {
            this.GetFromExpand(dataReader);
            this.Id             = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldId]);
            this.Code           = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldCode]);
            this.UserName       = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldUserName]);
            this.RealName       = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldRealName]);
            this.QuickQuery     = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldQuickQuery]);
            this.RoleId         = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldRoleId]);
            this.SecurityLevel  = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldSecurityLevel]);
            this.UserFrom       = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldUserFrom]);
            this.WorkCategory   = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldWorkCategory]);
            this.CompanyId      = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldCompanyId]);
            this.CompanyName    = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldCompanyName]);
            this.SubCompanyId   = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldSubCompanyId]);
            this.SubCompanyName = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldSubCompanyName]);
            this.DepartmentId   = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldDepartmentId]);
            this.DepartmentName = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldDepartmentName]);
            this.WorkgroupId    = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldWorkgroupId]);
            this.WorkgroupName  = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldWorkgroupName]);
            this.Gender         = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldGender]);
            this.Mobile         = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldMobile]);
            this.Telephone      = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldTelephone]);

            this.Birthday              = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldBirthday]);
            this.Duty                  = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldDuty]);
            this.Title                 = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldTitle]);
            this.UserPassword          = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldUserPassword]);
            this.ChangePasswordDate    = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldChangePasswordDate]);
            this.CommunicationPassword = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldCommunicationPassword]);
            this.SignedPassword        = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldSignedPassword]);
            this.PublicKey             = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldPublicKey]);
            this.OICQ                  = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldOICQ]);
            this.Email                 = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldEmail]);
            this.Lang                  = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldLang]);
            this.Theme                 = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldTheme]);

            this.AllowStartTime = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldAllowStartTime]);
            this.AllowEndTime   = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldAllowEndTime]);
            this.LockStartDate  = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldLockStartDate]);
            this.LockEndDate    = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldLockEndDate]);

            this.FirstVisit        = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldFirstVisit]);
            this.PreviousVisit     = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldPreviousVisit]);
            this.LastVisit         = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldLastVisit]);
            this.LogOnCount        = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldLogOnCount]);
            this.IsStaff           = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldIsStaff]);
            this.AuditStatus       = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldAuditStatus]);
            this.IsVisible         = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldIsVisible]);
            this.UserOnLine        = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldUserOnLine]);
            this.IPAddress         = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldIPAddress]);
            this.MACAddress        = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldMACAddress]);
            this.OpenId            = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldOpenId]);
            this.Question          = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldQuestion]);
            this.AnswerQuestion    = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldAnswerQuestion]);
            this.UserAddressId     = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldUserAddressId]);
            this.DeletionStateCode = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldDeletionStateCode]);
            this.Enabled           = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldEnabled]);
            this.SortCode          = BaseBusinessLogic.ConvertToInt(dataReader[BaseUserEntity.FieldSortCode]);
            this.Description       = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldDescription]);
            this.CreateOn          = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldCreateOn]);
            this.CreateUserId      = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldCreateUserId]);
            this.CreateBy          = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldCreateBy]);
            this.ModifiedOn        = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseUserEntity.FieldModifiedOn]);
            this.ModifiedUserId    = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldModifiedUserId]);
            this.ModifiedBy        = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldModifiedBy]);
            this.Signature         = BaseBusinessLogic.ConvertToString(dataReader[BaseUserEntity.FieldSignature]);
            return(this);
        }
Exemplo n.º 23
0
 /// <summary>
 /// 从数据流读取
 /// </summary>
 /// <param name="dataReader">数据流</param>
 public BaseStaffEntity GetFrom(IDataReader dataReader)
 {
     this.GetFromExpand(dataReader);;
     this.Id                 = BaseBusinessLogic.ConvertToInt(dataReader[BaseStaffEntity.FieldId]);
     this.UserId             = BaseBusinessLogic.ConvertToInt(dataReader[BaseStaffEntity.FieldUserId]);
     this.UserName           = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldUserName]);
     this.RealName           = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldRealName]);
     this.Code               = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCode]);
     this.Gender             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldGender]);
     this.SubCompanyId       = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldSubCompanyId]);
     this.CompanyId          = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCompanyId]);
     this.DepartmentId       = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDepartmentId]);
     this.WorkgroupId        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldWorkgroupId]);
     this.QuickQuery         = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldQuickQuery]);
     this.DutyId             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDutyId]);
     this.IdentificationCode = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldIdentificationCode]);
     this.IDCard             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldIDCard]);
     this.BankCode           = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldBankCode]);
     this.Email              = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldEmail]);
     this.Mobile             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldMobile]);
     this.ShortNumber        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldShortNumber]);
     this.Telephone          = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldTelephone]);
     this.OICQ               = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldOICQ]);
     this.OfficePhone        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldOfficePhone]);
     this.OfficeZipCode      = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldOfficeZipCode]);
     this.OfficeAddress      = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldOfficeAddress]);
     this.OfficeFax          = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldOfficeFax]);
     this.Age                = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldAge]);
     this.Birthday           = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldBirthday]);
     this.Education          = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldEducation]);
     this.School             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldSchool]);
     this.GraduationDate     = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldGraduationDate]);
     this.Major              = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldMajor]);
     this.Degree             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDegree]);
     this.TitleId            = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldTitleId]);
     this.TitleDate          = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldTitleDate]);
     this.TitleLevel         = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldTitleLevel]);
     this.WorkingDate        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldWorkingDate]);
     this.JoinInDate         = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldJoinInDate]);
     this.HomeZipCode        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldHomeZipCode]);
     this.HomeAddress        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldHomeAddress]);
     this.HomePhone          = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldHomePhone]);
     this.HomeFax            = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldHomeFax]);
     this.Province           = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldProvince]);
     this.CarCode            = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCarCode]);
     this.City               = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCity]);
     this.Area               = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldArea]);
     this.NativePlace        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldNativePlace]);
     this.Party              = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldParty]);
     this.Nation             = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldNation]);
     this.Nationality        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldNationality]);
     this.WorkingProperty    = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldWorkingProperty]);
     this.Competency         = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCompetency]);
     this.EmergencyContact   = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldEmergencyContact]);
     this.IsDimission        = BaseBusinessLogic.ConvertToInt(dataReader[BaseStaffEntity.FieldIsDimission]);
     this.DimissionDate      = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDimissionDate]);
     this.DimissionCause     = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDimissionCause]);
     this.DimissionWhither   = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDimissionWhither]);
     this.Enabled            = BaseBusinessLogic.ConvertToInt(dataReader[BaseStaffEntity.FieldEnabled]);
     this.DeletionStateCode  = BaseBusinessLogic.ConvertToInt(dataReader[BaseStaffEntity.FieldDeletionStateCode]);
     this.SortCode           = BaseBusinessLogic.ConvertToInt(dataReader[BaseStaffEntity.FieldSortCode]);
     this.Description        = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldDescription]);
     this.CreateOn           = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseStaffEntity.FieldCreateOn]);
     this.CreateUserId       = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCreateUserId]);
     this.CreateBy           = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldCreateBy]);
     this.ModifiedOn         = BaseBusinessLogic.ConvertToDateTime(dataReader[BaseStaffEntity.FieldModifiedOn]);
     this.ModifiedUserId     = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldModifiedUserId]);
     this.ModifiedBy         = BaseBusinessLogic.ConvertToString(dataReader[BaseStaffEntity.FieldModifiedBy]);
     return(this);
 }
Exemplo n.º 24
0
 /// <summary>
 /// 从数据行读取
 /// </summary>
 /// <param name="dr">数据行</param>
 protected override BaseEntity GetFrom(IDataRow dr)
 {
     Id             = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldId]);
     UserFrom       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldUserFrom]);
     Code           = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCode]);
     UserName       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldUserName]);
     NickName       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldNickName]);
     RealName       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldRealName]);
     QuickQuery     = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldQuickQuery]);
     SimpleSpelling = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldSimpleSpelling]);
     SecurityLevel  = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldSecurityLevel]);
     WorkCategory   = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldWorkCategory]);
     CompanyId      = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCompanyId]);
     // 2015-12-29 吉日嘎拉 防止程序出错,没有这个字段也可以正常运行
     if (dr.ContainsColumn(BaseUserEntity.FieldCompanyCode))
     {
         CompanyCode = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCompanyCode]);
     }
     CompanyName       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCompanyName]);
     SubCompanyId      = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldSubCompanyId]);
     SubCompanyName    = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldSubCompanyName]);
     DepartmentId      = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldDepartmentId]);
     DepartmentName    = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldDepartmentName]);
     SubDepartmentId   = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldSubDepartmentId]);
     SubDepartmentName = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldSubDepartmentName]);
     WorkgroupId       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldWorkgroupId]);
     WorkgroupName     = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldWorkgroupName]);
     IDCard            = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldIDCard]);
     Gender            = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldGender]);
     Birthday          = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldBirthday]);
     Duty               = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldDuty]);
     Title              = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldTitle]);
     Province           = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldProvince]);
     City               = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCity]);
     District           = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldDistrict]);
     HomeAddress        = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldHomeAddress]);
     Score              = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldScore]);
     IsAdministrator    = BaseBusinessLogic.ConvertToBoolean(dr[BaseUserEntity.FieldIsAdministrator]);
     Lang               = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldLang]);
     Theme              = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldTheme]);
     Signature          = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldSignature]);
     IsStaff            = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldIsStaff]);
     IsCheckBalance     = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldIsCheckBalance]);
     AuditStatus        = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldAuditStatus]);
     ManagerId          = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldManagerId]);
     ManagerAuditStatus = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldManagerAuditStatus]);
     ManagerAuditDate   = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseUserEntity.FieldManagerAuditDate]);
     IsVisible          = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldIsVisible]);
     DeletionStateCode  = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldDeletionStateCode]);
     Enabled            = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldEnabled]);
     SortCode           = BaseBusinessLogic.ConvertToInt(dr[BaseUserEntity.FieldSortCode]);
     Description        = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldDescription]);
     CreateOn           = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseUserEntity.FieldCreateOn]);
     CreateUserId       = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCreateUserId]);
     CreateBy           = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldCreateBy]);
     ModifiedOn         = BaseBusinessLogic.ConvertToNullableDateTime(dr[BaseUserEntity.FieldModifiedOn]);
     ModifiedUserId     = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldModifiedUserId]);
     ModifiedBy         = BaseBusinessLogic.ConvertToString(dr[BaseUserEntity.FieldModifiedBy]);
     // 获取扩展属性
     GetFromExpand(dr);
     return(this);
 }
Exemplo n.º 25
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="entity">实体</param>
        public static int LogOnStatistics()
        {
            int result = 0;

            bool update = false;
            int  i      = 0;

            // 电脑登录系统、没有登记过的,全部登记上来。
            BaseOrganizeLogOnEntity organizeLogOnEntity = null;
            string sqlQuery = string.Empty;

            sqlQuery = @"SELECT u.companyid id
                                , MIN(l.firstvisit) firstvisit
                                , MAX(l.lastvisit) lastvisit 
                           FROM baseuserlogon l
                                , baseuser u 
                          WHERE l.id = u.id 
                          GROUP BY u.companyid";

            BaseOrganizeLogOnManager organizeLogOnManager = new BaseOrganizeLogOnManager();
            BaseOrganizeLogOnManager manager = new BaseOrganizeLogOnManager();

            using (IDataReader dataReader = manager.ExecuteReader(sqlQuery))
            {
                while (dataReader.Read())
                {
                    i++;
                    string id = BaseBusinessLogic.ConvertToString(dataReader[BaseOrganizeLogOnEntity.FieldId]);

                    DateTime?firstVisit = BaseBusinessLogic.ConvertToNullableDateTime(dataReader[BaseOrganizeLogOnEntity.FieldFirstVisit]);
                    DateTime?lastVisit  = BaseBusinessLogic.ConvertToNullableDateTime(dataReader[BaseOrganizeLogOnEntity.FieldLastVisit]);
                    organizeLogOnEntity = organizeLogOnManager.GetObject(id);
                    if (organizeLogOnEntity == null)
                    {
                        organizeLogOnEntity            = new BaseOrganizeLogOnEntity();
                        organizeLogOnEntity.Id         = id;
                        organizeLogOnEntity.FirstVisit = firstVisit;
                        organizeLogOnEntity.LastVisit  = lastVisit;
                        organizeLogOnManager.AddObject(organizeLogOnEntity);
                    }
                    else
                    {
                        update = false;
                        if (firstVisit.HasValue)
                        {
                            if (organizeLogOnEntity.FirstVisit == null || organizeLogOnEntity.FirstVisit > firstVisit)
                            {
                                organizeLogOnEntity.FirstVisit = firstVisit;
                                update = true;
                            }
                        }
                        if (lastVisit.HasValue)
                        {
                            if (organizeLogOnEntity.LastVisit == null || organizeLogOnEntity.LastVisit < lastVisit)
                            {
                                organizeLogOnEntity.LastVisit = lastVisit;
                                update = true;
                            }
                        }
                        if (update)
                        {
                            organizeLogOnManager.UpdateObject(organizeLogOnEntity);
                        }
                    }
                    if (update)
                    {
                        System.Console.WriteLine("第 " + i.ToString() + " companyid : " + id);
                    }
                    else
                    {
                        System.Console.WriteLine("第 " + i.ToString());
                    }
                }
                dataReader.Close();
            }

            // 巴枪登录系统、没有登记过的,全部登记上来。
            sqlQuery = @"SELECT u.companyid id
                                , MIN(l.firstvisit) firstvisit
                                , MAX(l.lastvisit) lastvisit 
                           FROM pdauserlogon l
                                , baseuser u 
                          WHERE l.id = u.id 
                          GROUP BY u.companyid";
            using (IDataReader dataReader = manager.ExecuteReader(sqlQuery))
            {
                i = 0;
                while (dataReader.Read())
                {
                    i++;
                    string   id         = BaseBusinessLogic.ConvertToString(dataReader[BaseOrganizeLogOnEntity.FieldId]);
                    DateTime?firstVisit = BaseBusinessLogic.ConvertToNullableDateTime(dataReader[BaseOrganizeLogOnEntity.FieldFirstVisit]);
                    DateTime?lastVisit  = BaseBusinessLogic.ConvertToNullableDateTime(dataReader[BaseOrganizeLogOnEntity.FieldLastVisit]);
                    organizeLogOnEntity = organizeLogOnManager.GetObject(id);
                    if (organizeLogOnEntity == null)
                    {
                        organizeLogOnEntity            = new BaseOrganizeLogOnEntity();
                        organizeLogOnEntity.Id         = id;
                        organizeLogOnEntity.FirstVisit = firstVisit;
                        organizeLogOnEntity.LastVisit  = lastVisit;
                        organizeLogOnManager.Add(organizeLogOnEntity);
                    }
                    else
                    {
                        update = false;
                        if (firstVisit.HasValue)
                        {
                            if (organizeLogOnEntity.FirstVisit == null || organizeLogOnEntity.FirstVisit > firstVisit)
                            {
                                organizeLogOnEntity.FirstVisit = firstVisit;
                                update = true;
                            }
                        }
                        if (lastVisit.HasValue)
                        {
                            if (organizeLogOnEntity.LastVisit == null || organizeLogOnEntity.LastVisit < lastVisit)
                            {
                                organizeLogOnEntity.LastVisit = lastVisit;
                                update = true;
                            }
                        }
                        organizeLogOnManager.UpdateObject(organizeLogOnEntity);
                    }

                    if (update)
                    {
                        System.Console.WriteLine("第 " + i.ToString() + " companyid : " + id);
                    }
                    else
                    {
                        System.Console.WriteLine("第 " + i.ToString());
                    }
                }
                dataReader.Close();
            }

            System.Console.WriteLine("公司整体登录状态已经更新完毕。");

            return(result);
        }
Exemplo n.º 26
0
 /// <summary>
 /// 导入Excel数据到本地数据库
 /// </summary>
 public bool Import()
 {
     if (string.IsNullOrEmpty(txtFileFullPath.Text.Trim()))
     {
         XtraMessageBox.Show(@"请选择淘宝订单Excel", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnOpenExcel_Click(this, null);
         return(false);
     }
     if (!File.Exists(txtFileFullPath.Text))
     {
         XtraMessageBox.Show(@"选中文件不存在,请重新选择导入Excel文件", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnOpenExcel_Click(this, null);
         return(false);
     }
     #region 检查是否选择了发件人
     ZtoUserEntity defaultUserEntity = null;
     if (ckUserDefaultSendMan.Checked)
     {
         // 获取到默认的发件人
         var defaultUserList = new ZtoUserManager(BillPrintHelper.DbHelper).GetList <ZtoUserEntity>(new KeyValuePair <string, object>(ZtoUserEntity.FieldIsDefault, 1), new KeyValuePair <string, object>(ZtoUserEntity.FieldIssendorreceive, 1));
         if (defaultUserList.Any())
         {
             defaultUserEntity = defaultUserList.FirstOrDefault();
             if (defaultUserEntity == null)
             {
                 XtraMessageBox.Show(@"请添加一个默认的发件人,然后再导入订单数据", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 return(false);
             }
         }
         else
         {
             XtraMessageBox.Show(@"请添加一个默认的发件人,然后再导入订单数据", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             return(false);
         }
     }
     else
     {
         if (this.Tag != null)
         {
             defaultUserEntity = this.Tag as ZtoUserEntity;
             // 表示选择了一个发件人的信息,这样也不用读取Excel里面的发件人了
             if (defaultUserEntity == null)
             {
                 XtraMessageBox.Show(@"请重新选择一个发件人,然后再导入订单数据", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 ckChooseSendMan.Checked = true;
                 Import();
             }
         }
         else
         {
             XtraMessageBox.Show(@"请选择一个发件人,然后再导入订单数据", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             ckChooseSendMan.Checked = true;
             Import();
         }
     }
     #endregion
     var startDateTime = DateTime.Now;
     StartDt = startDateTime;
     if (!splashScreenManagerImportExcel.IsSplashFormVisible)
     {
         splashScreenManagerImportExcel.ShowWaitForm();
     }
     Application.DoEvents();
     splashScreenManagerImportExcel.SetWaitFormCaption("请稍后");
     splashScreenManagerImportExcel.SetWaitFormDescription("开始导入淘宝订单Excel数据...");
     try
     {
         DataTable chooseDt;
         if (Path.GetExtension(txtFileFullPath.Text) == ".csv")
         {
             var readCsv = new ReadCsvHelper(txtFileFullPath.Text);
             readCsv.CreateTable();
             chooseDt = readCsv.GetResoultTable();
         }
         else
         {
             chooseDt = ExcelHelper.ExcelToDataTable(txtFileFullPath.Text, 0, null);
         }
         if (chooseDt != null && chooseDt.Rows.Count > 0)
         {
             var list = new List <ZtoPrintBillEntity>();
             int temp = 0;
             foreach (DataRow dr in chooseDt.Rows)
             {
                 ++temp;
                 splashScreenManagerImportExcel.SetWaitFormDescription(string.Format("正在导入Excel数据:{0}/{1}", temp, chooseDt.Rows.Count));
                 var entity = new ZtoPrintBillEntity();
                 if (ckTodaySend.Checked)
                 {
                     entity.SendDate = DateTime.Now.ToString(BaseSystemInfo.DateFormat);
                 }
                 if (defaultUserEntity != null)
                 {
                     entity.SendMan        = defaultUserEntity.Realname;
                     entity.SendPhone      = defaultUserEntity.Mobile + " " + defaultUserEntity.TelePhone;
                     entity.SendProvince   = defaultUserEntity.Province;
                     entity.SendCity       = defaultUserEntity.City;
                     entity.SendCounty     = defaultUserEntity.County;
                     entity.SendAddress    = defaultUserEntity.Address;
                     entity.SendCompany    = defaultUserEntity.Company;
                     entity.SendDepartment = defaultUserEntity.Department;
                     entity.SendPostcode   = defaultUserEntity.Postcode;
                 }
                 entity.SendSite        = "";
                 entity.SendDeparture   = entity.SendProvince;
                 entity.ReceiveMan      = BaseBusinessLogic.ConvertToString(dr[12]);
                 entity.ReceivePhone    = BaseBusinessLogic.ConvertToString(dr[16]);
                 entity.ReceiveProvince = "";
                 entity.ReceiveCity     = "";
                 entity.ReceiveCounty   = "";
                 entity.ReceiveAddress  = BaseBusinessLogic.ConvertToString(dr[13]).Replace(" ", "");
                 // 目的地
                 entity.ReceiveDestination = "";
                 if (string.IsNullOrEmpty(entity.ReceiveDestination))
                 {
                     entity.ReceiveDestination = entity.ReceiveProvince;
                 }
                 entity.ReceiveCompany  = "";
                 entity.ReceivePostcode = "";
                 entity.GoodsName       = BaseBusinessLogic.ConvertToString(dr[19]);
                 entity.Weight          = "";
                 entity.TranFee         = "";
                 entity.GOODS_PAYMENT   = 0;
                 entity.TOPAYMENT       = 0;
                 entity.Length          = "";
                 entity.Width           = "";
                 entity.Height          = "";
                 entity.TotalNumber     = "";
                 entity.OrderNumber     = BaseBusinessLogic.ConvertToString(dr[0]);
                 entity.Remark          = BaseBusinessLogic.ConvertToString(dr[23]);
                 entity.CreateUserName  = "";
                 entity.CreateSite      = "";
                 entity.CreateOn        = DateTime.Now;
                 entity.PaymentType     = "";
                 // 如果Excel里面没有填写订单号系统自动生成一个订单号,这样提取电子面单单号就不用怕了,2016-1-23 14:07:12
                 if (string.IsNullOrEmpty(entity.OrderNumber))
                 {
                     // 导入自动生成订单号(电子面单)79170-南昌昌南  18779176845 这个qq提供的思路,2016-1-20 20:08:50
                     entity.OrderNumber = Guid.NewGuid().ToString("N").ToLower();
                 }
                 if (!ckGetServerPrintMark.Checked)
                 {
                     entity.BigPen = string.Format("{0} {1} {2}", entity.ReceiveProvince, entity.ReceiveCity, entity.ReceiveCounty);
                 }
                 else
                 {
                     entity.BigPen = "";
                 }
                 list.Add(entity);
             }
             if (!ckGetServerPrintMark.Checked)
             {
                 var manager = new ZtoPrintBillManager(BillPrintHelper.DbHelper);
                 foreach (ZtoPrintBillEntity ztoPrintBillEntity in list)
                 {
                     manager.Add(ztoPrintBillEntity, true);
                 }
                 if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
                 {
                     splashScreenManagerImportExcel.CloseWaitForm();
                 }
                 GridDataBind();
                 Close();
             }
             else
             {
                 splashScreenManagerImportExcel.SetWaitFormDescription("正在联网获取大头笔信息,请稍后......");
                 // 开线程去读取大头笔的
                 CheckBillCode(list);
             }
         }
         else
         {
             XtraMessageBox.Show(@"模板没有填写任何数据,导入失败", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
         return(false);
     }
     finally
     {
         if (splashScreenManagerImportExcel != null && splashScreenManagerImportExcel.IsSplashFormVisible)
         {
             splashScreenManagerImportExcel.CloseWaitForm();
         }
     }
     return(true);
 }