Exemple #1
0
        public TWMIFEXTDSGN_CU MapObjectToIfEntity(IFExtDsgnCU cu, ExtDesignKey key)
        {
            TWMIFEXTDSGN_CU entity = new TWMIFEXTDSGN_CU();

            entity.CD_SEQ_EXTDSGN = GetIfSequenceNo();
            //       entity.CD_SEQ_EXTDSGN = cu.ExternalDesignSequence;
            entity.TS_EXTDSGN    = key.TsExtDsgn;
            entity.ID_OPER       = key.IdOper;
            entity.NO_POINT      = String.IsNullOrEmpty(cu.PointNumber) ? " " : cu.PointNumber;         //NotNull
            entity.NO_POINT_SPAN = String.IsNullOrEmpty(cu.PointSpanNumber) ? " " : cu.PointSpanNumber; //NotNull
            entity.CD_CU         = cu.CUCode;
            //  entity.IND_ACCT = cu.AccountIndicator;
            entity.IND_ACCT         = String.IsNullOrEmpty(cu.AccountIndicator) ? GetCUAccount(cu.CUCode) : cu.AccountIndicator; //NotNull - C, M or O
            entity.IND_ON_OFF       = String.IsNullOrEmpty(cu.OnOffIndicator) ? "N" : cu.OnOffIndicator;                         //NotNull
            entity.FG_CNTCR         = cu.ContractorFlag;                                                                         //NotNull
            entity.CD_USAGE         = String.IsNullOrWhiteSpace(cu.UsageCode) ? GetCUUsage(cu.CUCode) : cu.UsageCode;            //NotNull - get from twmCU table
            entity.CD_SUPPLY_METHOD = String.IsNullOrEmpty(cu.SupplyMethodCode) ? " " : cu.SupplyMethodCode;                     //NotNull
            entity.NO_EQUIP         = String.IsNullOrEmpty(cu.EquipmentNumber) ? " " : cu.EquipmentNumber;                       //NotNull
            entity.CD_WO            = string.Empty;
            entity.DT_COMPLETE      = DateTime.Now;
            //   entity.DT_COMPLETE = cu.CompletionDate;
            entity.IND_ACTION = String.IsNullOrEmpty(cu.ActionIndicator) ? " " : cu.ActionIndicator;  //NotNull
            //  entity.QT_ACTION = String.IsNullOrEmpty(cu.ActionQuantity) ? -1 : (decimal)int.Parse(cu.ActionQuantity);    //NotNull
            entity.QT_ACTION     = cu.ActionQuantity;
            entity.FC_DIFFICULTY = null;

            entity.CD_DIST = cu.District;
            //  entity.CD_WR = String.IsNullOrEmpty(cu.WorkRequest) ? 0 : Convert.ToInt32(cu.WorkRequest);
            entity.CD_WR         = cu.WorkRequest;
            entity.CD_WORKPACKET = cu.Workpacket;
            entity.CD_OWNERSHIP  = string.Empty;
            entity.CD_BDGT_ITEM  = string.Empty;
            entity.CD_CREW       = cu.CrewCode;
            //  entity.IND_PROCESS = "A";   //NotNull - A = add, M = modify, D = delete
            entity.IND_PROCESS = cu.ProcessIndicator; //NotNull - A = add, M = modify, D = delete
            entity.FG_ERROR    = "N";                 //NotNull
            if (key.ExtDsgnFacAttSeq == null)
            {
                entity.NO_FACILITY = null;
            }
            else
            {
                entity.NO_FACILITY = key.ExtDsgnFacAttSeq;
            }
            entity.NO_APPLICATION = null;
            if (cu.MUCode == "NONE")
            {
                cu.MUCode = " ";
            }
            entity.CD_MU            = String.IsNullOrEmpty(cu.MUCode) ? " " : cu.MUCode; //NotNull
            entity.CD_SEQ_ERROR_RUN = null;

            return(entity);
        }
Exemple #2
0
 private void CreateFacilityAttributes(IFExtDsgnCU cup, ExtDesignKey key)
 {
     if (cup.IfExtDsgnFacAtt != null && cup.IfExtDsgnFacAtt.Count > 0)
     {
         foreach (IFExtDsgnFacAtt fa in cup.IfExtDsgnFacAtt)
         {
             unitOfWork.IfExtDesignFacRepo.Insert(MapObjectToFacIfEntity(fa, key));
             unitOfWork.Save();
         }
     }
 }
Exemple #3
0
        public void Delete(IFExtDsgnCU obj)
        {
            TWMIFEXTDSGN_CU entity = MapObjectToEntity(obj);

            if (entity != null)
            {
                {
                    unitOfWork.IfExtDesignCuRepo.Delete(entity.CD_SEQ_EXTDSGN, entity.TS_EXTDSGN, entity.ID_OPER);
                }

                unitOfWork.Save();
            }
        }
