Пример #1
0
        public static void BindDDL_Cid(ListOptions options, DropDownList ddl, int cid, int pid, string separator)
        {
            int numResults = 0;
            List<CategoryInfo> list = (new CCategory(LANG)).Getlist(cid, pid, options, out numResults);
            if (list == null) return;

            foreach (CategoryInfo info in list)
            {
                string sep = pid == 0 ? "" : separator + "---";
                ListItem item = new ListItem(sep + info.Name, info.Id.ToString());
                ddl.Items.Add(item);
                BindDDL_Cid(options, ddl, cid, info.Id, sep);
            }
        }
Пример #2
0
        public static void BindDDL_Cid_DDL(ListOptions options, DropDownList ddl, int cid, int pid, string separator)
        {
            options.SortExp = Queryparam.Sqlcolumn.Orderd;
            options.GetAll = true;

            List<CategoryInfo> list = (new CCategory(CCommon.LANG)).Wcmm_Getlist(cid, pid, options);
            if (list == null) return;

            foreach (CategoryInfo info in list)
            {
                string sep = pid == 0 ? "" : separator + "---";
                ListItem item = new ListItem(sep + info.Name, info.Id.ToString());
                ddl.Items.Add(item);
                BindDDL_Cid_DDL(options, ddl, cid, info.Id, sep);
            }
        }
Пример #3
0
        public ListOptions Get_ListOptions()
        {
            ListOptions options = new ListOptions();
            options.PageIndex = PageIndex;
            options.PageSize = PageSize;
            options.SortExp = SortExp;
            options.SortDir = SortDir.ToString();

            UserInfo user = CCommon.Get_CurrentUser();
            if (user != null)
            {
                options.Username = user.Username;
                options.GetAll = CCommon.Right_sys();
            }
            return options;
        }
