示例#1
0
 public DataTable GetList()
 {
     string cachyname = "UserGrade";
     if (HttpRuntime.Cache[cachyname] == null)
     {
         DataTable tables = new DataTable();
         using (SQLData data = new SQLData())
         {
             StringBuilder builder = new StringBuilder();
             builder.Append(@"SELECT *
                   FROM [USR_Grade] where dr=").Append((int)AppEnum.State.normal);
             try
             {
                 tables = data.CmdtoDataTable(builder.ToString());
                 HttpRuntime.Cache.Insert(cachyname, tables, null, DateTime.Now.AddHours(10), TimeSpan.Zero,
                 System.Web.Caching.CacheItemPriority.High, null);
             }
             catch (Exception exception)
             {
                 throw exception;
             }
         }
     }
     return (HttpRuntime.Cache[cachyname] as DataTable).Copy();
 }
示例#2
0
 public DataTable GetCates(int parent)
 {
     string cachyname = "CMSCate";
     if (HttpRuntime.Cache[cachyname + parent] == null)
     {
         DataTable tables = new DataTable();
         using (SQLData data = new SQLData())
         {
             StringBuilder builder = new StringBuilder();
             builder.Append(@"SELECT [SysNo]
                       ,[Name]
                       ,[ParentSysNo]
                       ,[DR]
                       ,[TS]
                   FROM [CMS_Category] where dr=").Append((int)AppEnum.State.normal)
                 .Append(" and IsHide=").Append((int)AppEnum.BOOL.False)
                .Append(" and [ParentSysNo] = ").Append(parent).Append(" order by [Name];");
             try
             {
                 tables = data.CmdtoDataTable(builder.ToString());
                 HttpRuntime.Cache.Insert(cachyname + parent, tables, null, DateTime.Now.AddHours(2), TimeSpan.Zero,
                 System.Web.Caching.CacheItemPriority.High, null);
             }
             catch (Exception exception)
             {
                 throw exception;
             }
         }
     }
     return (HttpRuntime.Cache[cachyname + parent] as DataTable).Copy();
 }
示例#3
0
 public DataTable GetIndexCateArticle(int count, int cate)
 {
     string cachyname = "IndexArticle";
     if (HttpRuntime.Cache[cachyname + cate.ToString() + "-" + count.ToString()] == null)
     {
         DataTable tables = new DataTable();
         using (SQLData data = new SQLData())
         {
             StringBuilder builder = new StringBuilder();
             builder.Append(@"SELECT top " + count + @" [SysNo]
                               ,[ArticleSysNo]
                               ,[CateSysNo]
                               ,[KeyWords]
                               ,[TS]
                               ,[OrderID]
                               ,[Title]
                               ,Description
                               ,ReadCount
                           FROM CMS_ArticleView where CateSysNo in (select SysNo from CMS_Category where SysNo=").Append(cate).Append(" or TopSysNo=").Append(cate).Append(" and dr=").Append((int)AppEnum.State.normal).Append(") and dr=").Append((int)AppEnum.State.normal);
             builder.Append(" order by [OrderID] desc, [TS] desc;");
             try
             {
                 tables = data.CmdtoDataTable(builder.ToString());
                 HttpRuntime.Cache.Insert(cachyname + cate.ToString() + "-" + count.ToString(), tables, null, DateTime.Now.AddHours(2), TimeSpan.Zero,
                 System.Web.Caching.CacheItemPriority.High, null);
             }
             catch (Exception exception)
             {
                 throw exception;
             }
         }
     }
     return (HttpRuntime.Cache[cachyname + cate.ToString() + "-" + count.ToString()] as DataTable).Copy();
 }
示例#4
0
 public static string SystemInputFilter(string input)
 {
     input = StringFilter(input);
     input = NoHTML(input);
     input = SQLData.SQLFilter(input);
     return(input);
 }
示例#5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="UseType">全部则为0</param>
        /// <returns></returns>
        public DataTable GetFirstLevel(int UseType)
        {
            DataTable table = new DataTable();
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"select [SysNo]
                  ,[UpSysNo]
                  ,[Name]
                  ,[EnglishName]
                  ,[Level]
                  ,[UseType]
                  ,[DR]
                  ,[TS]
                  ,[Latitude]
                  ,[longitude]
                 from [SYS_District] where [Level]=1 and dr=").Append((int)AppEnum.State.normal);
                if (UseType != 0 && UseType != AppConst.IntNull)
                {
                    builder.Append(" and usetype=").Append(UseType);
                }
                builder.Append(" order by [Name] desc");

                try
                {
                    table = data.CmdtoDataTable(builder.ToString());
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            return table;
        }
示例#6
0
        public Dictionary<int, SYS_ArticleContentMod> GetContentByArticle(int ArticleSysno)
        {
            Dictionary<int, SYS_ArticleContentMod> ret = new Dictionary<int, SYS_ArticleContentMod>();
            DataTable m_dt = new DataTable();
            string strsql = "select * from SYS_ArticleContent where ArticleSysNo=" + ArticleSysno + " and DR=" + (int)AppEnum.State.normal + " order by Page asc";

            using (SQLData m_data = new SQLData())
            {
                try
                {
                    m_dt = m_data.CmdtoDataTable(strsql);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                SYS_ArticleContentMod m_tmp = new SYS_ArticleContentMod();
                m_tmp.ArticleSysNo = int.Parse(m_dt.Rows[i]["ArticleSysNo"].ToString());
                m_tmp.Context = m_dt.Rows[i]["Context"].ToString();
                m_tmp.DR = int.Parse(m_dt.Rows[i]["DR"].ToString());
                m_tmp.Page = int.Parse(m_dt.Rows[i]["Page"].ToString());
                m_tmp.SysNo = int.Parse(m_dt.Rows[i]["SysNo"].ToString());
                m_tmp.TS = DateTime.Parse(m_dt.Rows[i]["TS"].ToString());

                ret.Add(int.Parse(m_dt.Rows[i]["Page"].ToString()), m_tmp);
            }
            return ret;
        }
示例#7
0
        public DataTable GetListByQuest(int SysNo)
        {
            DataTable tables = new DataTable();
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"SELECT [QA_Order].[SysNo]
              ,[AnswerSysNo]
              ,[QuestionSysNo]
              ,[CustomerSysNo]
              ,[Price]
              ,[QA_Order].[Status]
              ,[QA_Order].[TS]
              ,[Words]
              ,[Description]
              ,[Score]
              ,[Trial]
              ,NickName
              ,photo
              FROM [QA_Order] left join USR_Customer on CustomerSysNo=USR_Customer.SysNo where QuestionSysNo=").Append(SysNo);

                try
                {
                    tables = data.CmdtoDataTable(builder.ToString());
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            return tables;
        }
示例#8
0
        /// <summary>
        /// 前台发问题
        /// </summary>
        /// <param name="model"></param>
        public void AddQuest(ref QA_QuestionMod model, bool isquest)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                using (SQLData m_data = new SQLData())
                {
                    model.SysNo = m_data.GetSequence("QA_Question_Seq");
                }
                Add(model);
                AppMod.User.USR_RecordMod m_record = new AppMod.User.USR_RecordMod();
                m_record.CustomerSysNo = model.CustomerSysNo;
                m_record.TargetSysNo = model.SysNo;
                m_record.TS = DateTime.Now;
                m_record.Type = (int)AppEnum.ActionType.AddQuest;
                User.USR_RecordBll.GetInstance().Add(m_record);
                if (isquest)
                {
                    User.USR_CustomerBll.GetInstance().AddPoint(0 - model.Award, model.CustomerSysNo);
                    User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 1, 0, 0, 0, 0, 0, 0, 0, 0);
                }
                else
                {
                    User.USR_CustomerBll.GetInstance().AddPoint(AppConst.TalkPoint, model.CustomerSysNo);
                    User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 0, 0, 0, 0, 1, 0, 0, 0, 0);
                }
                User.USR_CustomerBll.GetInstance().AddExp(AppConst.TalkExp, model.CustomerSysNo);
                scope.Complete();
            }
        }
示例#9
0
        public DataTable GetListByAdmin(int sysno)
        {
            DataTable m_dt = new DataTable();

            using (SQLData m_data = new SQLData())
            {
                m_dt = m_data.CmdtoDataTable("select * from REL_Admin_Privilege where Admin_SysNo=" + sysno);
            }
            return m_dt;
        }
示例#10
0
        public DataTable GetList()
        {
            DataTable m_dt = new DataTable();

            using (SQLData m_data = new SQLData())
            {
                m_dt = m_data.CmdtoDataTable("select * from SYS_Privilege");
            }
            return m_dt;
        }
示例#11
0
        public void DeleteConditionsByLogic(int sysno)
        {
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"delete RSH_BaziCondition where LogicSysNo=").Append(sysno);
                try
                {
                    data.CmdtoNone(builder.ToString());
                }
                catch (Exception exception)
                {

                }
            }
        }
