/// <summary> /// 增加一条数据 /// </summary> public bool Add(IPSP.Model.TPCase_MacaoApplication model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TPCase_MacaoApplication("); strSql.Append("n_CaseID,s_ParentCaseSerial,s_ParentCaseAppNo,s_ParentCaseCountry,dt_AppDate,dt_GrantDate)"); strSql.Append(" values ("); strSql.Append("@n_CaseID,@s_ParentCaseSerial,@s_ParentCaseAppNo,@s_ParentCaseCountry,@dt_AppDate,@dt_GrantDate)"); SqlParameter[] parameters = { new SqlParameter("@n_CaseID", SqlDbType.Int, 4), new SqlParameter("@s_ParentCaseSerial", SqlDbType.NVarChar, 50), new SqlParameter("@s_ParentCaseAppNo", SqlDbType.NVarChar, 50), new SqlParameter("@s_ParentCaseCountry", SqlDbType.NVarChar, 100), new SqlParameter("@dt_AppDate", SqlDbType.DateTime), new SqlParameter("@dt_GrantDate", SqlDbType.DateTime) }; parameters[0].Value = model.n_CaseID; parameters[1].Value = model.s_ParentCaseSerial; parameters[2].Value = model.s_ParentCaseAppNo; parameters[3].Value = model.s_ParentCaseCountry; parameters[4].Value = model.dt_AppDate; parameters[5].Value = model.dt_GrantDate; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TPCase_MacaoApplication DataRowToModel(DataRow row) { IPSP.Model.TPCase_MacaoApplication model = new IPSP.Model.TPCase_MacaoApplication(); if (row != null) { if (row["n_CaseID"] != null && row["n_CaseID"].ToString() != "") { model.n_CaseID = int.Parse(row["n_CaseID"].ToString()); } if (row["s_ParentCaseSerial"] != null) { model.s_ParentCaseSerial = row["s_ParentCaseSerial"].ToString(); } if (row["s_ParentCaseAppNo"] != null) { model.s_ParentCaseAppNo = row["s_ParentCaseAppNo"].ToString(); } if (row["s_ParentCaseCountry"] != null) { model.s_ParentCaseCountry = row["s_ParentCaseCountry"].ToString(); } if (row["dt_AppDate"] != null && row["dt_AppDate"].ToString() != "") { model.dt_AppDate = DateTime.Parse(row["dt_AppDate"].ToString()); } if (row["dt_GrantDate"] != null && row["dt_GrantDate"].ToString() != "") { model.dt_GrantDate = DateTime.Parse(row["dt_GrantDate"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TPCase_MacaoApplication model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TPCase_MacaoApplication set "); strSql.Append("s_ParentCaseSerial=@s_ParentCaseSerial,"); strSql.Append("s_ParentCaseAppNo=@s_ParentCaseAppNo,"); strSql.Append("s_ParentCaseCountry=@s_ParentCaseCountry,"); strSql.Append("dt_AppDate=@dt_AppDate,"); strSql.Append("dt_GrantDate=@dt_GrantDate"); strSql.Append(" where n_CaseID=@n_CaseID "); SqlParameter[] parameters = { new SqlParameter("@s_ParentCaseSerial", SqlDbType.NVarChar, 50), new SqlParameter("@s_ParentCaseAppNo", SqlDbType.NVarChar, 50), new SqlParameter("@s_ParentCaseCountry", SqlDbType.NVarChar, 100), new SqlParameter("@dt_AppDate", SqlDbType.DateTime), new SqlParameter("@dt_GrantDate", SqlDbType.DateTime), new SqlParameter("@n_CaseID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_ParentCaseSerial; parameters[1].Value = model.s_ParentCaseAppNo; parameters[2].Value = model.s_ParentCaseCountry; parameters[3].Value = model.dt_AppDate; parameters[4].Value = model.dt_GrantDate; parameters[5].Value = model.n_CaseID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TPCase_MacaoApplication GetModel(int n_CaseID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_CaseID,s_ParentCaseSerial,s_ParentCaseAppNo,s_ParentCaseCountry,dt_AppDate,dt_GrantDate from TPCase_MacaoApplication "); strSql.Append(" where n_CaseID=@n_CaseID "); SqlParameter[] parameters = { new SqlParameter("@n_CaseID", SqlDbType.Int, 4) }; parameters[0].Value = n_CaseID; IPSP.Model.TPCase_MacaoApplication model = new IPSP.Model.TPCase_MacaoApplication(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TPCase_MacaoApplication model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(IPSP.Model.TPCase_MacaoApplication model) { return(dal.Add(model)); }