public static UserGroup2UserGroup GetUserGroup2UserGroupByID(string pID) { try { UserGroup2UserGroup _UserGroup2UserGroup = new UserGroup2UserGroup(); DataTable taskDataTable = new DataTable(); using (SqlConnection conn = new SqlConnection(getTmpAppConnectionString())) { string sql = " select * from UserGroup2UserGroup where ID='" + pID + "' "; using (SqlDataAdapter sd = new SqlDataAdapter(sql, conn)) { sd.Fill(taskDataTable); } if (taskDataTable.Rows.Count > 0) { _UserGroup2UserGroup = DataRowToUserGroup2UserGroup(taskDataTable.Rows[0]); } else { _UserGroup2UserGroup = null; } } return(_UserGroup2UserGroup); } catch (Exception ex) { LogService.WriteErr("程序错误,方法:GetUserGroup2UserGroupByID 错误信息:" + ex.Message); return(null); } }
public bool UpdateUserGroup2UserGroup(UserGroup2UserGroup ur) { this.checkUrl(); try { return(this.service.UpdateUserGroup2UserGroup(ur)); } catch { try { return(this.service.UpdateUserGroup2UserGroup(ur)); } catch (System.Exception ex) { LogService.WriteErr("UserSynchroWebService,地址是:" + this.service.Url + "方法:UpdateUserGroup2UserGroup 原因:" + ex.Message); return(false); } } }
/// <summary> /// 得到一个对象实体 /// </summary> public static UserGroup2UserGroup DataRowToUserGroup2UserGroup(DataRow row) { UserGroup2UserGroup model = new UserGroup2UserGroup(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = new Guid(row["ID"].ToString()); } if (row["SuperiorID"] != null && row["SuperiorID"].ToString() != "") { model.SuperiorID = new Guid(row["SuperiorID"].ToString()); } if (row["LowerID"] != null && row["LowerID"].ToString() != "") { model.LowerID = new Guid(row["LowerID"].ToString()); } } return(model); }