Exemple #4
0
        public WMException CreateExternalDesignFromIf(IFExtDsgnCU twmifextdsgn_cu_obj, DateTime timeOfCreate, string oper, string asbOrEstInd)
        {
            WMException  WMexcept = null;
            ExtDesignKey key      = new ExtDesignKey()
            {
                TsExtDsgn = timeOfCreate, IdOper = oper
            };

            //   foreach (IFExtDsgnCU cuIf in twmifextdsgn_cu_objs)
            //  {


            ///////////////////
            ////get the next Oracle WE_S_SO_EXTDSG
            //  ExtDesignKey key = new ExtDesignKey() { TsExtDsgn = DateTime.Now, IdOper = twmifextdsgn_pt_obj.OperatorId };
            //   ExtDesignKey key = new ExtDesignKey() { TsExtDsgn = twmifextdsgn_cu_objs[0].ExternalDesignTimeStamp, IdOper = twmifextdsgn_cu_objs[0].OperatorId };


            ///////////////////
            ////insert Points//
            //      new PointBl().CreateExternalDesign(design, design.Points, key);

            ///////////////////////
            ////insert CUs /FAC's//
            //     CreateCUsFacilityAttributes(design, key);

            key.ExtDsgnFacAttSeq = null;
            if (twmifextdsgn_cu_obj.IfExtDsgnFacAtt != null && twmifextdsgn_cu_obj.IfExtDsgnFacAtt.Count > 0)
            {
                key.ExtDsgnFacAttSeq = (int)GetIfSequenceNo();
            }

            CreateExternalDesignCuIf(twmifextdsgn_cu_obj, key);

            CreateFacilityAttributes(twmifextdsgn_cu_obj, key);
            //    }

            ///////////////////
            ////call P Driver//
            //    WMexcept = ExecutePDriver(twmifextdsgn_cu_obj, key);


            return(WMexcept);
        }
Exemple #5
0
        // -------------------------

        private TWMIFEXTDSGN_CU MapObjectToCuIfEntity(IFExtDsgnCU ifcu, ExtDesignKey key)
        {
            TWMIFEXTDSGN_CU entity = new TWMIFEXTDSGN_CU();

            entity.CD_SEQ_EXTDSGN = GetIfSequenceNo();
            entity.TS_EXTDSGN     = key.TsExtDsgn;
            entity.ID_OPER        = key.IdOper;
            entity.NO_POINT       = ifcu.PointNumber;
            entity.NO_POINT_SPAN  = ifcu.PointSpanNumber;
            entity.CD_DIST        = ifcu.District;
            entity.CD_WR          = ifcu.WorkRequest;
            entity.CD_BDGT_ITEM   = "";
            entity.CD_CREW        = ifcu.CrewCode;
            entity.CD_CU          = ifcu.CUCode;
            entity.CD_MU          = ifcu.MUCode;
            entity.CD_USAGE       = ifcu.UsageCode;
            entity.CD_WORKPACKET  = ifcu.Workpacket;
            entity.DT_COMPLETE    = ifcu.CompletionDate;
            entity.IND_ACCT       = ifcu.AccountIndicator;
            entity.IND_ON_OFF     = ifcu.OnOffIndicator;
            entity.IND_PROCESS    = ifcu.ProcessIndicator;
            entity.QT_ACTION      = ifcu.ActionQuantity;
            // entity.CD_SEQ_EXTDSGN = GetIfSequenceNo();
            entity.CD_SEQ_EXTDSGN   = ifcu.ExternalDesignSequence;
            entity.ID_OPER          = ifcu.OperatorId;
            entity.NO_POINT         = ifcu.PointNumber;
            entity.NO_POINT_SPAN    = ifcu.PointSpanNumber;
            entity.TS_EXTDSGN       = ifcu.ExternalDesignTimeStamp;
            entity.CD_SEQ_ERROR_RUN = ifcu.ErrorRunSequence;
            entity.FG_ERROR         = ifcu.ErrorFlag;
            entity.FG_CNTCR         = ifcu.ContractorFlag;
            entity.CD_SUPPLY_METHOD = ifcu.SupplyMethodCode;
            entity.IND_ACTION       = ifcu.ActionIndicator;
            entity.NO_EQUIP         = ifcu.EquipmentNumber;
            entity.NO_FACILITY      = ifcu.FacilityNumber;
            //  FC_DIFFICULTY = obj
            //   CD_BDGT_ITEM = obj.
            //  CD_SEQ_ERROR_RUN = GetIfSequenceNo()

            return(entity);
        }
Exemple #6
0
        //public TWMIFEXTDSGN_CU MapObjectToIfEntityForDelete(IFExtDsgnCU obj)
        //{
        //    if (obj != null)
        //    {
        //        return new TWMIFEXTDSGN_CU
        //        {
        //            CD_DIST = obj.District,
        //            CD_WR = obj.WorkRequest,
        //            CD_CREW = obj.CrewCode,
        //            CD_CU = obj.CUCode,
        //            CD_MU = obj.MUCode,
        //            CD_USAGE = obj.UsageCode,
        //            CD_WORKPACKET = obj.Workpacket,
        //            DT_COMPLETE = obj.CompletionDate,
        //            IND_ACCT = obj.AccountIndicator,
        //            IND_ON_OFF = obj.OnOffIndicator,
        //            IND_PROCESS = obj.ProcessIndicator,
        //            QT_ACTION = obj.ActionQuantity,
        //            // CD_SEQ_EXTDSGN = GetIfSequenceNo(),
        //            CD_SEQ_EXTDSGN = obj.ExternalDesignSequence,
        //            ID_OPER = obj.OperatorId,
        //            NO_POINT = obj.PointNumber,
        //            NO_POINT_SPAN = obj.PointSpanNumber,
        //            TS_EXTDSGN = obj.ExternalDesignTimeStamp,
        //            CD_SEQ_ERROR_RUN = obj.ErrorRunSequence,
        //            FG_ERROR = obj.ErrorFlag,
        //            FG_CNTCR = obj.ContractorFlag,
        //            CD_SUPPLY_METHOD = obj.SupplyMethodCode,
        //            IND_ACTION = obj.ActionIndicator,
        //            NO_EQUIP = obj.EquipmentNumber,
        //            NO_FACILITY = obj.FacilityNumber,

        //            //  FC_DIFFICULTY = obj
        //            //   CD_BDGT_ITEM = obj.
        //            //  CD_SEQ_ERROR_RUN = GetIfSequenceNo()
        //        };

        //    }
        //    return null;
        //}

        //---------------------------------------------
        public TWMIFEXTDSGN_CU MapObjectToEntity(IFExtDsgnCU obj)
        {
            if (obj != null)
            {
                return(new TWMIFEXTDSGN_CU
                {
                    CD_DIST = obj.District,
                    CD_WR = obj.WorkRequest,
                    CD_CREW = obj.CrewCode,
                    CD_CU = obj.CUCode,
                    CD_MU = obj.MUCode,
                    CD_USAGE = obj.UsageCode,
                    CD_WORKPACKET = obj.Workpacket,
                    DT_COMPLETE = obj.CompletionDate,
                    IND_ACCT = obj.AccountIndicator,
                    IND_ON_OFF = obj.OnOffIndicator,
                    IND_PROCESS = obj.ProcessIndicator,
                    QT_ACTION = obj.ActionQuantity,
                    //  CD_SEQ_EXTDSGN = GetIfSequenceNo(),
                    CD_SEQ_EXTDSGN = obj.ExternalDesignSequence,
                    ID_OPER = obj.OperatorId,
                    NO_POINT = obj.PointNumber.Trim(),
                    NO_POINT_SPAN = obj.PointSpanNumber.Trim(),
                    TS_EXTDSGN = obj.ExternalDesignTimeStamp,
                    CD_SEQ_ERROR_RUN = obj.ErrorRunSequence,
                    FG_ERROR = obj.ErrorFlag,
                    FG_CNTCR = obj.ContractorFlag,
                    CD_SUPPLY_METHOD = obj.SupplyMethodCode,
                    IND_ACTION = obj.ActionIndicator,
                    NO_EQUIP = obj.EquipmentNumber,
                    NO_FACILITY = obj.FacilityNumber
                                  //  FC_DIFFICULTY = obj
                                  //   CD_BDGT_ITEM = obj.
                                  //  CD_SEQ_ERROR_RUN = GetIfSequenceNo()
                });
            }
            return(null);
        }
Exemple #7
0
        private WMException ExecutePDriver(IFExtDsgnCU ifcu, ExtDesignKey key, string asbOrExtInd)
        {
            WMException wme = null;

            DesignCUIfError error = unitOfWork.IfExtDsgnCuRepo.Insert(MapObjectToIfEntity(ifcu, key), asbOrExtInd);

            if (error != null)
            {
                wme = CreateWMException(error.v_fg_error
                                        , error.v_cd_seq_error
                                        , error.v_cd_sqlcode
                                        , error.v_nm_interface
                                        , error.v_ts_error
                                        , error.v_txt_sqlerrtext
                                        , error.v_txt_iferror
                                        , error.v_cd_seq_error_run
                                        , error.v_cd_district
                                        , error.v_cd_workpacket
                                        , error.v_cd_crew
                                        , error.v_cd_project
                                        , error.v_id_empl
                                        , error.v_cd_fleet
                                        , error.v_nm_table
                                        , error.v_nm_column
                                        , error.v_fg_data_error
                                        , error.v_ts_error_logged);
            }



            if (wme == null)
            {
            }

            return(wme);
        }
Exemple #8
0
 public void CreateExternalDesignCuIf(IFExtDsgnCU cu, ExtDesignKey key)
 {
     unitOfWork.IfExtDesignCuRepo.Insert(MapObjectToIfEntity(cu, key));
     unitOfWork.Save();
 }