Example #1
0
 public static Measure_CE ToCE(MeasureEntity item)
 {
     Measure_CE target = new Measure_CE();
     target.ID=item.ID;
     target.SN=item.SN;
     target.MeasureNum=item.MeasureNum;
     target.MeasureName=item.MeasureName;
     return target;
 }
Example #2
0
 /// <summary>
 /// 添加计量单位
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int AddMeasure(MeasureEntity entity)
 {
     entity.IncludeAll();
     int line = this.Measure.Add(entity);
     if (line > 0)
     {
         CacheHelper.Remove(CacheKey.JOOSHOW_MEASURE_CACHE);
     }
     return line;
 }
Example #3
0
 /// <summary>
 /// 根据计量单位删除
 /// </summary>
 /// <param name="measureNum"></param>
 /// <returns></returns>
 public int DeleteMeasure(string measureNum)
 {
     MeasureEntity entity = new MeasureEntity();
     entity.Where(a => a.MeasureNum == measureNum);
     int line = this.Measure.Delete(entity);
     if (line > 0)
     {
         CacheHelper.Remove(CacheKey.JOOSHOW_MEASURE_CACHE);
     }
     return line;
 }
Example #4
0
 /// <summary>
 /// 编辑计量单位
 /// </summary>
 /// <param name="measureNum"></param>
 /// <param name="measureName"></param>
 /// <returns></returns>
 public int EditMeasure(string measureNum, string measureName)
 {
     MeasureEntity entity = new MeasureEntity();
     entity.MeasureName = measureName;
     entity.IncludeMeasureName(true);
     entity.Where(a => a.MeasureNum == measureNum);
     int line = this.Measure.Update(entity);
     if (line > 0)
     {
         CacheHelper.Remove(CacheKey.JOOSHOW_MEASURE_CACHE);
     }
     return line;
 }
 public ActionResult Create(string Num, string Name)
 {
     if (Num.IsEmpty())
     {
         MeasureEntity entity = new MeasureEntity();
         entity.MeasureNum = SequenceProvider.GetSequence(typeof(MeasureEntity));
         entity.MeasureName = Name;
         entity.SN = SequenceProvider.GetSequence(typeof(MeasureEntity));
         MeasureProvider provider = new MeasureProvider();
         int line = provider.AddMeasure(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("Key", "1000");
             this.ReturnJson.AddProperty("Value", "添加成功");
         }
         else
         {
             this.ReturnJson.AddProperty("Key", "1001");
             this.ReturnJson.AddProperty("Value", "添加失败");
         }
     }
     else
     {
         MeasureProvider provider = new MeasureProvider();
         int line = provider.EditMeasure(Num,Name);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("Key", "1000");
             this.ReturnJson.AddProperty("Value", "编辑成功");
         }
         else
         {
             this.ReturnJson.AddProperty("Key", "1001");
             this.ReturnJson.AddProperty("Value", "编辑失败");
         }
     }
     return Content(this.ReturnJson.ToString());
 }
Example #6
0
 /// <summary>
 /// 查询分页计量单位
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List<MeasureEntity> GetList(MeasureEntity entity, ref PageInfo pageInfo)
 {
     List<MeasureEntity> listResult = GetList();
     if (!listResult.IsNullOrEmpty())
     {
         int rowCount = 0;
         rowCount = listResult.Where(a=>a.MeasureName.Contains(entity.MeasureName)).Count();
         pageInfo.RowCount = rowCount;
         return listResult.Where(a => a.MeasureName.Contains(entity.MeasureName)).Skip((pageInfo.PageIndex - 1) * pageInfo.PageSize).Take(pageInfo.PageSize).ToList();
     }
     return null;
 }
Example #7
0
 /// <summary>
 /// 获得所有的计量单位
 /// </summary>
 /// <returns></returns>
 public List<MeasureEntity> GetList()
 {
     List<MeasureEntity> listResult = CacheHelper.Get(CacheKey.JOOSHOW_MEASURE_CACHE) as List<MeasureEntity>;
     if (!listResult.IsNullOrEmpty())
     {
         return listResult;
     }
     MeasureEntity entity = new MeasureEntity();
     entity.IncludeAll();
     listResult = this.Measure.GetList(entity);
     if (!listResult.IsNullOrEmpty())
     {
         CacheHelper.Insert(CacheKey.JOOSHOW_MEASURE_CACHE,listResult);
     }
     return listResult;
 }
 public ActionResult GetMeasure()
 {
     string name = WebUtil.GetFormValue<string>("name",string.Empty);
     int pageIndex = WebUtil.GetFormValue<int>("pageIndex",1);
     int pageSize = WebUtil.GetFormValue<int>("pageSize", 10);
     PageInfo pageInfo = new PageInfo() { PageIndex=1,PageSize=pageSize };
     MeasureProvider provider = new MeasureProvider();
     MeasureEntity entity = new MeasureEntity();
     entity.MeasureName = name;
     List<MeasureEntity> listResult = provider.GetList(entity, ref pageInfo);
     listResult = listResult.IsNull() ? new List<MeasureEntity>() : listResult;
     string json = ConvertJson.ListToJson<MeasureEntity>(listResult);
     this.ReturnJson.AddProperty("List",json);
     this.ReturnJson.AddProperty("RowCount",pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }