Example #1
0
        public void SaveOTApplication(totaplctn _overtimeApp)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    //分析请假并保存
                    otaplctnBll bll = new otaplctnBll();

                    if (_overtimeApp.otst == "Approved")
                    {
                        //如果自动转换成休假,则新增lvdfbyemp
                        double hoursToTTLV = 0;
                        int    lvdefseq    = 0;

                        List <ColumnInfo> ottypeParameters = new List <ColumnInfo>()
                        {
                            new ColumnInfo()
                            {
                                ColumnName = "otcd", ColumnValue = _overtimeApp.otcd
                            }
                        };

                        tottype otType = GetSelectedObject <tottype>(ottypeParameters);

                        if (otType.autr == "Y")
                        {
                            otttlvBll ttlvBll = new otttlvBll();
                            hoursToTTLV = ttlvBll.TransferToLeave(_overtimeApp, otType, ref lvdefseq);
                        }

                        //如果审核,则更新otdetail
                        SaveToOvertimeDetail(_overtimeApp, hoursToTTLV, lvdefseq);
                    }

                    DoInsert <totaplctn>(_overtimeApp);

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
Example #2
0
        public void UpdateOTApplication(totaplctn _overtimeApp)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    otaplctnBll bll = new otaplctnBll();

                    List <ColumnInfo> apnoParameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "apno", ColumnValue = _overtimeApp.apno
                        }
                    };
                    List <ColumnInfo> dtlParameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "refno", ColumnValue = _overtimeApp.apno
                        }
                    };
                    totdetail dtl = GetSelectedObject <totdetail>(dtlParameters);
                    if (dtl != null)
                    {
                        //删除lvdfbyemp
                        //如果转换成的休假已经被申请了,则无法控制
                        List <ColumnInfo> lvdefempParameters = new List <ColumnInfo>()
                        {
                            new ColumnInfo()
                            {
                                ColumnName = "emno", ColumnValue = dtl.emno
                            },
                            new ColumnInfo()
                            {
                                ColumnName = "sqno", ColumnValue = dtl.tlrf.ToString(), ColumnType = "int"
                            }
                        };
                        DoDelete <tlvdfbyem>(lvdefempParameters);

                        //删除otdetail
                        dal.DeleteOTDtl(dtlParameters);
                    }

                    if (_overtimeApp.otst == "Approved")
                    {
                        //如果自动转换成休假,则新增lvdfbyemp
                        double hoursToTTLV = 0;
                        int    lvdefseq    = 0;

                        List <ColumnInfo> ottypeParameters = new List <ColumnInfo>()
                        {
                            new ColumnInfo()
                            {
                                ColumnName = "otcd", ColumnValue = _overtimeApp.otcd
                            }
                        };

                        tottype otType = GetSelectedObject <tottype>(ottypeParameters);

                        if (otType.autr == "Y")
                        {
                            otttlvBll ttlvBll = new otttlvBll();
                            hoursToTTLV = ttlvBll.TransferToLeave(_overtimeApp, otType, ref lvdefseq);
                        }

                        //如果审核,则更新otdetail
                        SaveToOvertimeDetail(_overtimeApp, hoursToTTLV, lvdefseq);
                    }

                    DoUpdate <totaplctn>(_overtimeApp, apnoParameters);

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }