Exemplo n.º 1
0
 public string getquanxian(string quanxianJson)
 {
     try
     {
         //创建service层实例
         user_managementservice = new User_ManagementService();
         //处理json
         Account  user     = FinanceJson.getFinanceJson().toObject <Account>(quanxianJson);
         quanxian quanxian = user_managementservice.selectQuanXianService(user);
         if (quanxian != null)
         {
             return(FinanceResultData.getFinanceResultData().success(200, quanxian, "获取权限成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "获取权限失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 2
0
 public string updateQX(string quanxian, string bianhao)
 {
     try
     {
         //创建service层实例
         user_managementservice = new User_ManagementService();
         //处理json
         quanxianItem quanxianitem = FinanceJson.getFinanceJson().toObject <quanxianItem>(quanxian);
         //修改操作
         quanxianitem.bianhao = bianhao;
         quanxianitem         = user_managementservice.updQuanXianService(quanxianitem);
         if (quanxianitem != null)
         {
             return(FinanceResultData.getFinanceResultData().success(200, quanxianitem, "成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "删除失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 3
0
        public string addVoucherWord(string wordJson)
        {
            try
            {
                //创建service层实例
                voucherWordService = new VoucherWordService();
                //处理json
                VoucherWord voucherWord = FinanceJson.getFinanceJson().toObject <VoucherWord>(wordJson);

                if (voucherWordService.addVoucherWord(voucherWord))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "新增成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "新增失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 4
0
        public string add(string userJson)
        {
            try
            {
                //创建service层实例
                user_managementservice = new User_ManagementService();
                //处理json
                Account user = FinanceJson.getFinanceJson().toObject <Account>(userJson);

                if (user_managementservice.newUserService(user))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "添加成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "添加失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 5
0
        public string addIncome(string incomeJson)
        {
            try
            {
                //创建service层实例
                investmentService = new InvestmentService();
                //处理json
                InvestmentIncome investmentIncome = FinanceJson.getFinanceJson().toObject <InvestmentIncome>(incomeJson);

                if (investmentService.addInvestmentIncome(investmentIncome))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "新增成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "新增失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 6
0
 public string updExpenditure(string newExpenditure)
 {
     try
     {
         //创建service层实例
         investmentService = new InvestmentService();
         //处理json
         InvestmentExpenditure investmentExpenditure = FinanceJson.getFinanceJson().toObject <InvestmentExpenditure>(newExpenditure);
         //修改操作
         if (investmentService.updateInvestmentExpenditure(investmentExpenditure))
         {
             return(FinanceResultData.getFinanceResultData().success(200, null, "修改成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "修改失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 用token换取Account对象
        /// </summary>
        /// <param name="token">token字符串</param>
        /// <returns>Account对象</returns>
        public Account getAccount(string token)
        {
            //解密后转用户类型
            Account account = (Account)FinanceJson.getFinanceJson().toObject <Account>(FinanceRSA.RSADecrypt(token));

            return(account);
        }
Exemplo n.º 8
0
 public string update(string newUserJson)
 {
     try
     {
         //创建service层实例
         user_managementservice = new User_ManagementService();
         //处理json
         User_ManagementItem user_managementitem = FinanceJson.getFinanceJson().toObject <User_ManagementItem>(newUserJson);
         //修改操作
         user_managementitem = user_managementservice.updUserService(user_managementitem);
         if (user_managementitem != null)
         {
             return(FinanceResultData.getFinanceResultData().success(200, user_managementitem, "成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "删除失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 9
0
 public string updIncome(string newIncome)
 {
     try
     {
         //创建service层实例
         managementService = new ManagementService();
         //处理json
         ManagementIncome managementIncome = FinanceJson.getFinanceJson().toObject <ManagementIncome>(newIncome);
         //修改操作
         if (managementService.updateManagementIncome(managementIncome))
         {
             return(FinanceResultData.getFinanceResultData().success(200, null, "修改成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "修改失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 10
0
        public string addSimpleAccounting(string simpleAccountingJson)
        {
            try
            {
                //创建service层实例
                simpleAccountingService = new SimpleAccountingService();
                //处理json
                SimpleAccounting simpleAccounting = FinanceJson.getFinanceJson().toObject <SimpleAccounting>(simpleAccountingJson);

                if (simpleAccountingService.newSimpleAccounting(simpleAccounting))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "新增成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "新增失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 11
0
        public string getSimpleDataList(string financePageJson, string start_date, string stop_date)
        {
            //分页对象
            FinancePage <SimpleData> financePage = null;

            try
            {
                //创建service层实例
                simpleDataService = new SimpleDataService();
                //处理json
                financePage = FinanceJson.getFinanceJson().toObject <FinancePage <SimpleData> >(financePageJson);
                //获取处理过的分页对象
                financePage = simpleDataService.getSimpleDataList(financePage, start_date, stop_date);

                return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 12
0
        public string add(string departmentJson)
        {
            try
            {
                //创建service层实例
                departmentService = new DepartmentService();
                //处理json
                Department department = FinanceJson.getFinanceJson().toObject <Department>(departmentJson);

                if (departmentService.newDepartmentService(department))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "添加成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "添加失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 13
0
        public string getList2(string financePageJson, string dep)
        {
            //分页对象
            FinancePage <DepartmentItem> financePage = null;

            try
            {
                //创建service层实例
                departmentService = new DepartmentService();
                //处理json
                financePage = FinanceJson.getFinanceJson().toObject <FinancePage <DepartmentItem> >(financePageJson);
                //获取处理过的分页对象
                financePage = departmentService.getListService2(financePage, dep);

                return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 14
0
 public string updSimpleData(string newSimpleData)
 {
     try
     {
         //创建service层实例
         simpleDataService = new SimpleDataService();
         //处理json
         SimpleData simpleData = FinanceJson.getFinanceJson().toObject <SimpleData>(newSimpleData);
         //修改操作
         if (simpleDataService.updSimpleData(simpleData))
         {
             return(FinanceResultData.getFinanceResultData().success(200, null, "修改成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "修改失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 15
0
        public string getVoucherSummaryList(string financePageJson)
        {
            //分页对象
            FinancePage <VoucherSummaryItem> financePage = null;

            try
            {
                //创建service层实例
                voucherSummaryService = new VoucherSummaryService();
                //处理json
                financePage = FinanceJson.getFinanceJson().toObject <FinancePage <VoucherSummaryItem> >(financePageJson);
                //获取处理过的分页对象
                financePage = voucherSummaryService.getVoucherSummaryList(financePage);

                return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 16
0
 public string delAccounting(string idJson)
 {
     if (idJson != "")
     {
         try
         {
             int[] ids = FinanceJson.getFinanceJson().toObject <int[]>(idJson);
             asc = new AccountingService();
             if (asc.delAccounting(ids))
             {
                 return(FinanceResultData.getFinanceResultData().success(200, null, "成功"));
             }
             else
             {
                 return(FinanceResultData.getFinanceResultData().fail(500, null, "失败"));
             }
         }
         catch (InvalidOperationException ex)
         {
             //身份验证不通过
             return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
         }
         catch (Exception ex)
         {
             //未知的错误
             return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
         }
     }
     else
     {
         return(FinanceResultData.getFinanceResultData().fail(500, null, "失败"));
     }
 }
Exemplo n.º 17
0
        public string delExpenditure(string idsJson)
        {
            try
            {
                //创建service层实例
                managementService = new ManagementService();
                //处理json
                int[] ids = FinanceJson.getFinanceJson().toObject <int[]>(idsJson);

                if (managementService.deleteManagementExpenditure(ids))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "删除成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "删除失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 18
0
        public string delSimpleAccounting(string idsJson)
        {
            try
            {
                //创建service层实例
                simpleAccountingService = new SimpleAccountingService();
                //处理json
                int[] ids = FinanceJson.getFinanceJson().toObject <int[]>(idsJson);

                if (simpleAccountingService.delSimpleAccounting(ids))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "删除成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "删除失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 19
0
        public string getExpenditureList(string financePageJson)
        {
            //分页对象
            FinancePage <ManagementExpenditure> financePage = null;

            try
            {
                //创建service层实例
                managementService = new ManagementService();
                //处理json
                financePage = FinanceJson.getFinanceJson().toObject <FinancePage <ManagementExpenditure> >(financePageJson);
                //获取处理过的分页对象
                financePage = managementService.getManagementExpenditureList(financePage);

                return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 20
0
        public string addExpenditure(string expenditureJson)
        {
            try
            {
                //创建service层实例
                managementService = new ManagementService();
                //处理json
                ManagementExpenditure managementExpenditure = FinanceJson.getFinanceJson().toObject <ManagementExpenditure>(expenditureJson);

                if (managementService.addManagementExpenditure(managementExpenditure))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "新增成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "新增失败"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 21
0
 public string getList2(string financePageJson, int classId, string code)
 {
     if (financePageJson != "")
     {
         FinancePage <AccountingItem> financePage = new FinancePage <AccountingItem>();
         financePage = FinanceJson.getFinanceJson().toObject <FinancePage <AccountingItem> >(financePageJson);
         try
         {
             asc         = new AccountingService();
             financePage = asc.getList2(financePage, classId, code);
             return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
         }
         catch (InvalidOperationException ex)
         {
             //身份验证不通过
             return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
         }
         catch (Exception ex)
         {
             //未知的错误
             return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
         }
     }
     else
     {
         return(FinanceResultData.getFinanceResultData().fail(500, null, "失败"));
     }
 }
Exemplo n.º 22
0
        public string getSimpleAccountingList(string financePageJson)
        {
            using (fin = new FinanceEntities())
            {
                //分页对象
                FinancePage <SimpleAccountingSummary> financePage = null;
                try
                {
                    //创建service层实例
                    simpleAccountingService = new SimpleAccountingService();
                    //处理json
                    financePage = FinanceJson.getFinanceJson().toObject <FinancePage <SimpleAccountingSummary> >(financePageJson);
                    //获取处理过的分页对象
                    financePage = simpleAccountingService.getSimpleAccountingList(financePage);

                    return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
                }
                catch (InvalidOperationException ex)
                {
                    //身份验证不通过
                    return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
                }
                catch (Exception ex)
                {
                    //未知的错误
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
                }
            }
        }
Exemplo n.º 23
0
 public string update(string newDepartmentJson)
 {
     try
     {
         //创建service层实例
         departmentService = new DepartmentService();
         //处理json
         DepartmentItem departmentItem = FinanceJson.getFinanceJson().toObject <DepartmentItem>(newDepartmentJson);
         //修改操作
         departmentItem = departmentService.updDepartmentService(departmentItem);
         if (departmentItem != null)
         {
             return(FinanceResultData.getFinanceResultData().success(200, departmentItem, "成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "删除失败"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 24
0
 public string addVoucherSummary(string voucherSummaryJson)
 {
     try
     {
         //创建service层实例
         voucherSummaryService = new VoucherSummaryService();
         //处理json
         VoucherSummary voucherSummary = FinanceJson.getFinanceJson().toObject <VoucherSummary>(voucherSummaryJson);
         if (voucherSummaryService.addVoucherSummary(voucherSummary))
         {
             return(FinanceResultData.getFinanceResultData().success(200, null, "成功"));
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "错误"));
         }
     }
     catch (InvalidOperationException ex)
     {
         //身份验证不通过
         return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
     }
     catch (Exception ex)
     {
         //未知的错误
         return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// 登陆
        /// </summary>
        /// <param name="company">公司</param>
        /// <param name="name">用户名</param>
        /// <param name="pwd">密码</param>
        /// <returns>密钥</returns>
        public String login(string company, string name, string pwd)
        {
            //获取用户
            Account account = am.getAccount(company, name, pwd);

            if (account != null)
            {
                //转json后加密
                return(FinanceRSA.RSAEncryption(FinanceJson.getFinanceJson().toJson(account)));
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 检查token是否有效
        /// </summary>
        /// <param name="token">密钥</param>
        /// <returns>有效返回对象,无效返回null</returns>
        public Account checkToken(string token)
        {
            //解密
            token = FinanceRSA.RSADecrypt(token);
            Account account = null;

            //json转对象
            try
            {
                account = FinanceJson.getFinanceJson().toObject <Account>(token);
            }
            catch (Exception ex) {
                FinanceToError.getFinanceToError().toError();
            }
            return(account);
        }
Exemplo n.º 27
0
        public string examineVoucherSummary(string idsJson, string @do)
        {
            try
            {
                //创建service层实例
                voucherSummaryService = new VoucherSummaryService();
                //获取用户service层实例
                AccountService accountService = new AccountService(true);

                Account account = new Account();
                //处理json
                string token = FinanceToken.getFinanceCheckToken().getToken();
                //获取对象
                account = FinanceToken.getFinanceCheckToken().checkToken(token);
                string examineName = account.name;

                //检查操作密码
                if (!accountService.checkDo(@do))
                {
                    return(FinanceResultData.getFinanceResultData().fail(402, null, "操作密码错误"));
                }

                //处理json
                int[] ids = FinanceJson.getFinanceJson().toObject <int[]>(idsJson);
                //审核
                if (voucherSummaryService.examineVoucherSummary(ids, examineName))
                {
                    return(FinanceResultData.getFinanceResultData().success(200, null, "成功"));
                }
                else
                {
                    return(FinanceResultData.getFinanceResultData().fail(500, null, "错误"));
                }
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 28
0
 public string updAccounting(string itemJson)
 {
     if (itemJson != "")
     {
         AccountingItem accountingItem = new AccountingItem();
         accountingItem = FinanceJson.getFinanceJson().toObject <AccountingItem>(itemJson);
         if (accountingItem != null)
         {
             try
             {
                 asc            = new AccountingService();
                 accountingItem = asc.updAccounting(accountingItem);
                 if (accountingItem != null)
                 {
                     return(FinanceResultData.getFinanceResultData().success(200, accountingItem, "成功"));
                 }
                 else
                 {
                     return(FinanceResultData.getFinanceResultData().fail(500, null, "失败"));
                 }
             }
             catch (InvalidOperationException ex)
             {
                 //身份验证不通过
                 return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
             }
             catch (Exception ex)
             {
                 //未知的错误
                 return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
             }
         }
         else
         {
             return(FinanceResultData.getFinanceResultData().fail(500, null, "失败"));
         }
     }
     else
     {
         return(FinanceResultData.getFinanceResultData().fail(500, null, "失败"));
     }
 }
Exemplo n.º 29
0
        public string getProfitList(string financePageJson)
        {
            try
            {
                FinancePage <Profit> financePage = FinanceJson.getFinanceJson().toObject <FinancePage <Profit> >(financePageJson);
                profitService = new ProfitService();

                financePage = profitService.getProfitList(financePage);
                return(FinanceResultData.getFinanceResultData().success(200, financePage, "成功"));
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }
Exemplo n.º 30
0
        public string newUser(string myDo, string user_json)
        {
            string  resultStr = "";
            Account account   = FinanceJson.getFinanceJson().toObject <Account>(user_json);

            try
            {
                asc = new AccountService(true);
                int result = asc.newUser(myDo, account);
                switch (result)
                {
                case 1:
                    resultStr = FinanceResultData.getFinanceResultData().success(200, null, "新增成功");
                    break;

                case -1:
                    resultStr = FinanceResultData.getFinanceResultData().fail(412, null, "您的操作密码不正确");
                    break;

                case -2:
                    resultStr = FinanceResultData.getFinanceResultData().fail(412, null, "用户名以存在");
                    break;

                default:
                    resultStr = FinanceResultData.getFinanceResultData().fail(500, null, "新增失败");
                    break;
                }
                return(resultStr);
            }
            catch (InvalidOperationException ex)
            {
                //身份验证不通过
                return(FinanceResultData.getFinanceResultData().fail(401, null, ex.Message));
            }
            catch (Exception ex)
            {
                //未知的错误
                return(FinanceResultData.getFinanceResultData().fail(500, null, "未知的错误"));
            }
        }