Beispiel #1
0
        public List <SYNCOperation> GetList(TableObject table)
        {
            string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"];
            string key         = CacheUtility.GetKey(table);
            object obj         = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <SYNCOperation>)obj);
            }
            string sqlStr = "select * from SYNCOperation where LastModified>@LastModified";

            List <SqlParameter> pms = new List <SqlParameter>();

            pms.Add(new SqlParameter("LastModified", table.LastModified));
            List <SYNCOperation> list = SYNCOperationBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #2
0
        public List <OrderItems> GetList(TableObject table)
        {
            string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"];
            string CacheEnable  = ConfigurationManager.AppSettings["CacheEnable"];
            string key          = CacheUtility.GetKey(table);
            object obj          = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <OrderItems>)obj);
            }
            string sqlStr = "";
            string sqlAdd = "";

            if (table.IsValid == 1)
            {
                sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) ";
            }
            sqlStr = @"select * from OrderItems where LastModified>@LastModified 
and OrderID in(select OrderID from OrderStatistics where CustomerID
in(
select CustomerID  FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + "))";
            //string sqlStr = "select * from OrderItems where LastModified>@LastModified";
            List <DbParameter> paras        = new List <DbParameter>();
            string             providerName = ConfigurationManager.ConnectionStrings["CloudTrade"].ProviderName;

            switch (providerName)
            {
            case "MySql.Data.MySqlClient":
                paras.Add(new MySqlParameter("BranchID", table.BranchID));
                paras.Add(new MySqlParameter("SchoolID", table.SchoolID));
                paras.Add(new MySqlParameter("LastModified", table.LastModifiedDate));
                break;

            default:
                paras.Add(new SqlParameter("BranchID", table.BranchID));
                paras.Add(new SqlParameter("SchoolID", table.SchoolID));
                paras.Add(new SqlParameter("LastModified", table.LastModified));
                break;
            }

            List <OrderItems> list = OrderItemsBLL.Search(sqlStr, paras.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #3
0
        public List <JobSearch> GetList(TableObject table)
        {
            string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"];
            string key         = CacheUtility.GetKey(table);
            object obj         = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <JobSearch>)obj);
            }
            string             sqlStr       = "select * from JobSearch where BranchID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified";
            List <DbParameter> paras        = new List <DbParameter>();
            string             providerName = ConfigurationManager.ConnectionStrings["CloudOrganization"].ProviderName;

            switch (providerName)
            {
            case "MySql.Data.MySqlClient":
                paras.Add(new MySqlParameter("BranchID", table.BranchID));
                paras.Add(new MySqlParameter("SchoolID", table.SchoolID));
                paras.Add(new MySqlParameter("LastModified", table.LastModifiedDate));
                break;

            default:
                paras.Add(new SqlParameter("BranchID", table.BranchID));
                paras.Add(new SqlParameter("SchoolID", table.SchoolID));
                paras.Add(new SqlParameter("LastModified", table.LastModified));
                break;
            }
            //if (!string.IsNullOrEmpty(table.StartDate))
            //{
            //    sqlStr += " and OperateTime>@StartDate";
            //    pms.Add(new MySqlParameter("StartDate", table.StartDate));
            //}
            //if (!string.IsNullOrEmpty(table.EndDate))
            //{
            //    sqlStr += " and OperateTime<@EndDate";
            //    pms.Add(new MySqlParameter("EndDate", table.EndDate));
            //}
            List <JobSearch> list = JobSearchBLL.Search(sqlStr, paras.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #4
0
        public List <CustomerSearch> GetList(TableObject table)
        {
            string key         = CacheUtility.GetKey(table);
            string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"];
            object obj         = CacheUtility.Get(key);

            //string key1 = "000_000_000_000_000_074_014_085";
            //byte[] b = CacheUtility.GetByteFromString(key1);

            if (obj != null)
            {
                return((List <CustomerSearch>)obj);
            }
            string sqlAdd = "";

            if (table.IsValid == 1)
            {
                sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) ";
            }
            string sqlStr = @"select * from CustomerSearch where BranchID=@BranchID and XDSchoolID=@SchoolID and LastModified>@LastModified " + sqlAdd + " order by LastModified desc";
            //AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0)
            List <SqlParameter> pms = new List <SqlParameter>();

            pms.Add(new SqlParameter("BranchID", table.BranchID));
            pms.Add(new SqlParameter("SchoolID", table.SchoolID));
            pms.Add(new SqlParameter("LastModified", table.LastModified));
            if (!string.IsNullOrEmpty(table.StartDate))
            {
                sqlStr += " and OperateTime>@StartDate";
                pms.Add(new SqlParameter("StartDate", table.StartDate));
            }
            if (!string.IsNullOrEmpty(table.EndDate))
            {
                sqlStr += " and OperateTime<@EndDate";
                pms.Add(new SqlParameter("EndDate", table.EndDate));
            }
            List <CustomerSearch> list = CustomerSearchBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #5
0
        public List <ProductAssign> GetList(TableObject table)
        {
            string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"];
            string key         = CacheUtility.GetKey(table);
            object obj         = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <ProductAssign>)obj);
            }
            string sqlStr = "select * from ProductAssign where LastModified>@LastModified";

            List <SqlParameter> pms = new List <SqlParameter>();

            //pms.Add(new SqlParameter("BranchID", table.BranchID));
            //pms.Add(new SqlParameter("SchoolID", table.SchoolID));
            pms.Add(new SqlParameter("LastModified", table.LastModified));
            //if (!string.IsNullOrEmpty(table.StartDate))
            //{
            //    sqlStr += " and OperateTime>@StartDate";
            //    pms.Add(new SqlParameter("StartDate", table.StartDate));
            //}
            //if (!string.IsNullOrEmpty(table.EndDate))
            //{
            //    sqlStr += " and OperateTime<@EndDate";
            //    pms.Add(new SqlParameter("EndDate", table.EndDate));
            //}
            List <ProductAssign> list = ProductAssignBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #6
