Esempio n. 1
0
        public ResultModel Goback(UserModel user, int repoApplyId)
        {
            ResultModel result = new ResultModel();
            try
            {
                DAL.RepoApplyDAL repoApplyDAL = new RepoApplyDAL();
                Operate.DAL.ApplyDAL applyDAL = new Operate.DAL.ApplyDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //验证回购申请
                    result = repoApplyDAL.Get(user, repoApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Model.RepoApply repoApply = result.ReturnValue as Model.RepoApply;
                    if (repoApply == null || repoApply.RepoApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "回购申请不存在";
                        return result;
                    }

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

                    Operate.Model.Apply apply = result.ReturnValue as Operate.Model.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;

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

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

            return result;
        }
Esempio n. 2
0
        public ResultModel GoBack(UserModel user, int stockMoveApplyId)
        {
            ResultModel result = new ResultModel();
            NFMT.Operate.DAL.ApplyDAL applyDAL = new Operate.DAL.ApplyDAL();

            try
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    result = stockmoveapplyDAL.Get(user, stockMoveApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Model.StockMoveApply stockMoveApply = result.ReturnValue as Model.StockMoveApply;
                    if (stockMoveApply == null || stockMoveApply.StockMoveApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "数据不存在,无法撤返";
                        return result;
                    }

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

                    Operate.Model.Apply apply = result.ReturnValue as Operate.Model.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;

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

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

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

            try
            {
                DAL.PricingApplyDAL pricingApplyDAL = new PricingApplyDAL();
                NFMT.Operate.DAL.ApplyDAL applyDAL = new Operate.DAL.ApplyDAL();

                using (System.Transactions.TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //获取点价申请
                    result = pricingApplyDAL.Get(user, pricingApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    NFMT.DoPrice.Model.PricingApply pricingApply = result.ReturnValue as NFMT.DoPrice.Model.PricingApply;
                    if (pricingApply == null || pricingApply.PricingApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "点价申请验证失败";
                        return result;
                    }

                    //获取申请
                    result = applyDAL.Get(user, pricingApply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;
                    NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.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;

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

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

            return result;
        }
Esempio n. 4
0
        public ResultModel Goback(UserModel user, int invoiceApplyId)
        {
            ResultModel result = new ResultModel();
            NFMT.Operate.DAL.ApplyDAL applyDAL = new Operate.DAL.ApplyDAL();

            try
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    result = invoiceapplyDAL.Get(user, invoiceApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Model.InvoiceApply invoiceApply = result.ReturnValue as Model.InvoiceApply;
                    if (invoiceApply == null)
                    {
                        result.ResultStatus = -1;
                        result.Message = "获取发票申请失败";
                        return result;
                    }

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

                    Operate.Model.Apply apply = result.ReturnValue as Operate.Model.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;

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

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            finally
            {
                if (result.ResultStatus != 0)
                    this.Log.ErrorFormat("{0} {1},序号:{2}", user.EmpName, result.Message, result.ReturnValue);
                else if (this.Log.IsInfoEnabled)
                    this.Log.InfoFormat("{0} {1},序号:{2}", user.EmpName, result.Message, result.ReturnValue);
            }

            return result;
        }