예제 #1
0
 /// <summary>
 /// 缓存单据步骤
 /// </summary>
 /// <returns></returns>
 public static Orders.OrderSteps GetOrderSteps()
 {
     Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
     Orders.OrderSteps        x     = cache.RetrieveObject("/Sys/OrderSteps") as Orders.OrderSteps;
     if (x == null)
     {
         x = Orders.OrderSteps.GetOrderSteps();
         cache.AddObject("/Sys/OrderSteps", x);
     }
     return(x);
 }
예제 #2
0
        /// <summary>
        /// 缓存仓库列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetStorageInfoList(string tSQL)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/GetStorageInfoList_" + Utils.MD5(tSQL)) as DataTable;

            if (x == null)
            {
                x = tbStorageInfo.GetStorageInfoList(tSQL).Tables[0];
                cache.AddObject("/Sys/GetStorageInfoList_" + Utils.MD5(tSQL), x);
            }
            return(x);
        }
예제 #3
0
        /// <summary>
        /// 缓存权限列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetUserPopedom()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/UserPopedom") as DataTable;

            if (x == null)
            {
                x = UsersUtils.GetUserPopedom();
                cache.AddObject("/Sys/UserPopedom", x);
            }
            return(x);
        }
예제 #4
0
        /// <summary>
        /// 超市系统列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetYHsysInfoList()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/GetYHsysInfoList") as DataTable;

            if (x == null)
            {
                x = tbYHsysInfo.GetYHsysInfoList("").Tables[0];
                cache.AddObject("/Sys/GetYHsysInfoList", x);
            }
            return(x);
        }
예제 #5
0
        /// <summary>
        /// 部门,人员,树形
        /// </summary>
        /// <returns></returns>
        public static string GetDepartmentsClassInfoAndStaffListToHTML()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetDepartmentsClassInfoAndStaffListToHTML") as string;

            if (x == null)
            {
                x = DataClass.GetDepartmentsClassInfoAndStaffListToHTML();
                cache.AddObject("/Sys/GetDepartmentsClassInfoAndStaffListToHTML", x);
            }
            return(x);
        }
예제 #6
0
        /// <summary>
        /// 获得地区列表XML
        /// </summary>
        public static string GetRegionListToXML(int PRegionID)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/RegionList_" + PRegionID.ToString()) as string;

            if (x == null)
            {
                x = tbRegionInfo.GetRegionListToXML(PRegionID);
                cache.AddObject("/Sys/RegionList_" + PRegionID.ToString(), x);
            }
            return(x);
        }
예제 #7
0
        public static DataSet GetProductLogDetails(DateTime bDate, DateTime eDate, int ProductsID, int CostPrice, int StorageID)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataSet x = cache.RetrieveObject("/Sys/GetProductLogDetails_" + Utils.MD5(ProductsID.ToString() + bDate.ToString() + eDate.ToString() + CostPrice.ToString() + StorageID.ToString())) as DataSet;

            if (x == null)
            {
                x = DataUtils.GetProductLogDetails(bDate, eDate, ProductsID, CostPrice, StorageID);
                cache.AddObject("/Sys/GetProductLogDetails_" + Utils.MD5(ProductsID.ToString() + bDate.ToString() + eDate.ToString() + CostPrice.ToString() + StorageID.ToString()), x);
            }
            return(x);
        }
예제 #8
0
        /// <summary>
        /// 科目
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="getdata"></param>
        /// <param name="isAll"></param>
        /// <returns></returns>
        public static string GetFeesSubjectClassInfoToJson(int pid, bool getdata, bool isAll)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetFeesSubjectClassInfoToJson_" + Utils.MD5(pid.ToString() + getdata.ToString() + isAll.ToString())) as string;

            if (x == null)
            {
                x = DataClass.GetFeesSubjectClassInfoToJson(pid, getdata, isAll);
                cache.AddObject("/Sys/GetFeesSubjectClassInfoToJson_" + Utils.MD5(pid.ToString() + getdata.ToString() + isAll.ToString()), x);
            }
            return(x);
        }
