20220315 代码初始化上传
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class BeanUtil
|
||||
{
|
||||
public static T CopyOjbect<T>(T obj,bool hasProperty)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
T targetDeepCopyObj;
|
||||
Type targetType = obj.GetType();
|
||||
//值类型
|
||||
if (targetType.IsValueType == true)
|
||||
{
|
||||
targetDeepCopyObj = obj;
|
||||
}
|
||||
//引用类型
|
||||
else
|
||||
{
|
||||
targetDeepCopyObj = (T)System.Activator.CreateInstance(targetType); //创建引用对象
|
||||
System.Reflection.MemberInfo[] memberCollection = obj.GetType().GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
|
||||
foreach (System.Reflection.MemberInfo member in memberCollection)
|
||||
{
|
||||
//拷贝字段
|
||||
if (member.MemberType == System.Reflection.MemberTypes.Field)
|
||||
{
|
||||
System.Reflection.FieldInfo field = (System.Reflection.FieldInfo)member;
|
||||
Object fieldValue = field.GetValue(obj);
|
||||
|
||||
if (fieldValue is ICloneable)
|
||||
{
|
||||
field.SetValue(targetDeepCopyObj, (fieldValue as ICloneable).Clone());
|
||||
}
|
||||
else if (fieldValue!=null&&fieldValue.GetType() == typeof(DateTime))
|
||||
{
|
||||
field.SetValue(targetDeepCopyObj, fieldValue);
|
||||
}
|
||||
else if (fieldValue != null && fieldValue.GetType() == typeof(Boolean))
|
||||
{
|
||||
field.SetValue(targetDeepCopyObj, fieldValue);
|
||||
}
|
||||
|
||||
}//拷贝属性
|
||||
else if (member.MemberType == System.Reflection.MemberTypes.Property)
|
||||
{
|
||||
System.Reflection.PropertyInfo myProperty = (System.Reflection.PropertyInfo)member;
|
||||
MethodInfo info = myProperty.GetSetMethod(false);
|
||||
if (info != null&&info.DeclaringType.IsValueType)
|
||||
{
|
||||
try
|
||||
{
|
||||
object propertyValue = myProperty.GetValue(obj, null);
|
||||
if (propertyValue is ICloneable)
|
||||
{
|
||||
myProperty.SetValue(targetDeepCopyObj, (propertyValue as ICloneable).Clone(), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// myProperty.SetValue(targetDeepCopyObj, CopyOjbect(propertyValue,hasProperty), null);
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return targetDeepCopyObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class ResponseData<T>
|
||||
{
|
||||
private bool success;
|
||||
public bool successful {
|
||||
get { return success; }
|
||||
|
||||
set
|
||||
{
|
||||
this.success = value;
|
||||
if (success)
|
||||
code = 1;
|
||||
else
|
||||
code = 0;
|
||||
}
|
||||
}
|
||||
public T resultValue { get; set; }
|
||||
public string resultHint
|
||||
{
|
||||
get { return message; }
|
||||
|
||||
set
|
||||
{
|
||||
|
||||
message = value;
|
||||
}
|
||||
}
|
||||
public string errorPage { get; set; }
|
||||
public string type { get; set; }
|
||||
public int count { get; set; }
|
||||
public int code { get; set; }
|
||||
public string message { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class SpotCheckItem
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public Check_SpotCheckDetail SpotCheckDetail { get; set; }
|
||||
/// <summary>
|
||||
/// 工作包
|
||||
/// </summary>
|
||||
public WBS_ControlItemAndCycle controlItemAndCycle { get; set; }
|
||||
public List<WBS_ControlItemAndCycle> controlItemAndCycleList { get; set; }
|
||||
/// <summary>
|
||||
/// 分部工程
|
||||
/// </summary>
|
||||
public Base_CNProfessional CNProfessional { get; set; }
|
||||
/// <summary>
|
||||
/// 分项工程
|
||||
/// </summary>
|
||||
|
||||
public WBS_WorkPackage workPackage { get; set; }
|
||||
/// <summary>
|
||||
/// 单位工程
|
||||
/// </summary>
|
||||
|
||||
public WBS_UnitWork unitWork { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class ToDoModel
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string State { get; set; }
|
||||
public object Data { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class TreeNode
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string Type { get; set; }
|
||||
public int Depth { get; set; }
|
||||
public List<TreeNode> child{get;set;}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user