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

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

            return(result);
        }
 public string Upd(MaterialUnitMultiple 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 <MaterialUnitMultiple> listMaterialUnitMultiple = new List <MaterialUnitMultiple>();
            MaterialUnitMultiple        entity = _app.FindSingle(u => u.Id > 0);

            if (entity != null)
            {
                listMaterialUnitMultiple.Add(entity);
            }
            else
            {
                listMaterialUnitMultiple.Add(new MaterialUnitMultiple());
            }

            result.data  = listMaterialUnitMultiple;
            result.count = listMaterialUnitMultiple.Count;

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

            for (int i = 0; i < exp.Count; i++)
            {
                try
                {
                    MaterialUnitMultiple 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);
        }
Ejemplo n.º 5
0
 public void Upd(MaterialUnitMultiple entity)
 {
     _app.Update(entity);
 }
Ejemplo n.º 6
0
 public void Ins(MaterialUnitMultiple entity)
 {
     _app.Add(entity);
 }
Ejemplo n.º 7
0
 public TableData Load(PageReq pageRequest, MaterialUnitMultiple entity)
 {
     return(_app.Load(pageRequest, entity));
 }
Ejemplo n.º 8
0
 public TableData ExportData(MaterialUnitMultiple entity)
 {
     return(_app.ExportData(entity));
 }
 public string Load(PageReq pageRequest, MaterialUnitMultiple entity)
 {
     return(JsonHelper.Instance.Serialize(_app.Load(pageRequest, entity)));
 }
 public string Export(MaterialUnitMultiple entity)
 {
     return(JsonHelper.Instance.Serialize(_app.ExportData(entity)));
 }