示例#1
0
        public TWMWR MapObjectToEntity(WorkRequest obj)
        {
            TWMWR entity = new TWMWR();

            entity = MapRootObjectToEntity(obj, entity);

            return(entity);
        }
示例#2
0
        public Geo Get(TWMWR entity)
        {
            if (entity != null)
            {
                Geo obj = MapEntityToObject(entity);

                return(obj);
            }

            return(null);
        }
示例#3
0
        public Geo MapEntityToObject(TWMWR entity)
        {
            Geo obj = new Geo();

            obj.WorkRequest = (int)entity.CD_WR;
            obj.Dist        = entity.CD_DIST;
            obj.Area        = entity.CD_AREA;
            obj.Zone        = entity.CD_ZONE;
            obj.XCoordinate = entity.AD_GR_1;
            obj.YCoordinate = entity.AD_GR_2;

            return(obj);
        }
示例#4
0
        public TWMWR MapRootObjectToEntity(WorkRequest obj, TWMWR entity)
        {
            entity.CD_WR   = obj.WorkRequestId;
            entity.CD_DIST = obj.Geo.Dist;

            entity.DS_WR       = obj.JobDescription;
            entity.DT_REQUIRED = obj.RequiredDate;
            entity.CD_CREWHQ   = obj.CrewHeadquarter;
            //obj.AssignedTo = string.Empty;
            entity.TP_WR = obj.WorkType;
            //entity.TWMWRNONDESIGNED.CD_JOB = obj.JobCode;
            entity.TP_JOB          = obj.JobType;
            entity.TXT_REFERENCE_5 = obj.MobilizedWr;

            ////////////entity.FG_CHARGEABLE = "Y";
            ////////////entity.IND_UTIL = "Y";
            ////////////entity.FG_JOB_CARD_PRINTED = "Y";
            ////////////entity.FG_ADD_ITEM = "Y";
            ////////////entity.FG_WO_COST = "Y";
            ////////////entity.FG_CANCELED = "Y";
            ////////////entity.FG_APPOINTMENT = "Y";
            ////////////entity.FG_AUTOC_FAILED = "Y";
            ////////////entity.CD_FORECAST = "Y";
            ////////////entity.FG_EXT_OWNER = "Y";
            ////////////entity.FG_READY_TO_ASSIGN = "Y";
            ////////////entity.FG_DT_REQ_COMMIT = "Y";

            //obj.WorkRequestStatus = entity.CD_STATUS;
            //obj.Project = entity.CD_PROJECT;
            //obj.ProjectName = entity.NM_PROJECT;
            //obj.IOInstallation = entity.CD_WO_INSTL;
            //obj.IORemoval = entity.CD_WO_REMOV;
            //obj.IOTransfer = entity.CD_WO_TRNSF;
            //obj.IORevenue = entity.CD_WO_REVENUE;
            //obj.Priority = string.Empty;
            //obj.MeterNo = entity.NO_METER;
            //obj.WorkRequestRelatedTo = 0;
            //obj.ExternalJobNumber = string.Empty;


            //obj.DateCanceled = entity.DT_CANCELLED;
            //obj.Status = entity.CD_STATUS;
            //obj.Canceled = entity.FG_CANCELED == "Y" ? true : false;
            //obj.District = null;



            //entity.TWMDESIGNs = new DesignBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).MapObjectsToEntities(obj.Specifications).ToList();

            //AsBuilt = new DesignBl();
            //entity.TWMBILLINGMOREs = new ExtraDetailsBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).MapObjectToEntity(obj.ExtraDetails).ToList();

            //obj.Address = new AddressBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetAddress(entity.TWMADDRESS);
            //obj.Geo = new GeoBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetGeo(entity);
            //obj.Customers = new CustomerBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetCustomers(entity.TWMCUSTOMERs);
            //obj.Contact = new Customer();
            //obj.AssociatedParties = new AssociatedPartyBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetAssociatedParties(entity.TWMASSOCPARTies);
            //obj.Remarks = new RemarkBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetRemarks(entity.TWMREMARKs);
            //obj.FieldReports = new FieldReports();
            //obj.WorkPackets = new WorkPacketBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetWorkPackets(entity.TWMWORKPACKETs);
            //// TODO: problem with primary keys - fix causes slowness
            //obj.Attachments = new AttachmentBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetAttachmentsByWorkRequestId((int)entity.CD_WR);
            //obj.MilestoneRequirements = new MilestoneRequirementBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetMilestoneRequirements(entity.TWMMILESTONERQMTs);

            //entity.TWMMILESTONERQMTs = new MilestoneRequirementBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).MapObjectsToEntities(obj.MilestoneRequirements).ToList();

            //obj.Premises = new PremiseBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetPremises(entity.TWMPREMISEs);
            //obj.GasLoadDetails = new GasLoadDetailBl(dbManagerBase.iOrigin, dbManagerBase.iEnvironment).GetGasLoadDets(entity.TWMGASLOADDETs);


            return(entity);
        }
示例#5
0
        public WorkRequest MapEntityToObject(TWMWR entity)
        {
            if (entity != null)
            {
                WorkRequest obj = new WorkRequest();

                obj.WorkRequestId = entity.CD_WR;
                obj.District      = entity.CD_DIST;

                obj.JobDescription  = entity.DS_WR;
                obj.RequiredDate    = entity.DT_REQUIRED;
                obj.CrewHeadquarter = entity.CD_CREWHQ;
                obj.AssignedTo      = entity.ID_OPER_ASSIGNED;
                obj.WorkType        = entity.TP_WR;
                obj.JobCode         = entity.TWMWRNONDESIGNED != null ? entity.TWMWRNONDESIGNED.CD_JOB : string.Empty;
                obj.JobType         = entity.TP_JOB;

                //obj.Latitude = entity.AD_GR_1; //Not needed here..in the Geo model XCoordinate
                //obj.Longitute = entity.AD_GR_2; //Not needed here..in the Geo model YCoordinate
                //obj.ReviewDate = entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 712 && m.ST_RQMT == "C").FirstOrDefault() != null ? entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 712 && m.ST_RQMT == "C").FirstOrDefault().TS_OPER_LAST_UPDTD.ToString() : string.Empty;
                //obj.SuprevisorID = entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 712).Count() > 0 ? entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 712).FirstOrDefault().ID_OPER_LAST_UPDTD != null ? entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 712).FirstOrDefault().ID_OPER_LAST_UPDTD.ToString(): string.Empty : string.Empty;
                //obj.WorkCompletedDate = entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 699 && m.ST_RQMT == "C").FirstOrDefault() != null ? entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 699 && m.ST_RQMT == "C").FirstOrDefault().TS_OPER_LAST_UPDTD.ToString() : string.Empty;
                //obj.WorkRequestClosedDate = entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 899 && m.ST_RQMT == "C").FirstOrDefault() != null ? entity.TWMMILESTONERQMTs.Where(m => m.CD_RQMT == 899 && m.ST_RQMT == "C").FirstOrDefault().TS_OPER_LAST_UPDTD.ToString() : string.Empty;

                //obj.WorkRequestStatus = entity.CD_STATUS;
                obj.Project        = entity.CD_PROJECT;
                obj.ProjectName    = entity.NM_PROJECT;
                obj.IOInstallation = entity.CD_WO_INSTL;
                obj.IORemoval      = entity.CD_WO_REMOV;
                obj.IOTransfer     = entity.CD_WO_TRNSF;
                obj.IORevenue      = entity.CD_WO_REVENUE;
                obj.Priority       = entity.CD_PRIORITY;
                obj.MeterNo        = entity.NO_METER;
                //obj.WorkRequestRelatedTo = entity.CD_WR_RELATED;

                obj.ExternalJobNumber = entity.NO_EXT_JOB;
                obj.ExternalSystemId  = entity.NO_EXT_SYS_ID;
                obj.HrEstTime         = entity.HR_EST_TIME;

                obj.DateCanceled = entity.DT_CANCELLED;
                obj.Status       = entity.CD_STATUS;
                obj.Canceled     = entity.FG_CANCELED == "Y" ? true : false;
                obj.Resolution   = entity.CD_RESOLUTION;

                obj.ContactName  = entity.NM_CONTACT; // not the same as customer
                obj.ContactPhone = entity.TL_CONTACT;

                obj.MobilizedWr = entity.TXT_REFERENCE_5;

                obj.Specifications = entity.TWMDESIGNs != null && entity.TWMDESIGNs.Count > 0 ? new DesignBl().GetByEntities(entity.TWMDESIGNs) : null;
                //AsBuilt = new DesignBl();
                obj.ExtraDetails = entity.TWMBILLINGMOREs != null && entity.TWMBILLINGMOREs.Count > 0 ? new ExtraDetailsBl().GetByEntities(entity.TWMBILLINGMOREs) : null;
                obj.Address      = entity.TWMADDRESS != null ? new AddressBl().Get(entity.TWMADDRESS) : null;
                obj.Geo          = new GeoBl().Get(entity);
                obj.Customers    = entity.TWMCUSTOMERs != null && entity.TWMCUSTOMERs.Count > 0 ? new CustomerBl().GetByEntities(entity.TWMCUSTOMERs) : null;

                obj.AssociatedParties = entity.TWMASSOCPARTies != null && entity.TWMASSOCPARTies.Count > 0 ? new AssociatedPartyBl().GetByEntities(entity.TWMASSOCPARTies) : null;
                obj.Remarks           = entity.TWMREMARKs != null && entity.TWMREMARKs.Count > 0 ? new RemarkBl().GetByEntities(entity.TWMREMARKs) : null;
                obj.FieldReports      = new FieldReports();
                obj.WorkPackets       = entity.TWMWORKPACKETs != null && entity.TWMWORKPACKETs.Count > 0 ? new WorkPacketBl().Get(entity.TWMWORKPACKETs) : null;
                // TODO: problem with primary keys - fix causes slowness
                //    obj.Documents = entity.twmw new DocumentBl().GetDocumentsByWorkRequestId((long)entity.CD_WR);
                obj.MilestoneRequirements = entity.TWMMILESTONERQMTs != null && entity.TWMMILESTONERQMTs.Count > 0 ? new MilestoneRequirementBl().GetByEntities(entity.TWMMILESTONERQMTs) : null;
                obj.Premises            = entity.TWMPREMISEs != null && entity.TWMPREMISEs.Count > 0 ? new PremiseBl().GetByEntities(entity.TWMPREMISEs) : null;
                obj.GasLoadDetails      = entity.TWMGASLOADDETs != null && entity.TWMGASLOADDETs.Count > 0 ? new GasLoadDetailBl().GetByEntities(entity.TWMGASLOADDETs) : null;
                obj.PointAsbs           = entity.TWMPOINT_ASBs != null && entity.TWMPOINT_ASBs.Count > 0 ? new PointASBBl().Get(entity.TWMPOINT_ASBs) : null;
                obj.ExceptionConditions = entity.TWMIFEXCEPTIONCONDs != null && entity.TWMIFEXCEPTIONCONDs.Count > 0 ? new ExceptionConditionBl().GetByWorkRequestId((long)entity.CD_WR) : null;
                return(obj);
            }

            return(null);
        }
示例#6
0
 public WorkRequest GetByEntity(TWMWR entity)
 {
     return(MapEntityToObject(entity));
 }