示例#12
0
        public DataTable GetList(int pagesize, int pageindex, string name, int except, ref int total)
        {
            DataTable m_dt = new DataTable();
            string columns = "";
            string tables = "";
            string where = "";
            string order = "";

            #region  设置参数
            columns = @"SysNo, [Name], [Description], Logic, Type, DR";
            tables = "RSH_BaziLogic";
            order = "SysNo desc";
            where = "dr=0";
            if (name != "")
            {
                where += " and (";
                string[] tmpstr = name.Split(new char[] { ' ' });
                for (int i = 0; i < tmpstr.Length; i++)
                {
                    where += " [Name] like '%" + SQLData.SQLFilter(tmpstr[i]) + "%' and ";
                }
                where += " 1=1)";
            }
            if (except != 0 && except != AppConst.IntNull)
            {
                where += " and SysNo <>" + except;
            }

            #endregion

            using (SQLData m_data = new SQLData())
            {
                m_data.AddParameter("SelectList", columns);
                m_data.AddParameter("TableSource", tables);
                m_data.AddParameter("SearchCondition", where);
                m_data.AddParameter("OrderExpression", order);
                m_data.AddParameter("PageIndex", pageindex);
                m_data.AddParameter("pagesize", pagesize);
                DataSet m_ds = m_data.SPtoDataSet("GetRecordFromPage");
                if (m_ds.Tables.Count == 2)
                {
                    m_dt = m_ds.Tables[0];
                    total = int.Parse(m_ds.Tables[1].Rows[0][0].ToString());
                }
            }
            return m_dt;
        }
