/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_SendRemind DataRowToModel(DataRow row) { IPSP.Model.T_SendRemind model = new IPSP.Model.T_SendRemind(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["n_EmployeeID"] != null && row["n_EmployeeID"].ToString() != "") { model.n_EmployeeID = int.Parse(row["n_EmployeeID"].ToString()); } if (row["s_RemindType"] != null) { model.s_RemindType = row["s_RemindType"].ToString(); } if (row["n_ElementID"] != null && row["n_ElementID"].ToString() != "") { model.n_ElementID = int.Parse(row["n_ElementID"].ToString()); } if (row["s_SendType"] != null) { model.s_SendType = row["s_SendType"].ToString(); } if (row["b_SendFail"] != null && row["b_SendFail"].ToString() != "") { if ((row["b_SendFail"].ToString() == "1") || (row["b_SendFail"].ToString().ToLower() == "true")) { model.b_SendFail = true; } else { model.b_SendFail = false; } } if (row["s_GuID"] != null && row["s_GuID"].ToString() != "") { model.s_GuID = new Guid(row["s_GuID"].ToString()); } if (row["s_RemainingDays"] != null) { model.s_RemainingDays = row["s_RemainingDays"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.T_SendRemind model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_SendRemind set "); strSql.Append("s_RemindType=@s_RemindType,"); strSql.Append("n_ElementID=@n_ElementID,"); strSql.Append("s_SendType=@s_SendType,"); strSql.Append("b_SendFail=@b_SendFail,"); strSql.Append("s_GuID=@s_GuID,"); strSql.Append("s_RemainingDays=@s_RemainingDays"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_RemindType", SqlDbType.NVarChar, 2), new SqlParameter("@n_ElementID", SqlDbType.Int, 4), new SqlParameter("@s_SendType", SqlDbType.NVarChar, 2), new SqlParameter("@b_SendFail", SqlDbType.Bit, 1), new SqlParameter("@s_GuID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@s_RemainingDays", SqlDbType.NVarChar, 10), new SqlParameter("@n_ID", SqlDbType.Int, 4), new SqlParameter("@n_EmployeeID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_RemindType; parameters[1].Value = model.n_ElementID; parameters[2].Value = model.s_SendType; parameters[3].Value = model.b_SendFail; parameters[4].Value = model.s_GuID; parameters[5].Value = model.s_RemainingDays; parameters[6].Value = model.n_ID; parameters[7].Value = model.n_EmployeeID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_SendRemind model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_SendRemind("); strSql.Append("n_EmployeeID,s_RemindType,n_ElementID,s_SendType,b_SendFail,s_GuID,s_RemainingDays)"); strSql.Append(" values ("); strSql.Append("@n_EmployeeID,@s_RemindType,@n_ElementID,@s_SendType,@b_SendFail,@s_GuID,@s_RemainingDays)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@n_EmployeeID", SqlDbType.Int, 4), new SqlParameter("@s_RemindType", SqlDbType.NVarChar, 2), new SqlParameter("@n_ElementID", SqlDbType.Int, 4), new SqlParameter("@s_SendType", SqlDbType.NVarChar, 2), new SqlParameter("@b_SendFail", SqlDbType.Bit, 1), new SqlParameter("@s_GuID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@s_RemainingDays", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.n_EmployeeID; parameters[1].Value = model.s_RemindType; parameters[2].Value = model.n_ElementID; parameters[3].Value = model.s_SendType; parameters[4].Value = model.b_SendFail; parameters[5].Value = Guid.NewGuid(); parameters[6].Value = model.s_RemainingDays; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_SendRemind GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,n_EmployeeID,s_RemindType,n_ElementID,s_SendType,b_SendFail,s_GuID,s_RemainingDays from T_SendRemind "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.T_SendRemind model = new IPSP.Model.T_SendRemind(); 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_SendRemind model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_SendRemind model) { return(dal.Add(model)); }