Beispiel #1
0
        public ActionResult GetInOutJson()
        {
            Busines.TenementManage.PropertyBLL bll = new Busines.TenementManage.PropertyBLL();
            List <OutInModel> list       = bll.GetInList().ToList();
            string            categories = "";
            DateTime          time       = DateTime.Now.AddMonths(-12);

            int[] monthList = new int[12];
            int   j         = 1;

            for (int i = 0; i < 12; i++)
            {
                monthList[i] = time.AddMonths(i).Month;
                categories  += "," + time.AddMonths(i).Year + "年" + time.AddMonths(i).Month + "月";
                j++;
            }
            categories = categories.Substring(1);
            string inJson = GetData(list, "入库", monthList);

            list = bll.GetOutList().ToList();
            string outJson = GetData(list, "出库", monthList);
            string json    = "";

            if (inJson != "")
            {
                json += "," + inJson;
            }
            if (outJson != "")
            {
                json += "," + outJson;
            }
            if (json != "")
            {
                json = "[" + json.Substring(1) + "]";
            }
            var data = new
            {
                series     = json,
                categories = categories
            };

            return(Content(data.ToJson()));
        }
Beispiel #2
0
 public ActionResult GetPropertyJson()
 {
     try
     {
         Busines.TenementManage.PropertyBLL bll = new Busines.TenementManage.PropertyBLL();
         string property_id = "";
         if (OperatorProvider.Provider.Current().IsSystem)
         {
             property_id = "System";
         }
         else
         {
             property_id = OperatorProvider.Provider.Current().UserProperty;
         }
         var data = bll.GetListBySel(property_id);
         if (data.Count() > 0)
         {
             foreach (Entity.TenementManage.PropertyEntity item in data)
             {
                 Util.Utils.WriteCookie("property_id", item.property_id);
                 Util.Utils.WriteCookie("property_name", item.property_name);
                 break;
             }
         }
         return(Content(data.ToJson()));
     }
     catch (Exception ex)
     {
         LogEntity logEntity = new LogEntity();
         logEntity.CategoryId        = 1;
         logEntity.OperateTypeId     = ((int)OperationType.Login).ToString();
         logEntity.OperateType       = EnumAttribute.GetDescription(OperationType.Login);
         logEntity.OperateAccount    = OperatorProvider.Provider.Current().Account + "(" + OperatorProvider.Provider.Current().UserName + ")";
         logEntity.OperateUserId     = OperatorProvider.Provider.Current().UserId;
         logEntity.Module            = Config.GetValue("SoftName");
         logEntity.ExecuteResult     = -1;
         logEntity.ExecuteResultJson = ex.Message;
         logEntity.WriteLog();
         return(Content(""));
     }
 }