예제 #1
0
        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
            }));
        }
예제 #2
0
        /// <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()));
        }
예제 #3
0
 public ActionResult delEntity(string keyvalue)
 {
     try
     {
         var Bll = new CarcOrCardBLL();
         Bll.deleteEntity(keyvalue);
         return(Success("操作成功。"));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
예제 #4
0
        /// <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()));
        }
예제 #5
0
 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));
     }
 }
예제 #6
0
        /// <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()));
        }