Ejemplo n.º 1
0
        public String GetCollectionType(string time, string beginTime, string endTime, bool?isMark, bool?family, string costTypeId)
        {
            String costTypeIds = String.Empty;

            if (isMark == true)
            {
                isMark = null;
            }
            if (family == true)
            {
                family = null;
            }
            if (costTypeId != null)
            {
                costTypeIds = costTypeId.GetIds();
            }
            if (!String.IsNullOrEmpty(time))
            {
                time = time.GetIds();
            }
            else
            {
                time = "''";
            }

            DataTable dt = new BLLifingCost().GetCollectionType(time, beginTime, endTime, isMark, family, costTypeIds, CurrentUser.Id);

            return(JsonConvert.ToJson(dt));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="lifingCost"></param>
 /// <returns></returns>
 public String Update(LifingCost lifingCost)
 {
     try
     {
         int result = new BLLifingCost().Update(lifingCost);
         if (result > 0)
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "修改成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "修改失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "修改失败,失败原因:" + ex.Message
         }));
     }
 }
Ejemplo n.º 3
0
        public String GetCollectionByType(String time)
        {
            String    sqlWhere = CurrentUser.Id == "-1" ? "" : String.Format(" and create_by='{0}'", CurrentUser.Id);
            DataTable dt       = new BLLifingCost().GetCollectionByType(time, sqlWhere);

            return(JsonConvert.ToJson(dt));
        }