示例#13
0
        public void CopyPrivilege(int fromuser, int touser)
        {
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"insert into REL_Admin_Privilege (Privilege_sysno,admin_sysno) select privilege_sysno,").Append(touser).Append(" where admin_sysno=").Append(fromuser).Append(" and dr=0");

                try
                {
                    data.CmdtoNone(builder.ToString());
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
        }
示例#14
0
 public void AddConsume(int CustomerSysNo, int TotalSellRMB, int TotalBuyRMB, int TotalBuyPoint)
 {
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("update USR_Customer set TotalSellRMB = TotalSellRMB+").Append(TotalSellRMB).Append(",TotalBuyRMB = TotalBuyRMB+").Append(TotalBuyRMB)
             .Append(",TotalBuyPoint = TotalBuyPoint+").Append(TotalBuyPoint).Append(" where SysNo=").Append(CustomerSysNo);
         try
         {
             data.CmdtoNone(builder.ToString());
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
 }
示例#15
0
 public DataTable GetListByLogic(int sysno)
 {
     DataTable m_dt = new DataTable();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append(@"select * from RSH_BaziCondition where LogicSysNo=").Append(sysno).Append(" order by sysno asc");
         try
         {
             m_dt = data.CmdtoDataTable(builder.ToString());
         }
         catch (Exception exception)
         {
             return null;
         }
     }
     return m_dt;
 }
