示例#1
0
        public string NewNoN()
        {
            bool   isok = true;
            string non  = "";

            while (isok)
            {
                non = GetTime.randomPwd() + GetTime.randomPwd() + GetTime.randomPwd();
                var list = (from pr in _processStepRecordResposit.FindAll()
                            where non == pr.NoN
                            select new { }).ToList();
                if (list.Count == 0)
                {
                    isok = false;
                }
            }
            return(non);
        }
        /// <summary>
        /// 确定审批意见
        /// </summary>
        /// <returns></returns>
        public string UpdateRuzhiInfo(int JobId, string Remack, int ProceId, string staffName)
        {
            //开启事务
            _processStepRecordResposit.StatrAffair(() =>
            {
                //查询得出当前审批的数据
                ProcessStepRecord processStepRecord = _processStepRecordResposit.FindAll().FirstOrDefault(x => x.Id == ProceId);
                processStepRecord.Result            = 1;//表示审核中

                //判断审批人的职位
                if ((int)JobEmun.油站经理 == JobId)
                {
                    processStepRecord.OilStation       = 0;
                    processStepRecord.OilStationRemark = staffName + Remack;
                    //判断当前这个审批的数据是否为最后一个人审批
                    if (processStepRecord.ExecutiveDirector == null && Remack == "同意")
                    {
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }
                else if ((int)JobEmun.人事经理 == JobId)
                {
                    processStepRecord.ExecutiveDirector       = 0;
                    processStepRecord.ExecutiveDirectorRemark = staffName + Remack;

                    if (processStepRecord.OilStation == null && processStepRecord.GeneralManagerOfPerson == null && Remack == "同意")
                    {
                        //人事员工的最后一个审批人
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }
                else if ((int)JobEmun.主管 == JobId)
                {
                    processStepRecord.GeneralManagerOfPerson       = 0;
                    processStepRecord.GeneralManagerOfPersonRemark = staffName + Remack;

                    if (processStepRecord.ExecutiveDirector == 0 && processStepRecord.GeneralManager == null && Remack == "同意")
                    {
                        //油站经理  和 财务经理 的最后一个审批人
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }
                else if ((int)JobEmun.总经理 == JobId)
                {
                    processStepRecord.GeneralManager       = 0;
                    processStepRecord.GeneralManagerRemark = staffName + Remack;
                }
                else if ((int)JobEmun.总监 == JobId)
                {
                    processStepRecord.ChiefInspector       = 0;
                    processStepRecord.ChiefInspectorRemark = staffName + Remack;

                    if (processStepRecord.GeneralManager == 0 && Remack == "同意")
                    {
                        // 人事经理 和 主管的最后一个审批人
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }

                _processStepRecordResposit.UpdateInfo((x) => new ProcessStepRecord
                {
                    OilStation                   = processStepRecord.OilStation,
                    OilStationRemark             = processStepRecord.OilStationRemark,
                    ExecutiveDirector            = processStepRecord.ExecutiveDirector,
                    ExecutiveDirectorRemark      = processStepRecord.ExecutiveDirectorRemark,
                    GeneralManagerOfPerson       = processStepRecord.GeneralManagerOfPerson,
                    GeneralManagerOfPersonRemark = processStepRecord.GeneralManagerOfPersonRemark,
                    GeneralManager               = processStepRecord.GeneralManager,
                    GeneralManagerRemark         = processStepRecord.GeneralManagerRemark,
                    ChiefInspector               = processStepRecord.ChiefInspector,
                    ChiefInspectorRemark         = processStepRecord.ChiefInspectorRemark,
                    Result = processStepRecord.Result
                }, x => x.Id == processStepRecord.Id);
            });
            return("ok");
        }
示例#3
0
        /// <summary>
        /// 添加员工入职信息
        /// </summary>
        /// <param name="entrys"></param>
        /// <returns></returns>
        public string addEntrysInfoAll(Entrys entrys)
        {
            string isOk = "添加失败!";

            //开启一个事务
            _entrysResposit.StatrAffair(() => {
                entrys.CreateTime = DateTime.Now;
                entrys.IsDel      = 0;


                //得到申请表id
                int entrysId = _entrysResposit.AddCreateInfo(entrys);

                ProcessStepRecord processStepRecord = new ProcessStepRecord();
                processStepRecord.Typed             = ProcessType.员工入职审批流程.ToString();

                if (entrys.JobId == (int)JobEmun.油站员工)
                {
                    processStepRecord.OilStation = 1; //油站经理
                }
                else if (entrys.JobId == (int)JobEmun.人事员工)
                {
                    processStepRecord.ExecutiveDirector = 1; //人事经理
                }
                else if (entrys.JobId == (int)JobEmun.油站经理 || entrys.JobId == (int)JobEmun.财务经理)
                {
                    processStepRecord.ExecutiveDirector      = 1; //人事经理
                    processStepRecord.GeneralManagerOfPerson = 1; //主管
                }
                else if (entrys.JobId == (int)JobEmun.人事经理 || entrys.JobId == (int)JobEmun.主管)
                {
                    processStepRecord.GeneralManager = 1; //总经理
                    processStepRecord.ChiefInspector = 1; //总监
                }
                else if (entrys.JobId == (int)JobEmun.总经理)
                {
                    processStepRecord.ChiefInspector = 1;
                }
                processStepRecord.CreateTime       = DateTime.Now;
                processStepRecord.WhetherToExecute = 1;

                #region 生成non号 不可重复 (后期数据多了之后需要改进)
                bool isok  = true;
                string non = "";
                while (isok)
                {
                    non      = GetTime.randomPwd() + GetTime.randomPwd() + GetTime.randomPwd();
                    var list = (from pr in _processStepRecordResposit.FindAll()
                                where non == pr.NoN
                                select new { }).ToList();
                    if (list.Count == 0)
                    {
                        isok = false;
                    }
                }
                #endregion

                processStepRecord.NoN        = non;
                processStepRecord.RefOrderId = entrysId; //关联的入职申请表的主键id
                processStepRecord.Result     = 0;        //表示已经申请还未开始审核
                _processStepRecordResposit.AddInfo(processStepRecord);
                isOk = "ok";
            });


            return(isOk);
        }