예제 #1
0
        /// <summary>
        /// 暂停该值
        /// </summary>
        /// <param name="Id">自增id的值</param>
        /// <returns>暂停成功返回ture,否则返回false</returns>
        public static bool ProvinceZhiYuanPause(Entity.ProvinceZhiYuan info)
        {
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.Text, "UPDATE [ProvinceZhiYuan] SET IsPause = " + info.IsPause + "  WHERE Id =  " + info.Id);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int ProvinceZhiYuanAdd(Entity.ProvinceZhiYuan info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@ProvincePcId", SqlDbType.Int,        4, info.ProvincePcId),
         SqlDB.MakeInParam("@ZhiYuanMing",  SqlDbType.NVarChar,  50, info.ZhiYuanMing),
         SqlDB.MakeInParam("@Suggestion",   SqlDbType.NVarChar, 500, info.Suggestion),
         SqlDB.MakeInParam("@ShowOrder",    SqlDbType.Int,        4, info.ShowOrder),
         SqlDB.MakeInParam("@IsPause",      SqlDbType.Int,        4, info.IsPause),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "ProvinceZhiYuanAdd", prams).ToString(), -1));
 }
예제 #3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool ProvinceZhiYuanEdit(Entity.ProvinceZhiYuan info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",           SqlDbType.Int,        4, info.Id),
                SqlDB.MakeInParam("@ProvincePcId", SqlDbType.Int,        4, info.ProvincePcId),
                SqlDB.MakeInParam("@ZhiYuanMing",  SqlDbType.NVarChar,  50, info.ZhiYuanMing),
                SqlDB.MakeInParam("@Suggestion",   SqlDbType.NVarChar, 500, info.Suggestion),
                SqlDB.MakeInParam("@ShowOrder",    SqlDbType.Int,        4, info.ShowOrder),
                SqlDB.MakeInParam("@IsPause",      SqlDbType.Int,        4, info.IsPause),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "ProvinceZhiYuanEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
예제 #4
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        //public static Entity.ProvinceZhiYuan ProvinceZhiYuanEntityGet(int Id)
        //{
        //    Entity.ProvinceZhiYuan info = new Entity.ProvinceZhiYuan();
        //    DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [ProvinceZhiYuan] WHERE Id = "+Id+";").Tables[0];
        //    if(dt.Rows.Count >0)
        //    {
        //        info.Id = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(),0);
        //        info.ProvincePcId = Basic.Utils.StrToInt(dt.Rows[0]["ProvincePcId"].ToString(), 0);
        //        info.ZhiYuanMing = dt.Rows[0]["ZhiYuanMing"].ToString();
        //        info.Suggestion = dt.Rows[0]["Suggestion"].ToString();
        //        info.ShowOrder = Basic.Utils.StrToInt(dt.Rows[0]["ShowOrder"].ToString(),0);
        //        info.IsPause = Basic.Utils.StrToInt(dt.Rows[0]["IsPause"].ToString(), 0);
        //        return info;
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}


        public static Entity.ProvinceZhiYuan ProvinceZhiYuanEntityGet(int ProvincePcId)
        {
            Entity.ProvinceZhiYuan info = new Entity.ProvinceZhiYuan();
            DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [ProvinceZhiYuan] WHERE ProvincePcId = " + ProvincePcId + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id           = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.ProvincePcId = Basic.Utils.StrToInt(dt.Rows[0]["ProvincePcId"].ToString(), 0);
                info.ZhiYuanMing  = dt.Rows[0]["ZhiYuanMing"].ToString();
                info.Suggestion   = dt.Rows[0]["Suggestion"].ToString();
                info.ShowOrder    = Basic.Utils.StrToInt(dt.Rows[0]["ShowOrder"].ToString(), 0);
                info.IsPause      = Basic.Utils.StrToInt(dt.Rows[0]["IsPause"].ToString(), 0);
                return(info);
            }
            else
            {
                return(null);
            }
        }