示例#16
0
 /// <summary>
 /// 获取某案例的所有关键字
 /// </summary>
 /// <param name="SysNo"></param>
 /// <returns></returns>
 public DataTable GetFamousList(int SysNo)
 {
     DataTable table = new DataTable();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select SYS_Famous_KeyWords.*,REL_Famous_KeyWord.SysNo as RelSysNo,Value from REL_Famous_KeyWord left join SYS_Famous_KeyWords on KeyWord_SysNo = SYS_Famous_KeyWords.SysNo where Famous_SysNo=").Append(SysNo).Append(" and DR=").Append((int)AppEnum.State.normal);
         try
         {
             table = data.CmdtoDataTable(builder.ToString());
         }
         catch (Exception exception)
         {
             throw exception;
         }
     }
     return table;
 }
示例#17
0
 public DataTable GetList()
 {
     DataTable table = new DataTable();
     Dictionary<int, SYS_PrivilegeMod> dictionary = new Dictionary<int, SYS_PrivilegeMod>();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select SysNo, [Name], ParentSysNo from SYS_Famous_Category where ParentSysNo=0").Append(" and DR=").Append((int)AppEnum.State.normal);
         try
         {
             table = data.CmdtoDataTable(builder.ToString());
         }
         catch (Exception exception)
         {
             throw exception;
         }
     }
     return table;
 }
示例#18
0
        public DataTable GetRecordByUser(int SysNo)
        {
            DataTable table = new DataTable();
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"select TopicSendRecord.*,AdvTopic.Group from [TopicSendRecord] left join AdvTopic on TopicSysNo = AdvTopic.SysNo where UserSysNo=" + SysNo + " and AdvTopic.dr=").Append((int)AppEnum.State.normal);

                try
                {
                    table = data.CmdtoDataTable(builder.ToString());
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            return table;
        }
示例#19
0
        public DataTable GetRecentRecordByUser(int SysNo)
        {
            DataTable table = new DataTable();
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"select T.*,AdvTopic.Group from (max(TS) as LastTime, TopicSysNo, from [TopicSendRecord] where UserSysNo=" + SysNo + " group by TopicSysNo) as T left join AdvTopic on T.TopicSysNo = AdvTopic.SysNo where AdvTopic.dr=").Append((int)AppEnum.State.normal).Append(" order by LastTime desc");

                try
                {
                    table = data.CmdtoDataTable(builder.ToString());
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            return table;
        }
示例#20
0
        public DataTable GetListByTopic(int SysNo)
        {
            DataTable table = new DataTable();
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"select * from [AdvTopicContent] where TopicSysNo=" + SysNo);

                try
                {
                    table = data.CmdtoDataTable(builder.ToString());
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            return table;
        }
示例#21
0
        public DataTable GetArticleComments(int ArticleSysno, int pagesize, int pageindex, ref int total)
        {
            DataTable m_dt = new DataTable();
            string columns = "";
            string tables = "";
            string where = "";
            string order = "BLG_Comment.SysNo desc";

            #region  设置参数
            columns = @"BLG_Comment.SysNo
                        , ArticleSysNo
                        , Title
                        , Context
                        , CustomerSysNo
                        , Love
                        , Hate
                        , BLG_Comment.TS
                      ,[NickName]
                      ,[Photo]
                      ,[Credit]
                      ,[Point]";
            tables = "BLG_Comment left join USR_Customer on CustomerSysNo=USR_Customer.SysNo";
            where = "BLG_Comment.ArticleSysNo = " + ArticleSysno + " and BLG_Comment.dr=" + (int)AppEnum.State.normal + " and USR_Customer.dr=" + (int)AppEnum.State.normal;

            #endregion

            using (SQLData m_data = new SQLData())
            {
                m_data.AddParameter("SelectList", columns);
                m_data.AddParameter("TableSource", tables);
                m_data.AddParameter("SearchCondition", where);
                m_data.AddParameter("OrderExpression", order);
                m_data.AddParameter("PageIndex", pageindex);
                m_data.AddParameter("pagesize", pagesize);
                DataSet m_ds = m_data.SPtoDataSet("GetRecordFromPage");
                if (m_ds.Tables.Count == 2)
                {
                    m_dt = m_ds.Tables[0];
                    total = int.Parse(m_ds.Tables[1].Rows[0][0].ToString());
                }
            }
            return m_dt;
        }
