private void map(ShoppingGuideInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.Title = Util.TrimNull(tempdr["Title"]); oParam.Url = Util.TrimNull(tempdr["Url"]); oParam.Content = Util.TrimNull(tempdr["Content"]); oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); }
public ShoppingGuideInfo Load(int sysno) { string sql = "select * from ShoppingGuide where sysno=" + sysno; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (!Util.HasMoreRow(ds)) { return(null); } ShoppingGuideInfo oInfo = new ShoppingGuideInfo(); map(oInfo, ds.Tables[0].Rows[0]); return(oInfo); }
public void Update(ShoppingGuideInfo oParam) { new ShoppingGuideDac().Update(oParam); }
public void Insert(ShoppingGuideInfo oParam) { new ShoppingGuideDac().Insert(oParam); }
public int Update(ShoppingGuideInfo oParam) { string sql = @"UPDATE ShoppingGuide SET Title=@Title, Url=@Url, Content=@Content, CreateUserSysNo=@CreateUserSysNo, CreateTime=@CreateTime, Status=@Status WHERE SysNo=@SysNo"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramTitle = new SqlParameter("@Title", SqlDbType.NVarChar, 100); SqlParameter paramUrl = new SqlParameter("@Url", SqlDbType.NVarChar, 100); SqlParameter paramContent = new SqlParameter("@Content", SqlDbType.Text, 0); SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); if (oParam.SysNo != AppConst.IntNull) { paramSysNo.Value = oParam.SysNo; } else { paramSysNo.Value = System.DBNull.Value; } if (oParam.Title != AppConst.StringNull) { paramTitle.Value = oParam.Title; } else { paramTitle.Value = System.DBNull.Value; } if (oParam.Url != AppConst.StringNull) { paramUrl.Value = oParam.Url; } else { paramUrl.Value = System.DBNull.Value; } if (oParam.Content != AppConst.StringNull) { paramContent.Value = oParam.Content; } else { paramContent.Value = System.DBNull.Value; } if (oParam.CreateUserSysNo != AppConst.IntNull) { paramCreateUserSysNo.Value = oParam.CreateUserSysNo; } else { paramCreateUserSysNo.Value = System.DBNull.Value; } if (oParam.CreateTime != AppConst.DateTimeNull) { paramCreateTime.Value = oParam.CreateTime; } else { paramCreateTime.Value = System.DBNull.Value; } if (oParam.Status != AppConst.IntNull) { paramStatus.Value = oParam.Status; } else { paramStatus.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramTitle); cmd.Parameters.Add(paramUrl); cmd.Parameters.Add(paramContent); cmd.Parameters.Add(paramCreateUserSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramStatus); return(SqlHelper.ExecuteNonQuery(cmd)); }
public int Insert(ShoppingGuideInfo oParam) { string sql = @"INSERT INTO ShoppingGuide ( Title, Url, Content, CreateUserSysNo, CreateTime, Status ) VALUES ( @Title, @Url, @Content, @CreateUserSysNo, @CreateTime, @Status );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramTitle = new SqlParameter("@Title", SqlDbType.NVarChar, 100); SqlParameter paramUrl = new SqlParameter("@Url", SqlDbType.NVarChar, 100); SqlParameter paramContent = new SqlParameter("@Content", SqlDbType.Text, 0); SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); paramSysNo.Direction = ParameterDirection.Output; if (oParam.Title != AppConst.StringNull) { paramTitle.Value = oParam.Title; } else { paramTitle.Value = System.DBNull.Value; } if (oParam.Url != AppConst.StringNull) { paramUrl.Value = oParam.Url; } else { paramUrl.Value = System.DBNull.Value; } if (oParam.Content != AppConst.StringNull) { paramContent.Value = oParam.Content; } else { paramContent.Value = System.DBNull.Value; } if (oParam.CreateUserSysNo != AppConst.IntNull) { paramCreateUserSysNo.Value = oParam.CreateUserSysNo; } else { paramCreateUserSysNo.Value = System.DBNull.Value; } if (oParam.CreateTime != AppConst.DateTimeNull) { paramCreateTime.Value = oParam.CreateTime; } else { paramCreateTime.Value = System.DBNull.Value; } if (oParam.Status != AppConst.IntNull) { paramStatus.Value = oParam.Status; } else { paramStatus.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramTitle); cmd.Parameters.Add(paramUrl); cmd.Parameters.Add(paramContent); cmd.Parameters.Add(paramCreateUserSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramStatus); return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo)); }