Esempio n. 1
0
 /// <summary>
 /// 合同关联的设备信息
 /// </summary>
 public ContractEqptInfo()
 {
     this.Equipment = new EquipmentInfo();
 }
Esempio n. 2
0
 /// <summary>
 /// 请求关联设备信息
 /// </summary>
 public RequestEqptInfo()
 {
     this.Equipment = new EquipmentInfo();
 }
Esempio n. 3
0
        /// <summary>
        /// 修改设备信息
        /// </summary>
        /// <param name="newInfo">设备信息</param>
        /// <returns>设备信息</returns>
        public DataTable GetChangedFields(EquipmentInfo newInfo)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("FieldName");
            dt.Columns.Add("OldValue");
            dt.Columns.Add("NewValue");

            if (this.EquipmentLevel.ID != newInfo.EquipmentLevel.ID)
            {
                dt.Rows.Add("EquipmentLevelDesc", this.EquipmentLevel.Name, EquipmentLevels.GetEquipmentLevelDesc(newInfo.EquipmentLevel.ID));
            }

            if (this.Name != SQLUtil.TrimNull(newInfo.Name))
            {
                dt.Rows.Add("EquipmentName", this.Name, newInfo.Name);
            }

            if (this.EquipmentCode != SQLUtil.TrimNull(newInfo.EquipmentCode))
            {
                dt.Rows.Add("EquipmentCode", this.EquipmentCode, newInfo.EquipmentCode);
            }

            if (this.SerialCode != SQLUtil.TrimNull(newInfo.SerialCode))
            {
                dt.Rows.Add("SerialCode", this.SerialCode, newInfo.SerialCode);
            }

            if (this.Manufacturer.ID != newInfo.Manufacturer.ID)
            {
                dt.Rows.Add("EquipmentManufacturerName", this.Manufacturer.Name, newInfo.Manufacturer.Name);
            }

            if (this.EquipmentClass1.Code != SQLUtil.TrimNull(newInfo.EquipmentClass1.Code))
            {
                dt.Rows.Add("EquipmentClass1Name", this.EquipmentClass1.Description, Manager.LookupManager.GetEquipmentClassDesc(newInfo.EquipmentClass1.Code, 1));
            }

            if (this.EquipmentClass2.Code != SQLUtil.TrimNull(newInfo.EquipmentClass2.Code) || this.EquipmentClass1.Code != SQLUtil.TrimNull(newInfo.EquipmentClass1.Code))
            {
                dt.Rows.Add("EquipmentClass2Name", this.EquipmentClass2.Description, Manager.LookupManager.GetEquipmentClassDesc(newInfo.EquipmentClass2.Code, 2, newInfo.EquipmentClass1.Code));
            }

            if (this.EquipmentClass3.Code != SQLUtil.TrimNull(newInfo.EquipmentClass3.Code) || (this.EquipmentClass2.Code != SQLUtil.TrimNull(newInfo.EquipmentClass2.Code) || this.EquipmentClass1.Code != SQLUtil.TrimNull(newInfo.EquipmentClass1.Code)))
            {
                dt.Rows.Add("EquipmentClass3Name", this.EquipmentClass3.Description, Manager.LookupManager.GetEquipmentClassDesc(newInfo.EquipmentClass3.Code, 3, newInfo.EquipmentClass1.Code + newInfo.EquipmentClass2.Code));
            }

            if (this.ResponseTimeLength != newInfo.ResponseTimeLength)
            {
                dt.Rows.Add("ResponseTimeLength", this.ResponseTimeLength, newInfo.ResponseTimeLength);
            }

            if (this.ServiceScope != newInfo.ServiceScope)
            {
                dt.Rows.Add("ServiceScopeDesc", SQLUtil.ConvertBoolean(this.ServiceScope) ? "是" : "否", SQLUtil.ConvertBoolean(newInfo.ServiceScope) ? "是" : "否");
            }

            if (this.Brand != SQLUtil.TrimNull(newInfo.Brand))
            {
                dt.Rows.Add("Brand", this.Brand, newInfo.Brand == null ? "" : newInfo.Brand);
            }

            if (this.Comments != SQLUtil.TrimNull(newInfo.Comments))
            {
                dt.Rows.Add("EquipmentComments", this.Comments, newInfo.Comments == null ? "" : newInfo.Comments);
            }

            if (this.ManufacturingDate != newInfo.ManufacturingDate)
            {
                dt.Rows.Add("ManufacturingDate", SQLUtil.ConvertDateTime(this.ManufacturingDate) == DateTime.MinValue ? "" : this.ManufacturingDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.ManufacturingDate) == DateTime.MinValue ? "" : newInfo.ManufacturingDate.ToString("yyyy-MM-dd"));
            }

            if (this.FixedAsset != newInfo.FixedAsset)
            {
                dt.Rows.Add("FixedAsset", SQLUtil.ConvertBoolean(this.FixedAsset) ? "是" : "否", SQLUtil.ConvertBoolean(newInfo.FixedAsset) ? "是" : "否");
            }

            if (this.AssetCode != SQLUtil.TrimNull(newInfo.AssetCode))
            {
                dt.Rows.Add("AssetCode", this.AssetCode, newInfo.AssetCode);
            }

            if (this.AssetLevel.ID != newInfo.AssetLevel.ID)
            {
                dt.Rows.Add("AssetLevel", this.AssetLevel.Name, AssetLevels.GetAssetLevelDesc(newInfo.AssetLevel.ID));
            }

            if (this.DepreciationYears != newInfo.DepreciationYears)
            {
                dt.Rows.Add("DepreciationYears", this.DepreciationYears, newInfo.DepreciationYears);
            }

            if (this.ValidityStartDate != newInfo.ValidityStartDate)
            {
                dt.Rows.Add("ValidityStartDate", SQLUtil.ConvertDateTime(this.ValidityStartDate) == DateTime.MinValue ? "" : this.ValidityStartDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.ValidityStartDate) == DateTime.MinValue ? "" : newInfo.ValidityStartDate.ToString("yyyy-MM-dd"));
            }

            if (this.ValidityEndDate != newInfo.ValidityEndDate)
            {
                dt.Rows.Add("ValidityEndDate", SQLUtil.ConvertDateTime(this.ValidityEndDate) == DateTime.MinValue ? "" : this.ValidityEndDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.ValidityEndDate) == DateTime.MinValue ? "" : newInfo.ValidityEndDate.ToString("yyyy-MM-dd"));
            }

            if (this.SaleContractName != SQLUtil.TrimNull(newInfo.SaleContractName))
            {
                dt.Rows.Add("SaleContractName", this.SaleContractName, newInfo.SaleContractName == null ? "" : newInfo.SaleContractName);
            }

            if (this.Supplier.ID != newInfo.Supplier.ID)
            {
                dt.Rows.Add("DealerName", this.Supplier.Name, newInfo.Supplier.Name);
            }

            if (this.PurchaseWay != SQLUtil.TrimNull(newInfo.PurchaseWay))
            {
                dt.Rows.Add("PurchaseWay", this.PurchaseWay, newInfo.PurchaseWay == null ? "" : newInfo.PurchaseWay);
            }

            if (this.PurchaseAmount != newInfo.PurchaseAmount)
            {
                dt.Rows.Add("EquipmentPurchaseAmount", this.PurchaseAmount, newInfo.PurchaseAmount == null ? 0 : newInfo.PurchaseAmount);
            }

            if (this.PurchaseDate != newInfo.PurchaseDate)
            {
                dt.Rows.Add("PurchaseDate", SQLUtil.ConvertDateTime(this.PurchaseDate) == DateTime.MinValue ? "" : this.PurchaseDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.PurchaseDate) == DateTime.MinValue ? "" : newInfo.PurchaseDate.ToString("yyyy-MM-dd"));
            }

            if (this.IsImport != newInfo.IsImport)
            {
                dt.Rows.Add("IsImport", SQLUtil.ConvertBoolean(this.IsImport) ? "国产" : "进口", SQLUtil.ConvertBoolean(newInfo.IsImport) ? "国产" : "进口");
            }

            if (this.Department.ID != newInfo.Department.ID)
            {
                dt.Rows.Add("DepartmentName", this.Department.Name, Manager.LookupManager.GetDepartmentDesc(newInfo.Department.ID));
            }

            if (this.InstalSite != SQLUtil.TrimNull(newInfo.InstalSite))
            {
                dt.Rows.Add("InstalSite", this.InstalSite, newInfo.InstalSite == null ? "" : newInfo.InstalSite);
            }

            if (this.InstalDate != newInfo.InstalDate)
            {
                dt.Rows.Add("InstalDate", SQLUtil.ConvertDateTime(this.InstalDate) == DateTime.MinValue ? "" : this.InstalDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.InstalDate) == DateTime.MinValue ? "" : newInfo.InstalDate.ToString("yyyy-MM-dd"));
            }

            if (this.UseageDate != newInfo.UseageDate)
            {
                dt.Rows.Add("UseageDate", SQLUtil.ConvertDateTime(this.UseageDate) == DateTime.MinValue ? "" : this.UseageDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.UseageDate) == DateTime.MinValue ? "" : newInfo.UseageDate.ToString("yyyy-MM-dd"));
            }

            if (this.Accepted != newInfo.Accepted)
            {
                dt.Rows.Add("Accepted", SQLUtil.ConvertBoolean(this.Accepted) ? "已验收" : "未验收", SQLUtil.ConvertBoolean(newInfo.Accepted) ? "已验收" : "未验收");
            }

            if (this.AcceptanceDate != newInfo.AcceptanceDate)
            {
                dt.Rows.Add("AcceptanceDate", SQLUtil.ConvertDateTime(this.AcceptanceDate) == DateTime.MinValue ? "" : this.AcceptanceDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.AcceptanceDate) == DateTime.MinValue ? "" : newInfo.AcceptanceDate.ToString("yyyy-MM-dd"));
            }

            if (this.UsageStatus.ID != newInfo.UsageStatus.ID)
            {
                dt.Rows.Add("UsageStatusDesc", this.UsageStatus.Name, Manager.LookupManager.GetUsageStatusDesc(newInfo.UsageStatus.ID));
            }

            if (this.EquipmentStatus.ID != newInfo.EquipmentStatus.ID)
            {
                dt.Rows.Add("EquipmentStatusDesc", this.EquipmentStatus.Name, Manager.LookupManager.GetEquipmentStatusDesc(newInfo.EquipmentStatus.ID));
            }

            if (this.ScrapDate != newInfo.ScrapDate)
            {
                dt.Rows.Add("ScrapDate", SQLUtil.ConvertDateTime(this.ScrapDate) == DateTime.MinValue ? "" : this.ScrapDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.ScrapDate) == DateTime.MinValue ? "" : newInfo.ScrapDate.ToString("yyyy-MM-dd"));
            }

            if (this.MaintenancePeriod != newInfo.MaintenancePeriod || this.MaintenanceType.ID != newInfo.MaintenanceType.ID)
            {
                dt.Rows.Add("MaintenancePeriod", this.MaintenancePeriod == 0 ? "无保养" : this.MaintenancePeriod + this.MaintenanceType.Name, newInfo.MaintenancePeriod == 0 ? "无保养" : SQLUtil.ConvertInt(newInfo.MaintenancePeriod) + Manager.LookupManager.GetPeriodTypeDesc(newInfo.MaintenanceType.ID));
            }

            if (this.PatrolPeriod != newInfo.PatrolPeriod || this.PatrolType.ID != newInfo.PatrolType.ID)
            {
                dt.Rows.Add("PatrolPeriod", this.PatrolPeriod == 0 ? "无巡检" : this.PatrolPeriod + this.PatrolType.Name, newInfo.PatrolPeriod == 0 ? "无巡检" : newInfo.PatrolPeriod + Manager.LookupManager.GetPeriodTypeDesc(newInfo.PatrolType.ID));
            }

            if (this.CorrectionPeriod != newInfo.CorrectionPeriod || this.CorrectionType.ID != newInfo.CorrectionType.ID)
            {
                dt.Rows.Add("CorrectionPeriod", this.CorrectionPeriod == 0 ? "无校准" : this.CorrectionPeriod + this.CorrectionType.Name, newInfo.CorrectionPeriod == 0 ? "无校准" : newInfo.CorrectionPeriod + Manager.LookupManager.GetPeriodTypeDesc(newInfo.CorrectionType.ID));
            }

            if (this.MandatoryTestStatus.ID != newInfo.MandatoryTestStatus.ID)
            {
                dt.Rows.Add("MandatoryTestStatusDesc", this.MandatoryTestStatus.Name, MandatoryTestStatuses.GetMandatoryTestStatusDesc(newInfo.MandatoryTestStatus.ID));
            }

            if (this.MandatoryTestDate != newInfo.MandatoryTestDate)
            {
                dt.Rows.Add("MandatoryTestDate", SQLUtil.ConvertDateTime(this.MandatoryTestDate) == DateTime.MinValue ? "" : this.MandatoryTestDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.MandatoryTestDate) == DateTime.MinValue ? "" : newInfo.MandatoryTestDate.ToString("yyyy-MM-dd"));
            }

            if (this.RecallFlag != newInfo.RecallFlag)
            {
                dt.Rows.Add("RecallFlag", SQLUtil.ConvertBoolean(this.RecallFlag) ? "是" : "否", SQLUtil.ConvertBoolean(newInfo.RecallFlag) ? "是" : "否");
            }

            if (this.RecallDate != newInfo.RecallDate)
            {
                dt.Rows.Add("RecallDate", SQLUtil.ConvertDateTime(this.RecallDate) == DateTime.MinValue ? "" : this.RecallDate.ToString("yyyy-MM-dd"), SQLUtil.ConvertDateTime(newInfo.RecallDate) == DateTime.MinValue ? "" : newInfo.RecallDate.ToString("yyyy-MM-dd"));
            }

            return(dt);
        }