示例#22
0
        public DataTable GetMedalByCustomer(int UserSysno, int type)
        {
            DataTable m_dt = new DataTable();

            #region  设置参数
            string sql = @" select REL_Customer_Medal.*,MedalName,type,Detail" +
            " from REL_Customer_Medal left join USR_Medal on MedalSysNo=USR_Medal.SysNo" +
            " where CustomerSysNo=" + UserSysno + " and REL_Customer_Medal.DR=" + (int)AppEnum.State.normal + " and USR_Medal.DR=" + (int)AppEnum.State.normal;
            if (type != 0 && type != AppConst.IntNull)
            {
                sql += " and type=" + type;
            }
            sql += " order by REL_Customer_Medal.sysno desc";
            #endregion

            using (SQLData m_data = new SQLData())
            {
                m_dt = m_data.CmdtoDataTable(sql);
            }
            return m_dt;
        }
示例#23
0
 public QQWeiBoUserMod GetRecordByName(string name)
 {
     QQWeiBoUserMod model = new QQWeiBoUserMod();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select SysNo from Apps.dbo.QQWeiBoUser where WB_Name='").Append(SQLData.SQLFilter(name) + "'");
         try
         {
             model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
         }
         catch (Exception)
         {
         }
     }
     if (model.SysNo != -999999)
     {
         model = this.GetModel(model.SysNo);
     }
     return model;
 }
示例#24
0
        public DataTable GetListByFamousSysNo(int pageindex,int pagesize,int famous,ref int total)
        {
            DataTable m_dt = new DataTable();
            string columns = "";
            string tables = "";
            string where = "";
            string order = "";

            #region  设置参数
            columns = @"SYS_Famous_Comment.[SysNo]
                        ,[FamousSysNo]
                        ,[CustomerSysNo]
                        ,[Context]
                        ,SYS_Famous_Comment.[DR]
                        ,SYS_Famous_Comment.[TS]
                        ,USR_Customer.[Photo]
                        ,USR_Customer.[NickName]";
            tables = "SYS_Famous_Comment left join USR_Customer on [CustomerSysNo] = USR_Customer.SysNo";
            order = "SYS_Famous_Comment.SysNo desc";
            where = "FamousSysNo=" + famous + " and SYS_Famous_Comment.dr=" + (int)AppEnum.State.normal;

            #endregion

            using (SQLData m_data = new SQLData())
            {
                m_data.AddParameter("SelectList", columns);
                m_data.AddParameter("TableSource", tables);
                m_data.AddParameter("SearchCondition", where);
                m_data.AddParameter("OrderExpression", order);
                m_data.AddParameter("PageIndex", pageindex);
                m_data.AddParameter("pagesize", pagesize);
                DataSet m_ds = m_data.SPtoDataSet("GetRecordFromPage");
                if (m_ds.Tables.Count == 2)
                {
                    m_dt = m_ds.Tables[0];
                    total = int.Parse(m_ds.Tables[1].Rows[0][0].ToString());
                }
            }
            return m_dt;
        }
