Exemple #1
0
        public ActionResult Form(string id)
        {
            Pro_TemplateItem theData = null;

            if (id.Contains("cache_"))
            {
                string       str = id.Replace("cache_", "");
                Sto_Material mat = _sto_MaterialBusiness.GetEntity(str);
                theData = new Pro_TemplateItem()
                {
                    MatName = mat.MatName,
                    MatNo   = mat.MatNo,
                    UnitNo  = mat.UnitNo,
                    GuiGe   = mat.GuiGe,
                    Context = mat.Context
                };
            }
            else
            {
                theData = id.IsNullOrEmpty() ? new Pro_TemplateItem()
                {
                    Id = Guid.NewGuid().ToSequentialGuid()
                } : _pro_TemplateItemBusiness.GetEntity(id);
                if (theData == null)
                {
                    theData = new Pro_TemplateItem()
                    {
                        Id = Guid.NewGuid().ToSequentialGuid()
                    };
                }
            }
            return(View(theData));
        }
Exemple #2
0
 /// <summary>
 /// 创建缓存项目(用于创建工程料单模板时使用)
 /// </summary>
 /// <param name="theData"></param>
 /// <returns></returns>
 public ActionResult CreateCacheItem(Pro_TemplateItem theData)
 {
     theData.Id = "12345";
     if (theData.Id.IsNullOrEmpty())
     {
         return(Error("新建项Id不为空"));
     }
     else
     {
         _systemCache.SetCache(theData.Id, theData, new TimeSpan(0, 1, 0));
     }
     return(Success());
 }
Exemple #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="theData">保存的数据</param>
        public ActionResult SaveData(Pro_TemplateItem theData)
        {
            if (theData.Id.IsNullOrEmpty())
            {
                theData.Id = Guid.NewGuid().ToSequentialGuid();

                _pro_TemplateItemBusiness.AddData(theData);
            }
            else
            {
                _pro_TemplateItemBusiness.UpdateData(theData);
            }

            return(Success());
        }
Exemple #4
0
        public ActionResult FindCacheItem(string id)
        {
            id = "12345";
            var theData = _systemCache.GetCache <Pro_TemplateItem>(id);

            if (theData == null)
            {
                theData = new Pro_TemplateItem();
            }
            else
            {
                //清除缓存
                _systemCache.RemoveCache(id);
            }

            return(Content(theData.ToJson()));
        }