Exemplo n.º 1
0
 public override void UpdateCorporation(CorporationInfo entity)
 {
     SerializerData data = entity.GetSerializerData();
     string sql = @"
     UPDATE ComOpp_Corporation set
         Name = @Name
         ,PropertyNames=@PropertyNames
         ,PropertyValues=@PropertyValues
     WHERE ID=@ID";
     SqlParameter[] parameters =
     {
         new SqlParameter("@ID", entity.ID),
         new SqlParameter("@Name", entity.Name),
         new SqlParameter("@PropertyNames", data.Keys),
         new SqlParameter("@PropertyValues", data.Values)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, parameters);
 }
Exemplo n.º 2
0
 public override void AddCorporation(CorporationInfo entity)
 {
     string sql = @"INSERT INTO ComOpp_Corporation(
         [Name]
         ,[Sort]
         ,[PropertyNames]
         ,[PropertyValues]
     )VALUES(
         @Name
         ,(SELECT ISNULL(MAX([Sort]),0) + 1 FROM ComOpp_Corporation)
         ,@PropertyNames
         ,@PropertyValues
     )";
     SerializerData data = entity.GetSerializerData();
     SqlParameter[] p =
     {
         new SqlParameter("@Name",entity.Name),
         new SqlParameter("@PropertyNames", data.Keys),
         new SqlParameter("@PropertyValues", data.Values)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, p);
 }