/// <summary>
        /// 增添数据
        /// </summary>
        /// <param name="leaveOffice"></param>
        /// <returns></returns>
        public bool AddLeaveOffices(LeaveOffice leaveOffice)
        {
            int Record = 0;

            _leaveOfficeResposit.StatrAffair(() =>
            {
                leaveOffice.IsDel = "0";
                int leaveId       = _leaveOfficeResposit.AddCreateInfo(leaveOffice);
                ProcessStepRecord processStepRecord = new ProcessStepRecord();
                processStepRecord.Typed             = ProcessType.员工离职审批流程.ToString();
                processStepRecord.RecordRemarks     = leaveOffice.Reason;
                processStepRecord.CreateTime        = DateTime.Now;
                processStepRecord.WhetherToExecute  = 1;
                processStepRecord.NoN    = leaveId.ToString();
                processStepRecord.Result = 1;

                if (leaveOffice.JobId == (int)JobEmun.油站员工)
                {
                    processStepRecord.OilStation = 1;
                }
                else if (leaveOffice.JobId == (int)JobEmun.油站经理 || leaveOffice.JobId == (int)JobEmun.人事员工 || leaveOffice.JobId == (int)JobEmun.主管 || leaveOffice.JobId == (int)JobEmun.财务经理)
                {
                    processStepRecord.ExecutiveDirector = 1;
                }
                else if (leaveOffice.JobId == (int)JobEmun.人事经理)
                {
                    processStepRecord.GeneralManager = 1;
                }
                else if (leaveOffice.JobId == (int)JobEmun.总经理)
                {
                    processStepRecord.ChiefInspector = 1;
                }

                Record += _processStepRecordResposit.AddInfo(processStepRecord);
            });
            return(Record > 0);
        }
예제 #2
0
        /// <summary>
        /// 增添订单
        /// </summary>
        /// <param name="oilMaterialOrderDto"></param>
        /// <returns></returns>
        public bool AddOilMatOrder(OilMaterialOrderDto oilMaterialOrderDto, ref string rem)
        {
            Staff staff = _staffResposit.FindAll().Where(x => x.NoN == oilMaterialOrderDto.StaffNoN).FirstOrDefault();

            if (staff == null)
            {
                rem = "未找到这个用户!!!";
                return(false);
            }
            int num = 0;

            //开启事务
            _oilMaterialOrderResposit.StatrAffairs(() =>
            {
                int OrderId = _oilMaterialOrderResposit.AddCreateInfo(new OilMaterialOrder
                {
                    StaffNoN   = oilMaterialOrderDto.StaffNoN,
                    NoN        = GetTime.GetTimeAll() + GetTime.GetTimeStamp() + "_" + GetTime.GetRandom(),
                    ApplyDate  = DateTime.Now,
                    Remark     = oilMaterialOrderDto.Remark,
                    IsDel      = 0,
                    CreateTime = DateTime.Now,
                    IsPanke    = 0,
                    IsLaunch   = 0
                });
                _oilMaterialOrderDetailResposit.AddInfo(new OilMaterialOrderDetail
                {
                    OrderId    = OrderId,
                    CreateTime = DateTime.Now,
                    DayAvg     = oilMaterialOrderDto.DayAvg,
                    IsDel      = 0,
                    NeedAmount = oilMaterialOrderDto.NeedAmount,
                    OilSpec    = oilMaterialOrderDto.OilSpec,
                    Surplus    = oilMaterialOrderDto.Surplus,
                    Volume     = oilMaterialOrderDto.Volume
                });

                ProcessStepRecord processStepRecord = new ProcessStepRecord();

                //根据申请油料的多少决定有谁来审批
                if (oilMaterialOrderDto.NeedAmount <= 1000)
                {
                    processStepRecord.OilStation = 1;
                }
                else if (oilMaterialOrderDto.NeedAmount > 1000 && oilMaterialOrderDto.NeedAmount <= 10000)
                {
                    processStepRecord.GeneralManagerOfPerson = 1;
                }
                else if (oilMaterialOrderDto.NeedAmount > 10000 && oilMaterialOrderDto.NeedAmount <= 50000)
                {
                    processStepRecord.GeneralManagerOfPerson = 1;
                    processStepRecord.GeneralManager         = 1;
                }
                else if (oilMaterialOrderDto.NeedAmount > 50000)
                {
                    processStepRecord.ChiefInspector = 1;
                }

                processStepRecord.Typed         = ProcessType.油料申请审批流程.ToString();
                processStepRecord.RecordRemarks = oilMaterialOrderDto.Remark;
                processStepRecord.NoN           = NewNoN();
                processStepRecord.RefOrderId    = OrderId; //申请油料订单的id
                _processStepRecordResposit.AddInfo(processStepRecord);
                num++;
            });
            return(num > 0);
        }
예제 #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);
        }