예제 #9
0
        public static DataTable GetSalesReport(int ReDateType, int ReType, DateTime bDate, DateTime eDate, int NOJoinSales, int StoresID, int PaymentSystemID, int oSteps, int dType, int CostPrice, int SingleMemberID, string OrderNumber)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/GetSalesReport_" + Utils.MD5(ReDateType.ToString() + ReType.ToString() + bDate.ToString() + eDate.ToString() + NOJoinSales.ToString() + StoresID.ToString() + PaymentSystemID.ToString() + oSteps.ToString() + dType.ToString() + CostPrice.ToString() + SingleMemberID.ToString() + OrderNumber)) as DataTable;

            if (x == null)
            {
                x = DataUtils.GetSalesReport(ReDateType, ReType, bDate, eDate, NOJoinSales, StoresID, PaymentSystemID, oSteps, dType, CostPrice, SingleMemberID, OrderNumber);
                cache.AddObject("/Sys/GetSalesReport_" + Utils.MD5(ReDateType.ToString() + ReType.ToString() + bDate.ToString() + eDate.ToString() + NOJoinSales.ToString() + StoresID.ToString() + PaymentSystemID.ToString() + oSteps.ToString() + dType.ToString() + CostPrice.ToString() + SingleMemberID.ToString() + OrderNumber), x);
            }
            return(x);
        }
예제 #10
0
        /// <summary>
        /// 获取商品类目列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetGoodsCatList(int mconfigid)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/GetGoodsCatList_" + mconfigid) as DataTable;

            if (x == null)
            {
                x = M_Utils.GetM_GoodsCatInfoList(" m_ConfigInfoID=" + mconfigid).Tables[0];
                cache.AddObject("/Sys/GetGoodsCatList_" + mconfigid, x);
            }
            return(x);
        }
예제 #11
0
        /// <summary>
        /// 网店列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetMConfigList()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/GetMConfigList") as DataTable;

            if (x == null)
            {
                x = M_Utils.GetM_ConfigInfoList(" m_State=0 order by m_ConfigInfoID desc").Tables[0];
                cache.AddObject("/Sys/GetMConfigList", x);
            }
            return(x);
        }
예제 #12
0
        /// <summary>
        /// 结算系统列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetPaymentSystemData()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            DataTable x = cache.RetrieveObject("/Sys/GetPaymentSystemData") as DataTable;

            if (x == null)
            {
                x = tbPaymentSystemInfo.GetPaymentSystemList("").Tables[0];
                cache.AddObject("/Sys/GetPaymentSystemData", x);
            }
            return(x);
        }
예제 #13
0
        public static string GetProductClassInfoToJson(int t, bool p, int orderType = 0)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetProductClassInfoToJson_" + Utils.MD5(t.ToString() + p.ToString() + orderType.ToString())) as string;

            if (x == null)
            {
                x = DataClass.GetProductClassInfoToJson(t, p, orderType);
                cache.AddObject("/Sys/GetProductClassInfoToJson_" + Utils.MD5(t.ToString() + p.ToString() + orderType.ToString()), x);
            }
            return(x);
        }
예제 #14
0
        /// <summary>
        /// 仓库信息分类
        /// </summary>
        /// <param name="t"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static string GetStorageClassInfoToJson(int t, bool p)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetStorageClassInfoToJson_" + Utils.MD5(t.ToString() + p.ToString())) as string;

            if (x == null)
            {
                x = DataClass.GetStoragesClassInfoToJson(t, p);
                cache.AddObject("/Sys/GetStorageClassInfoToJson_" + Utils.MD5(t.ToString() + p.ToString()), x);
            }
            return(x);
        }
예제 #15
0
        public static string GetRegionInfoToJson()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetRegionInfoToJson") as string;

            if (x == null)
            {
                x = DataClass.GetRegionInfoToJson();
                cache.AddObject("/Sys/GetRegionInfoToJson", x);
            }
            return(x);
        }
예제 #16
0
        public static string GetRegionInfoToHTML(int t)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetRegionInfoToHTML_" + Utils.MD5(t.ToString())) as string;

            if (x == null)
            {
                x = DataClass.GetRegionInfoToHTML(t);
                cache.AddObject("/Sys/GetRegionInfoToHTML_" + Utils.MD5(t.ToString()), x);
            }
            return(x);
        }
예제 #17
0
        /// <summary>
        /// 供应商分类,供应商列表,树
        /// </summary>
        /// <returns></returns>
        public static string GetSupplierClassInfoAndDataToHTML()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetSupplierClassInfoAndDataToHTML") as string;

            if (x == null)
            {
                x = DataClass.GetSupplierClassInfoAndDataToHTML();
                cache.AddObject("/Sys/GetSupplierClassInfoAndDataToHTML", x);
            }
            return(x);
        }
