/// <summary> /// 从行中读取数据映射到实体类的属性中 /// </summary> /// <remarks></remarks> private static Entity.data_Entity GetEntity(DataRow row) { Entity.data_Entity _obj = new Entity.data_Entity(); if (!row["ID"].Equals(DBNull.Value)) { _obj.ID = Convert.ToInt32(row["ID"]); } if (!row["inputTime"].Equals(DBNull.Value)) { _obj.inputTime = Convert.ToDateTime(row["inputTime"]); } if (!row["data_Position"].Equals(DBNull.Value)) { _obj.data_Position = Convert.ToString(row["data_Position"]); } if (!row["dataName"].Equals(DBNull.Value)) { _obj.dataName = Convert.ToString(row["dataName"]); } if (!row["AgencyNo"].Equals(DBNull.Value)) { _obj.AgencyNo = Convert.ToString(row["AgencyNo"]); } if (!row["datatype"].Equals(DBNull.Value)) { _obj.datatype = Convert.ToString(row["datatype"]); } if (!row["upload"].Equals(DBNull.Value)) { _obj.upload = Convert.ToString(row["upload"]); } return(_obj); }
/// <summary> /// 更新机构信息 /// </summary> /// <param name="ai">用户实体</param> /// <returns>影响行数</returns> public static int Updatedata(Entity.data_Entity ai) { string sequel = "DR_Updatedata"; SqlParameter[] paras = (SqlParameter[])ValueParas(ai); int result = SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, sequel, paras); return(result); }
/// <summary> /// 该数据访问对象的属性值装载到数据库更新参数数组Insert用 /// </summary> /// <remarks></remarks> private static IDbDataParameter[] ValueParas(Entity.data_Entity _obj) { SqlParameter[] paras = new SqlParameter[7]; paras[0] = new SqlParameter("@ID", _obj.ID); paras[1] = new SqlParameter("@inputTime", _obj.inputTime); paras[2] = new SqlParameter("@data_Position", _obj.data_Position); paras[3] = new SqlParameter("@dataName", _obj.dataName); paras[4] = new SqlParameter("@AgencyNo", _obj.AgencyNo); paras[5] = new SqlParameter("@datatype", _obj.datatype); paras[6] = new SqlParameter("@upload", _obj.upload); paras[0].DbType = DbType.Int32; paras[1].DbType = DbType.DateTime; paras[2].DbType = DbType.String; paras[3].DbType = DbType.String; paras[4].DbType = DbType.String; paras[5].DbType = DbType.String; paras[6].DbType = DbType.String; return(paras); }
public static int Updatedata(Entity.data_Entity ai) { return(DAL.data_DAL.Updatedata(ai)); }