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