Ejemplo n.º 4
0
        public String GetReasons(String key)
        {
            List <LifingCost> list = new BLLifingCost().GetReasons(key);

            return(JsonConvert.JavaScriptSerializer(new ExtGridRecord(list, list.Count)));
            //return JsonConvert.JavaScriptSerializer(list);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="lifingCost"></param>
 /// <returns></returns>
 public String Add(LifingCost lifingCost)
 {
     try
     {
         lifingCost.Id = Guid.NewGuid().ToString();
         int result = new BLLifingCost().Add(lifingCost);
         if (result > 0)
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "新增成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "新增失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "新增失败,失败原因:" + ex.Message
         }));
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 图形汇总信息
        /// </summary>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public string GetCollection(String beginTime, String endTime)
        {
            String sqlWhere = CurrentUser.Id == "-1" ? "" : String.Format(" and create_by='{0}'", CurrentUser.Id);

            DataTable dt = new BLLifingCost().GetCollection(sqlWhere, beginTime, endTime);

            return(JsonConvert.ToJson(dt));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <returns></returns>
        public String SelectByPage(int limit, int start, String startTime, String endTime, String key, String CostTypeId, Boolean?isMark, Boolean?family)
        {
            var tuple = GetParam(startTime, endTime, key, CostTypeId, isMark, family);
            int total;
            List <VLifingCost> lifingCosts = new BLLifingCost().Select(limit, start, tuple.Item1, out total, tuple.Item2);

            return(JsonConvert.JavaScriptSerializer(new ExtGridRecord(lifingCosts, total)));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 批量修改自定义分组信息
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public String ModifyCusGroup(String ids, String value)
        {
            int num = new BLLifingCost().ModifyCusGroup(ids, value);

            return(JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                success = true, msg = "成功保存" + num + "条数据"
            }));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids">Id的集合,如1,2,3</param>
        /// <returns></returns>
        public String Delete(String ids)
        {
            int num = new BLLifingCost().Delete(ids);

            return(JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                success = true, msg = "成功删除" + num + "条数据"
            }));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 查询所有消费名称
        /// </summary>
        /// <returns></returns>
        public String GetLifeNames()
        {
            List <String> list   = new BLLifingCost().GetAllReasons();
            String        result = JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                data    = list,
                success = true
            });

            return(result);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 生活费汇总,列表汇总
        /// </summary>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="isMark"></param>
        /// <param name="family"></param>
        /// <param name="costTypeId"></param>
        /// <returns></returns>
        public string GetCollectionByMonth(String beginTime, String endTime, Boolean?isMark, Boolean?family, String costTypeId)
        {
            String costTypeIds = String.Empty;

            if (isMark == true)
            {
                isMark = null;
            }
            if (family == true)
            {
                family = null;
            }
            if (costTypeId != null)
            {
                costTypeIds = costTypeId.GetIds();
            }

            List <CostMonthCol> list = new BLLifingCost().GetCollectionByMonth(beginTime, endTime, isMark, family, costTypeIds, CurrentUser.Id);

            return(JsonConvert.JavaScriptSerializer(list));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="lifingCost"></param>
        /// <returns></returns>
        public String Save(LifingCost lifingCost)
        {
            //判断Request中是否有接收Files文件
            if (Request.Files.Count != 0 && !String.IsNullOrEmpty(lifingCost.ImgUrl))
            {
                //HttpPostedFileBase类,提供对用户上载的单独文件的访问
                //获取到用户上传的文件
                HttpPostedFileBase file     = Request.Files[0];
                String             fileName = this.Upload(file, "/File/Life/");
                lifingCost.ImgUrl = fileName;
            }

            //创建人和修改者赋值
            Users user = Session["user"] as Users;

            if (string.IsNullOrEmpty(lifingCost.Id))
            {
                lifingCost.CreateTime = DateTime.Now;
                lifingCost.CreateBy   = user.Id;
                return(Add(lifingCost));
            }
            else
            {
                lifingCost.UpdateTime = DateTime.Now;
                lifingCost.UpdateBy   = user.Id;
                if (String.IsNullOrEmpty(lifingCost.ImgUrl))
                {
                    lifingCost.ImgUrl = new BLLifingCost().Select(lifingCost.Id).ImgUrl;
                }
                else
                {
                    var imgUrl = new BLLifingCost().Select(lifingCost.Id).ImgUrl;
                    if (!String.IsNullOrEmpty(imgUrl))
                    {
                        System.IO.File.Delete(Server.MapPath(imgUrl));
                    }
                }
                return(Update(lifingCost));
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 查询总金额
 /// </summary>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <param name="key"></param>
 /// <param name="CostTypeId"></param>
 /// <param name="isMark"></param>
 /// <param name="family"></param>
 /// <returns></returns>
 public String GetTotalPrice(String startTime, String endTime, String key, String CostTypeId, Boolean?isMark, Boolean?family)
 {
     try
     {
         var tuple = GetParam(startTime, endTime, key, CostTypeId, isMark, family);
         var total = new BLLifingCost().GetTotalPrice(tuple.Item1, tuple.Item2);
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             data = total,
             success = true,
             msg = "查询成功"
         }));
     }
     catch
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             data = null,
             success = false,
             msg = "查询失败"
         }));
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 分页查询生活费信息
 /// </summary>
 /// <param name="pageSize"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 public String GetLifingCost(int pageSize, int start, String createBy)
 {
     try
     {
         int    total;
         var    list   = new BLLifingCost().Select(pageSize, start, new HashTableExp("CreateBy", createBy), out total, string.Empty);
         String result = JsonConvert.GetJsonString(new ExtResult()
         {
             data    = new ExtGridRecord(list, total),
             success = true
         });
         return(result);
     }
     catch (Exception ex)
     {
         LogHelper.Log.Error("获取生活费信息错误pageSize=" + pageSize + ",start=" + start, ex);
         return(JsonConvert.GetJsonString(new ExtResult()
         {
             msg = ex.Message,
             success = false,
             data = null
         }));
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 导入Excel
        /// </summary>
        /// <param name="impExcel"></param>
        /// <returns></returns>
        public String ImportExcel(String impExcel)
        {
            //判断Request中是否有接收Files文件
            if (Request.Files.Count != 0 && !String.IsNullOrEmpty(impExcel))
            {
                //HttpPostedFileBase类,提供对用户上载的单独文件的访问
                //获取到用户上传的文件
                HttpPostedFileBase file = Request.Files[0];

                String    fileName = Server.MapPath(this.Upload(file, "/File/Import/", "imp.xls"));
                DataTable dt       = Life.Common.ExcelOperations.ImportDataTableFromExcel(fileName, 0, 0);

                String msg = new BLLifingCost().SaveData(dt, CurrentUser.Id);
                return(JsonConvert.JavaScriptSerializer(new ExtResult()
                {
                    success = true, msg = msg
                }));
            }

            return(JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                success = false, msg = "请选择文件."
            }));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 查询所有的自定义分组名称
        /// </summary>
        /// <returns></returns>
        public String GetAllCusGroup()
        {
            var list = new BLLifingCost().GetAllCusGroup();

            return(JsonConvert.JavaScriptSerializer(list));
        }