示例#25
0
 public AdvUserMod GetModel(string phonenum)
 {
     AdvUserMod model = new AdvUserMod();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select SysNo from AdvUser where CellPhone='").Append(SQLData.SQLFilter(phonenum)).Append("' and DR=").Append((int)AppEnum.State.normal);
         try
         {
             model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
     if (model.SysNo != AppConst.IntNull)
     {
         model = this.GetModel(model.SysNo);
     }
     return model;
 }
示例#26
0
 public DataTable GetStarsList(int count,int type)
 {
     string cachyname = "QAStars";
     if (HttpRuntime.Cache[cachyname + type.ToString() + "-" + count.ToString()] == null)
     {
         DataTable tables = new DataTable();
         using (SQLData data = new SQLData())
         {
             StringBuilder builder = new StringBuilder();
             builder.Append(@"SELECT top " + count + @" [QA_Star].[SysNo]
                               ,[NickName]
                               ,[CustomerSysNo]
                               ,[OrderID]
                               ,[QA_Star].[Intro]
                               ,[QA_Star].[FateType]
                               ,[Photo]
                               ,[Credit]
                               ,[Point]
                           FROM [QA_Star] left join USR_Customer on CustomerSysNo = USR_Customer.SysNo where status=").Append((int)AppEnum.State.normal);
             if(type!= 0)
             {
                 builder.Append(" and [FateType] = ").Append(type);
             }
             builder.Append(" order by [OrderID] desc;");
             try
             {
                 tables = data.CmdtoDataTable(builder.ToString());
                 HttpRuntime.Cache.Insert(cachyname + type.ToString() + "-" + count.ToString(), tables, null, DateTime.Now.AddHours(2), TimeSpan.Zero,
                 System.Web.Caching.CacheItemPriority.High, null);
             }
             catch (Exception exception)
             {
                 throw exception;
             }
         }
     }
     return (HttpRuntime.Cache[cachyname + type.ToString() + "-" + count.ToString()] as DataTable).Copy();
 }
示例#27
0
 public DataTable GetList(int pagesize, int pageindex, ref int total)
 {
     DataTable m_dt = new DataTable();
     string columns = "*";
     string tables = "USR_Notice";
     string where = "1=1";
     string order = "SysNo desc";
     using (SQLData m_data = new SQLData())
     {
         m_data.AddParameter("SelectList", columns);
         m_data.AddParameter("TableSource", tables);
         m_data.AddParameter("SearchCondition", where);
         m_data.AddParameter("OrderExpression", order);
         m_data.AddParameter("PageIndex", pageindex);
         m_data.AddParameter("pagesize", pagesize);
         DataSet m_ds = m_data.SPtoDataSet("GetRecordFromPage");
         if (m_ds.Tables.Count == 2)
         {
             m_dt = m_ds.Tables[0];
             total = int.Parse(m_ds.Tables[1].Rows[0][0].ToString());
         }
     }
     return m_dt;
 }
示例#28
0
 public SYS_AdminMod CheckAdmin(string username, string password)
 {
     SYS_AdminMod model = new SYS_AdminMod();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select SysNo from SYS_Admin where Username='******' and Password='******' and DR=").Append(0);
         try
         {
             model.CustomerSysNo =int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
     if (model.CustomerSysNo != -999999)
     {
         model = this.GetModel(model.CustomerSysNo);
         model.LastLogin = DateTime.Now;
         this.Update(model);
     }
     return model;
 }
示例#29
0
        public DataTable GetAllCates()
        {
            DataTable tables = new DataTable();
                using (SQLData data = new SQLData())
                {
                    StringBuilder builder = new StringBuilder();
                    builder.Append(@"SELECT [SysNo]
                              ,[Name]
                              ,[ParentSysNo]
                              ,[DR]
                              ,[TS]
                          FROM [QA_Category] where dr=").Append((int)AppEnum.State.normal);

                    try
                    {
                        tables = data.CmdtoDataTable(builder.ToString());
                    }
                    catch (Exception exception)
                    {
                        throw exception;
                    }
                }
            return tables;
        }
示例#30
0
        public DataTable GetList(int pagesize, int pageindex, string name, DateTime timeBegin, DateTime timeEnd,string status,bool istop, ref int total)
        {
            DataTable m_dt = new DataTable();
            string columns = "";
            string tables = "";
            string where = "";
            string order = "";

            #region  设置参数
            columns = @"SYS_Famous.[SysNo]
                      ,SYS_Famous.[Name]
                      ,Description
                      ,[FullName]
                      ,[BirthYear]
                      ,[BirthTime]
                      ,[Source]
                      ,[Gender]
                      ,[HomeTown]
                      ,[Name1]
                      ,[Name3]
                      ,[EnglishName1]
                      ,[EnglishName3]
                      ,[TimeUnknown]
                      ,[IsTop]
                      ,[photo]
                      ,SYS_Famous.[DR]";
            tables = "SYS_Famous left join District3Level on [HomeTown] = District3Level.SysNo3";
            order = "SYS_Famous.SysNo asc";
            where = "1=1";
            if (name != "")
            {
                where += " and (";
                string[] tmpstr = name.Split(new char[] { ' ' });
                for (int i = 0; i < tmpstr.Length; i++)
                {
                    where += " (SYS_Famous.[Name] like '%" + SQLData.SQLFilter(tmpstr[i]) + "%' or SYS_Famous.FullName like '%" + SQLData.SQLFilter(tmpstr[i]) + "%') and ";
                }
                where += " 1=1)";
            }
            if (timeBegin != AppCmn.AppConst.DateTimeNull)
            {
                where += " and (BirthYear>" + timeBegin.Year.ToString() +
                    " or (BirthYear=" + timeBegin.Year.ToString() + " and BirthTime>='" + timeBegin.AddYears(AppConst.DateTimeNull.Year - timeBegin.Year).ToString("yyyy-MM-dd 00:00:00") + "'))";
            }
            if (timeEnd != AppCmn.AppConst.DateTimeNull)
            {
                where += " and (BirthYear<" + timeEnd.Year.ToString() +
                    " or (BirthYear=" + timeEnd.Year.ToString() + " and BirthTime<='" + timeEnd.AddYears(AppConst.DateTimeNull.Year - timeEnd.Year).ToString("yyyy-MM-dd 23:59:59") + "'))";
            }
            if (status != "" && status != "100")
            {
                where += " and dr=" + status;
            }
            if (istop)
            {
                where += " and istop=" + (int)AppEnum.BOOL.True;
            }
            #endregion

            using (SQLData m_data = new SQLData())
            {
                    m_data.AddParameter("SelectList", columns);
                    m_data.AddParameter("TableSource", tables);
                    m_data.AddParameter("SearchCondition", where);
                    m_data.AddParameter("OrderExpression", order);
                    m_data.AddParameter("PageIndex", pageindex);
                    m_data.AddParameter("pagesize", pagesize);
                    DataSet m_ds = m_data.SPtoDataSet("GetRecordFromPage");
                    if (m_ds.Tables.Count == 2)
                    {
                        m_dt = m_ds.Tables[0];
                        total = int.Parse(m_ds.Tables[1].Rows[0][0].ToString());
                    }
            }
            return m_dt;
        }
示例#31
0
 public DataTable GetTodayTopList(int count)
 {
     DataTable m_dt = new DataTable();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select top ").Append(count).Append(" SysNo,[Name],[FullName],[Gender],photo from SYS_Famous where istop=").Append((int)AppEnum.BOOL.True)
             .Append(" and BirthTime>='").Append(new DateTime(AppConst.DateTimeNull.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0))
             .Append("' and BirthTime<='").Append(new DateTime(AppConst.DateTimeNull.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59))
             .Append("' and dr=").Append((int)AppEnum.State.normal);
         try
         {
             m_dt = data.CmdtoDataTable(builder.ToString());
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
     return m_dt;
 }