예제 #18
0
        /// <summary>
        /// 取网店配置信息
        /// </summary>
        /// <param name="mconfigid"></param>
        /// <returns></returns>
        public static M_ConfigInfo GetMConfig(int mconfigid)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            M_ConfigInfo             x     = cache.RetrieveObject("/Sys/GetMConfigList_" + mconfigid) as M_ConfigInfo;

            if (x == null)
            {
                x          = M_Utils.GetM_ConfigInfoModel(mconfigid);
                x.m_APIURL = GeneralConfigs.GetConfig().Taobao_Api.Trim();
                cache.AddObject("/Sys/GetMConfigList_" + mconfigid, x);
            }
            return(x);
        }
예제 #19
0
        /// <summary>
        /// 获得天气预报
        /// </summary>
        public static Weather GetWeather(string CityName)
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            Weather w = cache.RetrieveObject("/Sys/Weather" + Utils.MD5(CityName)) as Weather;

            if (w == null)
            {
                w = WeatherWebService.getWeatherbyCityName(CityName);//接口获取天气数据
                cache.AddObject("/Sys/Weather" + Utils.MD5(CityName), w);
            }

            return(w);
        }
예제 #20
0
        /// <summary>
        /// 单体模式返回当前类的实例
        /// </summary>
        /// <returns></returns>
        public static YannyoCache GetCacheService()
        {
            if (instance == null)
            {
                lock (lockHelper)
                {
                    if (instance == null)
                    {
                        instance = CachesFileMonitor.CheckAndRemoveCache(new YannyoCache());
                    }
                }
            }

            return(instance);
        }
예제 #21
0
        /// <summary>
        /// 检查和移除缓存
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public static YannyoCache CheckAndRemoveCache(YannyoCache instance)//
        {
            //当程序运行中cache.config发生变化时则对缓存对象做删除的操作
            cachefilenewchange = System.IO.File.GetLastWriteTime(path);
            if (cachefileoldchange != cachefilenewchange)
            {
                lock (cachelockHelper)
                {
                    if (cachefileoldchange != cachefilenewchange)
                    {
                        //当有要清除的项时
                        DataSet dsSrc = new DataSet();
                        dsSrc.ReadXml(path);
                        foreach (DataRow dr in dsSrc.Tables[0].Rows)
                        {
                            if (dr["xpath"].ToString().Trim() != "")
                            {
                                DateTime removedatetime = DateTime.Now;
                                try
                                {
                                    removedatetime = Convert.ToDateTime(dr["removedatetime"].ToString().Trim());
                                }
                                catch
                                {
                                    ;
                                }

                                if (removedatetime > cachefilenewchange.AddSeconds(-2))
                                {
                                    string xpath = dr["xpath"].ToString().Trim();
                                    instance.RemoveObject(xpath, false);
                                }
                            }
                        }

                        cachefileoldchange = cachefilenewchange;

                        dsSrc.Dispose();
                    }
                }
            }

            return(instance);
        }
예제 #22
0
        /// <summary>
        /// 结算系统Json
        /// </summary>
        /// <returns></returns>
        public static string GetPaymentSystemJson()
        {
            Yannyo.Cache.YannyoCache cache = Yannyo.Cache.YannyoCache.GetCacheService();
            string x = cache.RetrieveObject("/Sys/GetPaymentSystemDataJson") as string;

            if (x == null)
            {
                string    _x  = "";
                DataTable _ps = new DataTable();
                _ps = Caches.GetPaymentSystemData();
                if (_ps != null)
                {
                    foreach (DataRow _dr in _ps.Rows)
                    {
                        _x += "{\"data\":\"" + _dr["pName"] + "\",\"state\":\"closed\",\"attr\":{\"id\":\"d_" + _dr["PaymentSystemID"] + "\",\"rel\":\"dt\",\"pid\":\"0\",\"cDirection\":\"\",\"cCode\":\"\",\"otype\":\"3\",\"children\":[]}},";
                    }
                    x = Utils.ReSQLSetTxt(_x);
                }

                cache.AddObject("/Sys/GetPaymentSystemDataJson", x);
            }
            return(x);
        }
예제 #23
0
 private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     //检查并移除相应的缓存项
     instance = CachesFileMonitor.CheckAndRemoveCache(instance);
 }