Пример #4
0
        public List<MemberInfo> Wcmm_Search(int grouptype, string keywords, ListOptions options, out int numResults)
        {
            try
            {
                List<MemberInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                    string Searchquery = CGeneral.Get_Searchquery(keywords);
                    SQL += grouptype == -1 ? "" : " AND A.grouptype=" + grouptype;
                    SQL += CFunctions.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            MemberInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<MemberInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Searchcount(iConn, grouptype, keywords, options);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        private int Wcmm_Getlistcount(iSqlConnection iConn, int memberid, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += memberid == 0 ? "" : " AND A.memberid=" + memberid;

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #6
0
        public List<MeCreditcardHistoryInfo> Wcmm_Search(int memberid, string keywords, ListOptions options, out int numResults)
        {
            try
            {
                List<MeCreditcardHistoryInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += memberid == 0 ? "" : " AND A.memberid=" + memberid;
                    string Searchquery = CGeneral.Get_Searchquery(keywords);
                    SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        CMember DALMem = new CMember(LANG);
                        while (dar.Read())
                        {
                            MeCreditcardHistoryInfo info = this.getDataReader(dar);
                            info.iMember = DALMem.Getinfo(info.Memberid);
                            if (arr == null)
                                arr = new List<MeCreditcardHistoryInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Searchcount(iConn, memberid, keywords, options);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #7
0
        private int Wcmm_Searchcount(iSqlConnection iConn, string Setof_Catalogue, string keywords, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                SQL += CFunctions.IsNullOrEmpty(Setof_Catalogue) ? "" : " AND A.cid IN(" + Setof_Catalogue + ")";
                string Searchquery = CGeneral.Get_Searchquery(keywords);
                SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #8
0
        private int Searchcount(iSqlConnection iConn, string Setof_Catalogue, string keywords, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
                SQL += CFunctions.IsNullOrEmpty(Setof_Catalogue) ? "" : " AND A.cid IN(" + Setof_Catalogue + ")";
                string Searchquery = CGeneral.Get_Searchquery(keywords);
                SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #9
0
        private int Wcmm_Getlistcount(iSqlConnection iConn, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #10
0
        public List<FileattachInfo> Getlist(int belongto, int iid, ListOptions options, out int numResults)
        {
            try
            {
                List<FileattachInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
                    SQL += " AND A.belongto=" + belongto;
                    SQL += " AND A.iid=" + iid;
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            FileattachInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<FileattachInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    numResults = this.Getlistcount(iConn, belongto, iid, options.Markas);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #11
0
        public List<FeedbackInfo> Wcmm_Getlist(int pid, ListOptions options, out int numResults)
        {
            try
            {
                List<FeedbackInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.pid=" + pid;
                    SQL += " AND A.pis=0";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            FeedbackInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<FeedbackInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Getlistcount(iConn, pid);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #12
0
 private int Getlistcount(iSqlConnection iConn, ListOptions options)
 {
     try
     {
         int numResults = 0;
         string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
         SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
         SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
         SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
         using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
         {
             if (dar.Read())
             {
                 numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
             }
         }
         return numResults;
     }
     catch
     {
         return 0;
     }
 }
Пример #13
0
        public List<CategoryInfo> Getlist(int cid, int pid, ListOptions options, out int numResults)
        {
            try
            {
                List<CategoryInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
                    SQL += cid == 0 ? "" : " AND A.cid=" + cid;
                    SQL += pid == -1 ? "" : " AND A.pid=" + pid;
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            CategoryInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<CategoryInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    numResults = this.Getlistcount(iConn, cid, pid);
                    if(arr != null)
                    {
                        foreach (var cate in arr)
                        {
                            if (cate.Pid == 61)
                            {
                                CNews news = new CNews("vn");
                                cate.dictCount = news.GetDictCount(iConn, cate.Id.ToString());
                            }
                        }
                    }

                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #14
0
        private int Wcmm_Searchcount(iSqlConnection iConn, string categoryid, string Searchquery, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                SQL += CFunctions.IsNullOrEmpty(categoryid) ? "" : " AND A.id IN(SELECT iid FROM " + LANG + CConstants.TBDBPREFIX + "itemcategory WHERE categoryid IN(" + categoryid + ") AND belongto=" + Webcmm.Id.Video + ")";
                SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #15
0
        private int Searchcount(iSqlConnection iConn, string categoryid, string Searchquery, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
                SQL += CFunctions.IsNullOrEmpty(categoryid) ? "" : " AND A.id IN(SELECT iid FROM " + LANG + CConstants.TBDBPREFIX + "itemcategory WHERE categoryid IN(" + categoryid + ") AND belongto=" + Webcmm.Id.Video + ")";
                SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #16
0
        public List<LibrariesInfo> Search(int cid, string keywords, ListOptions options, out int numResults)
        {
            try
            {
                List<LibrariesInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string Setof_Catalogue = cid == 0 ? "" : (new CCategory(LANG)).Get_setof(cid, "");
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
                    SQL += cid == 0 ? "" : " AND A.cid IN(" + Setof_Catalogue + ")";
                    string Searchquery = CGeneral.Get_Searchquery(keywords);
                    SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            LibrariesInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<LibrariesInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    numResults = this.Searchcount(iConn, Setof_Catalogue, keywords, options);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #17
0
        public List<LibrariesInfo> Wcmm_Getlist(int cid, ListOptions options, out int numResults)
        {
            try
            {
                List<LibrariesInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string Setof_Catalogue = cid == 0 ? "" : (new CCategory(LANG)).Get_setof(cid, "");
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                    SQL += cid == 0 ? "" : " AND A.cid IN(" + Setof_Catalogue + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            LibrariesInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<LibrariesInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Getlistcount(iConn, Setof_Catalogue, options);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #18
0
        public List<GeneralInfo> Getlist_extend(int belongto, int aid, ListOptions options)
        {
            try
            {
                List<GeneralInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = "SELECT A.name, A.introduce, A.description, A.filepreview, A.cid, A.iconex, A.status, A.timeupdate, A.username, A.id, ROW_NUMBER() OVER(ORDER BY A." + options.SortExp + (options.SortDir == "Ascending" ? " ASC" : " DESC") + ") AS rownumber FROM " + TABLENAME + " AS A"
                        + " INNER JOIN " + LANG + CConstants.TBDBPREFIX + "extenditem AS J ON J.iid=A.id";
                    SQL += belongto == 0 ? "" : " AND J.belongto=" + belongto;
                    SQL += aid == 0 ? "" : " AND J.aid=" + aid;
                    SQL += " WHERE A.id<>0 AND A.status<>" + (int)CConstants.State.Status.Deleted;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            GeneralInfo info = this.getDataReader_ext(dar);
                            if (arr == null)
                                arr = new List<GeneralInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #19
0
        public List<LibrariesInfo> Wcmm_Report(SearchInfo isearch, ListOptions options, out int numResults)
        {
            try
            {
                List<LibrariesInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    isearch.Setof_Category = isearch.Cid == 0 ? "" : (new CCategory(LANG)).Get_setof(isearch.Cid, "");
                    SQL += isearch.Cid == 0 ? "" : " AND A.cid IN(" + isearch.Setof_Category + ")";
                    isearch.Searchquery = CGeneral.Get_Searchquery(isearch.Keywords);
                    SQL += CFunctions.IsNullOrEmpty(isearch.Searchquery) ? "" : " AND (" + isearch.Searchquery + ")";
                    SQL += " AND (A.timeupdate BETWEEN '" + isearch.Datefr + "' AND '" + isearch.Dateto + "')";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            LibrariesInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<LibrariesInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Reportcount(iConn, isearch, options);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #20
0
        public List<GeneralInfo> Search(int belongto, string belongtoname, string categoryid, string keywords, ListOptions options, out int numResults)
        {
            try
            {
                List<GeneralInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING_SEARCH.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += CFunctions.IsNullOrEmpty(categoryid) || categoryid=="0" ? "" : " AND A.id IN(SELECT iid FROM " + LANG + CConstants.TBDBPREFIX + "itemcategory WHERE categoryid IN(" + categoryid + ") AND belongto=" + belongto + ")";
                    string Searchquery = CGeneral.Get_Searchquery(keywords);
                    SQL += CFunctions.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            GeneralInfo info = this.getDataReader_search(dar);
                            info.Belongto = belongto;
                            info.Belongtoname = belongtoname;
                            if (arr == null)
                                arr = new List<GeneralInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Searchcount(iConn, belongto, categoryid, Searchquery);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #21
0
        private int Wcmm_Reportcount(iSqlConnection iConn, SearchInfo isearch, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += CFunctions.IsNullOrEmpty(isearch.Setof_Category) ? "" : " AND A.cid IN(" + isearch.Setof_Category + ")";
                SQL += string.IsNullOrEmpty(isearch.Searchquery) ? "" : " AND (" + isearch.Searchquery + ")";
                SQL += " AND (A.timeupdate BETWEEN '" + isearch.Datefr + "' AND '" + isearch.Dateto + "')";

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #22
0
        public List<GeneralInfo> Wcmm_Getlist(int cid, int pid, ListOptions options)
        {
            try
            {
                List<GeneralInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                    SQL += " AND A.pid=" + pid;
                    if (pid == 0)
                        SQL += cid == 0 ? "" : " AND A.cid IN(" + (new CCategory(LANG)).Get_setof(cid, "") + ")";

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            GeneralInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<GeneralInfo>();
                            arr.Add(info);
                        }
                    }
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #23
0
 public List<MeCreditcardHistoryInfo> Getlist(int memberid, ListOptions options, out int numResults)
 {
     try
     {
         List<MeCreditcardHistoryInfo> arr = null;
         using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
         {
             string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
             SQL += " AND A.memberid=@MEMBERID";
             SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);
             iSqlParameter[] parms = new iSqlParameter[]{
                 new iSqlParameter(PARM_MEMBERID, iSqlType.Field_tInterger),
             };
             int i = -1;
             parms[++i].Value = memberid;
             using (iSqlDataReader dar = HELPER.executeReader(iConn, iCommandType.Text, SQL, parms))
             {
                 while (dar.Read())
                 {
                     MeCreditcardHistoryInfo info = this.getDataReader(dar);
                     if (arr == null)
                         arr = new List<MeCreditcardHistoryInfo>();
                     arr.Add(info);
                 }
                 dar.Close();
             }
             numResults = this.Getlistcount(iConn, memberid);
             iConn.Close();
         }
         return arr;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #24
0
        public List<GeneralInfo> Wcmm_Getlist_buildmenu(int cid, ListOptions options)
        {
            try
            {
                List<GeneralInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += cid == 0 ? "" : " AND A.cid=" + cid;

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            GeneralInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<GeneralInfo>();
                            arr.Add(info);
                        }
                    }
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #25
0
        public List<CartInfo> GetinfofullCheckout(int memberid, ListOptions options)
        {
            if (memberid == 0) return null;
            try
            {
                List<CartInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.memberid=@MEMBERID";
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += " AND A.checkout=1";

                    iSqlParameter[] parms = new iSqlParameter[]{
                        new iSqlParameter(PARM_MEMBERID, iSqlType.Field_tInterger),
                    };
                    int i = -1;
                    parms[++i].Value = memberid;
                    using (iSqlDataReader dar = HELPER.executeReader(iConn, iCommandType.Text, SQL, parms))
                    {
                        while (dar.Read())
                        {
                            CartInfo info = this.getDataReader(dar);
                            info.lCartitem = (new CCartitem(LANG)).Getlistfull(info.Id);
                            if (arr == null)
                                arr = new List<CartInfo>();
                            arr.Add(info);
                        }
                    }
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #26
0
        public List<GeneralInfo> Wcmm_Getlist_com(int status, ListOptions options, out int numResults)
        {
            try
            {
                List<GeneralInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING_COM.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);
                    SQL += status == (int)CConstants.State.Status.None ? "" : " AND A.status=" + status;
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            GeneralInfo info = this.getDataReader_com(dar);
                            if (arr == null)
                                arr = new List<GeneralInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Getlistcount_com(iConn, status);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #27
0
        private int Wcmm_Searchcount(iSqlConnection iConn, int memberid, string keywords, ListOptions options)
        {
            try
            {
                int numResults = 0;
                string SQL = SQL_COUNT.Replace(Queryparam.Varstring.VAR_TABLENAME, TABLENAME);
                SQL += memberid == 0 ? "" : " AND A.memberid=" + memberid;
                string Searchquery = CGeneral.Get_Searchquery(keywords);
                SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";

                using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                {
                    if (dar.Read())
                    {
                        numResults = dar.IsDBNull(0) ? 0 : dar.GetInt32(0);
                    }
                }
                return numResults;
            }
            catch
            {
                return 0;
            }
        }
Пример #28
0
        public List<GeneralInfo> Wcmm_Search_extend(string keywords, int belongto, int aid, ListOptions options)
        {
            try
            {
                List<GeneralInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = "SELECT A.name, A.status, A.timeupdate, A.username, A.id, ROW_NUMBER() OVER(ORDER BY A." + options.SortExp + (options.SortDir == "Ascending" ? " ASC" : " DESC") + ") AS rownumber FROM " + TABLENAME + " AS A"
                        + " INNER JOIN " + LANG + CConstants.TBDBPREFIX + "extenditem AS J ON J.iid=A.id";
                    SQL += belongto == 0 ? "" : " AND J.belongto=" + belongto;
                    SQL += aid == 0 ? "" : " AND J.aid=" + aid;
                    SQL += " WHERE A.id<>0 AND A.status<>" + (int)CConstants.State.Status.Deleted;
                    SQL += CFunctions.Expression_GetPermit(options.GetAll, options.Username);

                    string Searchquery = CGeneral.Get_Searchquery(keywords);
                    SQL += CFunctions.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            GeneralInfo info = this.getDataReader_com(dar);
                            if (arr == null)
                                arr = new List<GeneralInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #29
0
 private ListOptions Get_ListOptionsMenu()
 {
     ListOptions options = new ListOptions();
     options.SortExp = Queryparam.Sqlcolumn.Orderd;
     options.SortDir = SortDirection.Descending.ToString();
     options.GetAll = true;
     return options;
 }
Пример #30
0
        public List<LibrariesInfo> Getlistrelated(string relateditem, ListOptions options)
        {
            if (CFunctions.IsNullOrEmpty(relateditem)) return null;
            try
            {
                List<LibrariesInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += " AND A.id IN(" + relateditem + ")";

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            LibrariesInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<LibrariesInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }