/// <summary> /// 增加一条数据 /// </summary> public int Add(ZhongLi.Model.Person_Work model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@PerWordID", SqlDbType.Int, 4), new SqlParameter("@PerID", SqlDbType.Int, 4), new SqlParameter("@ComPanyName", SqlDbType.NVarChar, 50), new SqlParameter("@Position", SqlDbType.NVarChar, 50), new SqlParameter("@EntryTime", SqlDbType.NVarChar, 50), new SqlParameter("@QuitTime", SqlDbType.NVarChar, 50), new SqlParameter("@WorkCon", SqlDbType.NVarChar, -1), 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.ComPanyName; parameters[3].Value = model.Position; parameters[4].Value = model.EntryTime; parameters[5].Value = model.QuitTime; parameters[6].Value = model.WorkCon; parameters[7].Value = model.CreateTime; parameters[8].Value = model.Colvalue; DbHelperSQL.RunProcedure("Person_Work_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.Person_Work DataRowToModel(DataRow row) { ZhongLi.Model.Person_Work model = new ZhongLi.Model.Person_Work(); if (row != null) { if (row["PerWordID"] != null && row["PerWordID"].ToString() != "") { model.PerWordID = int.Parse(row["PerWordID"].ToString()); } if (row["PerID"] != null && row["PerID"].ToString() != "") { model.PerID = int.Parse(row["PerID"].ToString()); } if (row["ComPanyName"] != null) { model.ComPanyName = row["ComPanyName"].ToString(); } if (row["Position"] != null) { model.Position = row["Position"].ToString(); } if (row["EntryTime"] != null) { model.EntryTime = row["EntryTime"].ToString(); } if (row["QuitTime"] != null) { model.QuitTime = row["QuitTime"].ToString(); } if (row["WorkCon"] != null) { model.WorkCon = row["WorkCon"].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_Work GetModel(int PerWordID) { SqlParameter[] parameters = { new SqlParameter("@PerWordID", SqlDbType.Int, 4) }; parameters[0].Value = PerWordID; ZhongLi.Model.Person_Work model = new ZhongLi.Model.Person_Work(); DataSet ds = DbHelperSQL.RunProcedure("Person_Work_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhongLi.Model.Person_Work model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@PerWordID", SqlDbType.Int, 4), new SqlParameter("@PerID", SqlDbType.Int, 4), new SqlParameter("@ComPanyName", SqlDbType.NVarChar, 50), new SqlParameter("@Position", SqlDbType.NVarChar, 50), new SqlParameter("@EntryTime", SqlDbType.NVarChar, 50), new SqlParameter("@QuitTime", SqlDbType.NVarChar, 50), new SqlParameter("@WorkCon", SqlDbType.NVarChar, -1), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Colvalue", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.PerWordID; parameters[1].Value = model.PerID; parameters[2].Value = model.ComPanyName; parameters[3].Value = model.Position; parameters[4].Value = model.EntryTime; parameters[5].Value = model.QuitTime; parameters[6].Value = model.WorkCon; parameters[7].Value = model.CreateTime; parameters[8].Value = model.Colvalue; DbHelperSQL.RunProcedure("Person_Work_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }