public JsonResult DoImport() { var success = true; var message = "保存成功!"; var user = OperatorProvider.Provider.Current(); if (this.Request.Files.Count > 0) { var book = new Workbook(this.Request.Files[0].InputStream); var sheet = book.Worksheets[0]; var Bll = new CarcOrCardBLL(); try { var titleIndex = this.GetTitleRow(sheet); var data = this.GetData(sheet, titleIndex, user.UserId); Bll.CSaveForm(data, user.UserId); } catch (Exception e) { success = false; message = e.Message; } } return(Json(new AjaxResult() { type = success ? ResultType.success : ResultType.error, message = message })); }
/// <summary> /// 获取数据 /// </summary> /// <param name="keyvalue"></param> /// <returns></returns> public ActionResult getCEntity(string keyvalue) { var Bll = new CarcOrCardBLL(); var data = Bll.GetCDetail(keyvalue); return(Content(data.ToJson())); }
public ActionResult delEntity(string keyvalue) { try { var Bll = new CarcOrCardBLL(); Bll.deleteEntity(keyvalue); return(Success("操作成功。")); } catch (Exception ex) { return(Error(ex.Message)); } }
/// <summary> /// 获取数据 /// </summary> /// <param name="keyvalue"></param> /// <returns></returns> public ActionResult getEntity(string keyvalue) { var Bll = new CarcOrCardBLL(); var data = Bll.GetDetail(keyvalue); foreach (var item in data.Files) { if (!string.IsNullOrEmpty(item.FilePath)) { item.FilePath = string.Format("{0}://{1}{2}", this.Request.Url.Scheme, this.Request.Url.Host, Url.Content(item.FilePath)); } } return(Content(data.ToJson())); }
public ActionResult CSaveForm(CCardEntity entity) { try { var user = OperatorProvider.Provider.Current(); var Bll = new CarcOrCardBLL(); var list = new List <CCardEntity>(); list.Add(entity); Bll.CSaveForm(list, user.UserId); return(Success("操作成功。")); } catch (Exception ex) { return(Error(ex.Message)); } }
/// <summary> /// 用户列表 /// </summary> /// <param name="pagination">分页参数</param> /// <param name="queryJson">查询参数</param> /// <returns>返回分页列表Json</returns> public ActionResult GetCardPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); //var queryParam = queryJson.ToJObject(); var Bll = new CarcOrCardBLL(); var user = OperatorProvider.Provider.Current(); var data = Bll.GetCPageList(pagination, queryJson, user.UserId); var jsonStr = JsonConvert.SerializeObject(data); var JsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }