/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhongLi.Model.Person_Skill model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@PerSkillID", SqlDbType.Int, 4), new SqlParameter("@PerID", SqlDbType.Int, 4), new SqlParameter("@SkillName", SqlDbType.NVarChar, 50), new SqlParameter("@MasterDegree", SqlDbType.NVarChar, 50), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Colvalue", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.PerSkillID; parameters[1].Value = model.PerID; parameters[2].Value = model.SkillName; parameters[3].Value = model.MasterDegree; parameters[4].Value = model.CreateTime; parameters[5].Value = model.Colvalue; DbHelperSQL.RunProcedure("Person_Skill_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.Person_Skill DataRowToModel(DataRow row) { ZhongLi.Model.Person_Skill model = new ZhongLi.Model.Person_Skill(); if (row != null) { if (row["PerSkillID"] != null && row["PerSkillID"].ToString() != "") { model.PerSkillID = int.Parse(row["PerSkillID"].ToString()); } if (row["PerID"] != null && row["PerID"].ToString() != "") { model.PerID = int.Parse(row["PerID"].ToString()); } if (row["SkillName"] != null) { model.SkillName = row["SkillName"].ToString(); } if (row["MasterDegree"] != null) { model.MasterDegree = row["MasterDegree"].ToString(); } if (row["CreateTime"] != null && row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["Colvalue"] != null) { model.Colvalue = row["Colvalue"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.Person_Skill GetModel(int PerSkillID) { SqlParameter[] parameters = { new SqlParameter("@PerSkillID", SqlDbType.Int, 4) }; parameters[0].Value = PerSkillID; ZhongLi.Model.Person_Skill model = new ZhongLi.Model.Person_Skill(); DataSet ds = DbHelperSQL.RunProcedure("Person_Skill_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZhongLi.Model.Person_Skill model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@PerSkillID", SqlDbType.Int, 4), new SqlParameter("@PerID", SqlDbType.Int, 4), new SqlParameter("@SkillName", SqlDbType.NVarChar, 50), new SqlParameter("@MasterDegree", SqlDbType.NVarChar, 50), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Colvalue", SqlDbType.NVarChar, 50) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.PerID; parameters[2].Value = model.SkillName; parameters[3].Value = model.MasterDegree; parameters[4].Value = model.CreateTime; parameters[5].Value = model.Colvalue; DbHelperSQL.RunProcedure("Person_Skill_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }