Ejemplo n.º 1
0
        public string FinancingRepoApplyGoBack(string userStr, int repoApplyId)
        {
            ResultModel result = new ResultModel();
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            try
            {
                UserModel user = serializer.Deserialize<UserModel>(userStr);

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    RepoApplyDAL repoApplyDAL = new RepoApplyDAL();
                    result = repoApplyDAL.Get(user, repoApplyId);
                    if (result.ResultStatus != 0)
                        return result.Message;

                    RepoApply repoApply = result.ReturnValue as RepoApply;

                    result = repoApplyDAL.Goback(user, repoApply);
                    if (result.ResultStatus != 0)
                        return result.Message;

                    //工作流任务关闭
                    DataSourceDAL sourceDAL = new DataSourceDAL();
                    result = sourceDAL.SynchronousStatus(user, repoApply);
                    if (result.ResultStatus != 0)
                        return result.Message;

                    if (result.ResultStatus == 0)
                    {
                        scope.Complete();
                        return "撤返成功";
                    }
                    else
                        return "撤返失败";
                }
            }
            catch (Exception e)
            {
                this.log.ErrorFormat("FinService出错,出错方法:{0},{1}", "FinancingRepoApplyGoBack", e.Message);
                return e.Message;
            }
        }
Ejemplo n.º 2
0
        public ResultModel Goback(UserModel user, int fundsInvoiceId)
        {
            ResultModel result = new ResultModel();

            try
            {
                FinanceInvoiceDAL fundsInvoiceDAL = new FinanceInvoiceDAL();
                InvoiceDAL invoiceDAL = new InvoiceDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //获取财务票
                    result = fundsInvoiceDAL.Get(user, fundsInvoiceId);
                    if (result.ResultStatus != 0)
                        return result;

                    FinanceInvoice fundsInvoice = result.ReturnValue as FinanceInvoice;
                    if (fundsInvoice == null || fundsInvoice.FinanceInvoiceId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "财务发票验证失败";
                        return result;
                    }

                    //获取发票
                    result = invoiceDAL.Get(user, fundsInvoice.InvoiceId);
                    if (result.ResultStatus != 0)
                        return result;
                    Operate.Model.Invoice invoice = result.ReturnValue as Operate.Model.Invoice;
                    if (invoice == null || invoice.InvoiceId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "发票获取失败";
                        return result;
                    }

                    //撤返发票
                    result = invoiceDAL.Goback(user, invoice);
                    if (result.ResultStatus != 0)
                        return result;

                    //工作流任务关闭
                    DataSourceDAL sourceDAL = new DataSourceDAL();
                    result = sourceDAL.SynchronousStatus(user, invoice);
                    if (result.ResultStatus != 0)
                        return result;

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
Ejemplo n.º 3
0
        public ResultModel Goback(UserModel user, int payApplyId)
        {
            ResultModel result = new ResultModel();

            try
            {
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                ApplyDAL applyDAL = new ApplyDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //验证付款申请
                    result = payApplyDAL.Get(user, payApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    PayApply payApply = result.ReturnValue as PayApply;
                    if (payApply == null || payApply.PayApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请不存在";
                        return result;
                    }

                    //验证主申请
                    result = applyDAL.Get(user, payApply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Apply apply = result.ReturnValue as Apply;
                    if (apply == null || apply.ApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "主申请不存在";
                        return result;
                    }

                    //主申请状态修改至已撤返
                    result = applyDAL.Goback(user, apply);

                    if (result.ResultStatus != 0)
                        return result;

                    //工作流任务关闭
                    DataSourceDAL sourceDAL = new DataSourceDAL();
                    result = sourceDAL.SynchronousStatus(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    result.Message = "撤返成功";
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }