示例#1
0
        public void SaveOTDetail(totdetail obj)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    //如果自动转换成休假,则新增lvdfbyemp
                    double hoursToTTLV = 0;
                    int    lvdefseq    = 0;

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

                    tottype otType = GetSelectedObject <tottype>(ottypeParameters);

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

                    //更新detail的ttlv信息
                    obj.istr = hoursToTTLV == 0 ? "N" : "Y";
                    obj.ttlv = hoursToTTLV == 0 ? "" : obj.tottype.otcd;
                    obj.tlhr = hoursToTTLV;
                    obj.tlrf = lvdefseq.ToString();
                    obj.lmur = Function.GetCurrentUser();
                    obj.lmtm = DateTime.Now;

                    baseDal.DoInsert <totdetail>(obj);

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
            finally
            {
            }
        }
示例#2
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);
            }
        }
示例#3
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);
            }
        }
示例#4
0
        public void UpdateOTDetail(totdetail obj, List <ColumnInfo> _parameters)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    List <ColumnInfo> parameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "emno", ColumnValue = obj.emno
                        },
                        new ColumnInfo()
                        {
                            ColumnName = "otdt", ColumnValue = UtilDatetime.FormatDate1(obj.otdt), ColumnType = "datetime"
                        },
                        new ColumnInfo()
                        {
                            ColumnName = "sttm", ColumnValue = UtilDatetime.FormatDate1(obj.sttm), ColumnType = "datetime"
                        }
                    };

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


                    //如果自动转换成休假,则新增lvdfbyemp
                    double hoursToTTLV = 0;
                    int    lvdefseq    = 0;

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

                    tottype otType = GetSelectedObject <tottype>(ottypeParameters);

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

                    //更新detail的ttlv信息
                    obj.istr = hoursToTTLV == 0 ? "N" : "Y";
                    obj.ttlv = hoursToTTLV == 0 ? "" : otType.otcd;
                    obj.tlhr = hoursToTTLV;
                    obj.tlrf = lvdefseq.ToString();
                    obj.lmur = Function.GetCurrentUser();
                    obj.lmtm = DateTime.Now;

                    DoUpdate <totdetail>(obj, _parameters);

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