示例#1
0
 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"]);
 }
示例#2
0
        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);
        }
示例#3
0
 public void Update(ShoppingGuideInfo oParam)
 {
     new ShoppingGuideDac().Update(oParam);
 }
示例#4
0
 public void Insert(ShoppingGuideInfo oParam)
 {
     new ShoppingGuideDac().Insert(oParam);
 }
示例#5
0
        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));
        }
示例#6
0
        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));
        }