Esempio n. 1
0
        /// <summary>
        /// 将一条申请单提交到上一级
        /// </summary>
        /// <param name="applyId"></param>
        /// <param name="comId"></param>
        /// <returns></returns>
        private int VIPApplyToHigherLevel(int applyId, int confirmLevel, int operatorId, string memo, int isPass)
        {
            VIPApply apply = new VIPApply();

            apply.Id = applyId;
            if (apply.Load())
            {
                apply.ConfirmLevel = confirmLevel;
                apply.OperatorId   = operatorId; //这里处理添加操作员的ID,相当于登录人的memberId
                apply.Save();
                //审核通过一级时给上一级再发送
                LeadingEmail le = new LeadingEmail();
                le.SendEmail(applyId, isPass);

                //保存申请单审核记录表
                Confirmprocess process = new Confirmprocess();
                process.ApplyId      = applyId;
                process.MemberId     = operatorId;
                process.Memo         = memo;
                process.Status       = apply.Status;
                process.ConfirmLevel = confirmLevel;
                process.Amount       = apply.SumMoney;
                process.UpdateTime   = DateTime.Now;
                process.Save();
                return(apply.Id);
            }
            return(0);
        }
Esempio n. 2
0
        /// <summary>
        /// 将单条申请单转换为订单
        /// </summary>
        /// <param name="ApplyId"></param>
        /// <param name="OperatorId"></param>
        /// <param name="RoleId"></param>
        /// <param name="Memo"></param>
        /// <returns></returns>
        private bool ConvertApplyToOrder(int ApplyId, int OperatorId, int RoleId, string Memo, Customer customer)
        {
            ViewVIPApply View_Apply = new ViewVIPApply(ApplyId);

            if (View_Apply.Status != CommenClass.VIPApplyStatus.待审核.ToString())
            {
                return(false);
            }
            VIPApply  apply = new VIPApply(ApplyId);
            DataTable dt    = apply.ReadDetail().Tables[0];
            Order     order = GetOrderInfoByApply(View_Apply, dt.Rows.Count, customer);

            OrderDetail[] od      = GetOrderDetail(dt);//初始化订单明细数据
            OrderManager  om      = new OrderManager();
            int           orderId = om.AddOrder(order, od);

            if (orderId > 0)
            {
                //保存申请单审核记录表
                Confirmprocess process = new Confirmprocess();
                process.ApplyId    = ApplyId;
                process.MemberId   = OperatorId;
                process.Memo       = apply.Memo;
                process.Status     = CommenClass.VIPApplyStatus.已审核.ToString();
                process.Amount     = apply.SumMoney;
                process.UpdateTime = DateTime.Now;

                apply.Status     = CommenClass.VIPApplyStatus.已审核.ToString();
                apply.OperatorId = OperatorId;
                apply.UpdateTime = process.UpdateTime;
                if (RoleId == 1)//系统管理员审核通过的
                {
                    apply.ConfirmLevel   = 0;
                    process.ConfirmLevel = 0;
                }
                else//成本中心管理员通过的
                {
                    Member m    = new Member(OperatorId);
                    Dept   dept = new Dept(m.DeptId);
                    apply.ConfirmLevel   = dept.Level;//同时修改一下申请单的confirmLevel
                    process.ConfirmLevel = dept.Level;
                }
                if (apply.Save() > 0)//申请单状态更改了
                {
                    //发邮件审核通过的通知
                    LeadingEmail email = new LeadingEmail();
                    email.EmailToPass(ApplyId, apply.MemberId);
                }
                process.Save();
                return(true);
            }
            else
            {
                return(false);
            }
        }