0
        public List <PurchaseOrders> GetList(TableObject table)
        {
            string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"];
            string key         = CacheUtility.GetKey(table);
            object obj         = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <PurchaseOrders>)obj);
            }
            string sqlStr = "select * from PurchaseOrders where CompanyID=@BranchID and SchoolID= @SchoolID and LastModified>@LastModified";

            List <SqlParameter> pms = new List <SqlParameter>();

            pms.Add(new SqlParameter("BranchID", table.BranchID));
            pms.Add(new SqlParameter("SchoolID", table.SchoolID));
            pms.Add(new SqlParameter("LastModified", table.LastModified));
            if (!string.IsNullOrEmpty(table.StartDate))
            {
                sqlStr += " and [LastModifiedDate]>@StartDate";
                pms.Add(new SqlParameter("StartDate", table.StartDate));
            }
            if (!string.IsNullOrEmpty(table.EndDate))
            {
                sqlStr += " and [LastModifiedDate]<@EndDate";
                pms.Add(new SqlParameter("EndDate", table.EndDate));
            }
            List <PurchaseOrders> list = PurchaseOrdersBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #7
0
        public List <Period> GetList(TableObject table)
        {
            string CacheEnable  = ConfigurationManager.AppSettings["CacheEnable"];
            string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"];
            string key          = CacheUtility.GetKey(table);
            object obj          = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <Period>)obj);
            }
            string sqlStr = "";
            string sqlAdd = "";

            if (table.IsValid == 1)
            {
                sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) ";
            }
            byte[] TimeStamp = new byte[8];
            if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(TimeStamp))
            {
                sqlStr = @"select * from [CloudAsset].[dbo].[Period]  where LastModified>@LastModified and AssetID in
(
select AssetID from [CloudAsset].[dbo].[Asset] where [OwnerID]
in(
select CustomerID  FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + "))";
                //  AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0)
            }
            else
            {
                sqlStr = @"  select a.* from [CloudAsset].[dbo].[Period] a 
                  join [dbo].[Asset] b on a.AssetID=b.AssetID where b.SubCompanyID=@BranchID and b.SchoolID=@SchoolID and a.LastModified>@LastModified";
            }


            List <SqlParameter> pms = new List <SqlParameter>();

            pms.Add(new SqlParameter("BranchID", table.BranchID));
            pms.Add(new SqlParameter("SchoolID", table.SchoolID));
            pms.Add(new SqlParameter("LastModified", table.LastModified));
            //if (!string.IsNullOrEmpty(table.StartDate))
            //{
            //    sqlStr += " and AssetCreateDate>@StartDate";
            //    pms.Add(new SqlParameter("StartDate", table.StartDate));
            //}
            //if (!string.IsNullOrEmpty(table.EndDate))
            //{
            //    sqlStr += " and AssetCreateDate<@EndDate";
            //    pms.Add(new SqlParameter("EndDate", table.EndDate));
            //}
            List <Period> list = PeriodBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #8
0
        public List <Asset> GetList(TableObject table)
        {
            string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"];
            string CacheEnable  = ConfigurationManager.AppSettings["CacheEnable"];
            string key          = CacheUtility.GetKey(table);
            object obj          = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <Asset>)obj);
            }
            string sqlStr = "";
            string sqlAdd = "";

            if (table.IsValid == 1)
            {
                sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) ";
            }
            byte[] TimeStamp = new byte[8];
            if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(TimeStamp))
            {
                sqlStr = @"select * from Asset where SubCompanyID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified 
and [OwnerID]
in(
select CustomerID  FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + ")";
                //AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0)
            }
            else
            {
                sqlStr = @"select * from Asset where SubCompanyID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified";
            }
            //[CLOUDCUSTOMER]为链接服务器
//            string sqlStr = @"select * from Asset where SubCompanyID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified
//and [OwnerID]
//in(
//select CustomerID  FROM [CLOUDCUSTOMER].[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID
//  AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0)
//  )";

            List <SqlParameter> pms = new List <SqlParameter>();

            pms.Add(new SqlParameter("BranchID", table.BranchID));
            pms.Add(new SqlParameter("SchoolID", table.SchoolID));
            pms.Add(new SqlParameter("LastModified", table.LastModified));
            //if (!string.IsNullOrEmpty(table.StartDate))
            //{
            //    sqlStr += " and OperateTime>@StartDate";
            //    pms.Add(new SqlParameter("StartDate", table.StartDate));
            //}
            //if (!string.IsNullOrEmpty(table.EndDate))
            //{
            //    sqlStr += " and OperateTime<@EndDate";
            //    pms.Add(new SqlParameter("EndDate", table.EndDate));
            //}
            List <Asset> list = AssetBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }
