/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TCstmr_ApplicantFile model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TCstmr_ApplicantFile set "); strSql.Append("n_AppID=@n_AppID,"); strSql.Append("s_Name=@s_Name,"); strSql.Append("s_Description=@s_Description,"); strSql.Append("s_FilePath=@s_FilePath,"); strSql.Append("dt_EditDate=@dt_EditDate,"); strSql.Append("dt_CreateDate=@dt_CreateDate"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_AppID", SqlDbType.Int, 4), new SqlParameter("@s_Name", SqlDbType.NVarChar, 200), new SqlParameter("@s_Description", SqlDbType.NVarChar, 800), new SqlParameter("@s_FilePath", SqlDbType.NVarChar, 500), new SqlParameter("@dt_EditDate", SqlDbType.DateTime), new SqlParameter("@dt_CreateDate", SqlDbType.DateTime), new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = model.n_AppID; parameters[1].Value = model.s_Name; parameters[2].Value = model.s_Description; parameters[3].Value = model.s_FilePath; parameters[4].Value = model.dt_EditDate; parameters[5].Value = model.dt_CreateDate; parameters[6].Value = model.n_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCstmr_ApplicantFile model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TCstmr_ApplicantFile("); strSql.Append("n_AppID,s_Name,s_Description,s_FilePath,dt_EditDate,dt_CreateDate)"); strSql.Append(" values ("); strSql.Append("@n_AppID,@s_Name,@s_Description,@s_FilePath,@dt_EditDate,@dt_CreateDate)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@n_AppID", SqlDbType.Int, 4), new SqlParameter("@s_Name", SqlDbType.NVarChar, 200), new SqlParameter("@s_Description", SqlDbType.NVarChar, 800), new SqlParameter("@s_FilePath", SqlDbType.NVarChar, 500), new SqlParameter("@dt_EditDate", SqlDbType.DateTime), new SqlParameter("@dt_CreateDate", SqlDbType.DateTime) }; parameters[0].Value = model.n_AppID; parameters[1].Value = model.s_Name; parameters[2].Value = model.s_Description; parameters[3].Value = model.s_FilePath; parameters[4].Value = model.dt_EditDate; parameters[5].Value = model.dt_CreateDate; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCstmr_ApplicantFile DataRowToModel(DataRow row) { IPSP.Model.TCstmr_ApplicantFile model = new IPSP.Model.TCstmr_ApplicantFile(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["n_AppID"] != null && row["n_AppID"].ToString() != "") { model.n_AppID = int.Parse(row["n_AppID"].ToString()); } if (row["s_Name"] != null) { model.s_Name = row["s_Name"].ToString(); } if (row["s_Description"] != null) { model.s_Description = row["s_Description"].ToString(); } if (row["s_FilePath"] != null) { model.s_FilePath = row["s_FilePath"].ToString(); } if (row["dt_EditDate"] != null && row["dt_EditDate"].ToString() != "") { model.dt_EditDate = DateTime.Parse(row["dt_EditDate"].ToString()); } if (row["dt_CreateDate"] != null && row["dt_CreateDate"].ToString() != "") { model.dt_CreateDate = DateTime.Parse(row["dt_CreateDate"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCstmr_ApplicantFile GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,n_AppID,s_Name,s_Description,s_FilePath,dt_EditDate,dt_CreateDate from TCstmr_ApplicantFile "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.TCstmr_ApplicantFile model = new IPSP.Model.TCstmr_ApplicantFile(); 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.TCstmr_ApplicantFile model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCstmr_ApplicantFile model) { return(dal.Add(model)); }