Exemplo n.º 1
0
        public TableData Query(ProductBarcodeRule entity)
        {
            var result = new TableData();
            var data   = _app.Find(EntityToExpression <ProductBarcodeRule> .GetExpressions(entity));

            GetData(data, result);
            result.count = data.Count();

            return(result);
        }
 public string Upd(ProductBarcodeRule Table_entity)
 {
     try
     {
         _app.Upd(Table_entity);
     }
     catch (Exception ex)
     {
         Result.Status  = false;
         Result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }
        public string GetTemplate()
        {
            var result = new TableData();
            List <ProductBarcodeRule> listProductBarcodeRule = new List <ProductBarcodeRule>();
            ProductBarcodeRule        entity = _app.FindSingle(u => u.Id > 0);

            if (entity != null)
            {
                listProductBarcodeRule.Add(entity);
            }
            else
            {
                listProductBarcodeRule.Add(new ProductBarcodeRule());
            }

            result.data  = listProductBarcodeRule;
            result.count = listProductBarcodeRule.Count;

            return(JsonHelper.Instance.Serialize(result));
        }
Exemplo n.º 4
0
        public Response ImportIn(IFormFile excelfile)
        {
            Response result = new Infrastructure.Response();
            List <ProductBarcodeRule> exp = imp.ConvertToModel <ProductBarcodeRule>(excelfile);
            string sErrorMsg = "";

            for (int i = 0; i < exp.Count; i++)
            {
                try
                {
                    ProductBarcodeRule e = exp[i];
                    e.Id = null;
                    _app.Add(e);
                }
                catch (Exception ex)
                {
                    sErrorMsg     += "第" + (i + 2) + "行:" + ex.Message + "<br>";
                    result.Message = sErrorMsg;
                    break;
                }
            }
            if (sErrorMsg.Equals(string.Empty))
            {
                if (exp.Count == 0)
                {
                    sErrorMsg     += "没有发现有效数据, 请确定模板是否正确, 或是否有填充数据!";
                    result.Message = sErrorMsg;
                }
                else
                {
                    result.Message = "导入完成";
                }
            }
            else
            {
                result.Status  = false;
                result.Message = result.Message;
            }
            return(result);
        }
Exemplo n.º 5
0
 public void Upd(ProductBarcodeRule entity)
 {
     _app.Update(entity);
 }
Exemplo n.º 6
0
 public void Ins(ProductBarcodeRule entity)
 {
     _app.Add(entity);
 }
Exemplo n.º 7
0
 public TableData Load(PageReq pageRequest, ProductBarcodeRule entity)
 {
     return(_app.Load(pageRequest, entity));
 }
Exemplo n.º 8
0
 public TableData ExportData(ProductBarcodeRule entity)
 {
     return(_app.ExportData(entity));
 }
 public string Load(PageReq pageRequest, ProductBarcodeRule entity)
 {
     return(JsonHelper.Instance.Serialize(_app.Load(pageRequest, entity)));
 }
 public string Export(ProductBarcodeRule entity)
 {
     return(JsonHelper.Instance.Serialize(_app.ExportData(entity)));
 }