Beispiel #9
0
        public List <OrderStatistics> GetList(TableObject table)
        {
            string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"];
            string CacheEnable  = ConfigurationManager.AppSettings["CacheEnable"];
            string key          = CacheUtility.GetKey(table);
            object obj          = CacheUtility.Get(key);

            if (obj != null)
            {
                return((List <OrderStatistics>)obj);
            }

            string sqlStr = "";
            string sqlAdd = "";

            if (table.IsValid == 1)
            {
                sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) ";
            }
            sqlStr = @"select * from OrderStatistics where LastModified>@LastModified 
and CustomerID
in(
select CustomerID  FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + ")";

//            byte[] TimeStamp = new byte[8];
//            if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(TimeStamp))
//            {
//                sqlStr = @"select * from OrderStatistics where LastModified>@LastModified
//and CustomerID
//in(
//select CustomerID  FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID
//
//  )";
//                //AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0)
//            }
//            else
//            {
//                sqlStr = @"select * from OrderStatistics where LastModified>@LastModified";
//            }

            //string sqlStr = "select * from OrderStatistics where LastModified>@LastModified";

            List <SqlParameter> pms = new List <SqlParameter>();

            pms.Add(new SqlParameter("LastModified", table.LastModified));
            pms.Add(new SqlParameter("SchoolID", table.SchoolID));

            List <OrderStatistics> list = OrderStatisticsBLL.Search(sqlStr, pms.ToArray());

            if (list.Count > 0)
            {
                byte[] b = new byte[8];
                if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b))
                {
                    CacheUtility.Insert(key, list);
                }
                else
                {
                    if (CacheEnable == "true")
                    {
                        CacheUtility.Insert(key, list);
                    }
                }
            }
            return(list);
        }