public IFExtDsgnCU MapEntityToObject(TWMIFEXTDSGN_CU obj) { if (obj != null) { return(new IFExtDsgnCU { District = obj.CD_DIST, WorkRequest = (long)obj.CD_WR, CrewCode = obj.CD_CREW, ErrorRunSequence = obj.CD_SEQ_ERROR_RUN, AccountIndicator = obj.IND_ACCT, ActionQuantity = obj.QT_ACTION, CompletionDate = obj.DT_COMPLETE, CUCode = obj.CD_CU, MUCode = obj.CD_MU, OnOffIndicator = obj.IND_ON_OFF, UsageCode = obj.CD_USAGE, ProcessIndicator = obj.IND_PROCESS, Workpacket = obj.CD_WORKPACKET, ExternalDesignSequence = obj.CD_SEQ_EXTDSGN, ExternalDesignTimeStamp = obj.TS_EXTDSGN, OperatorId = obj.ID_OPER, PointSpanNumber = obj.NO_POINT_SPAN, PointNumber = obj.NO_POINT, ErrorFlag = obj.FG_ERROR, ContractorFlag = obj.FG_CNTCR, EquipmentNumber = obj.NO_EQUIP, ActionIndicator = obj.IND_ACTION, SupplyMethodCode = obj.CD_SUPPLY_METHOD, FacilityNumber = obj.NO_FACILITY }); } return(null); }
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); }
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(); } }
public TWMIFEXTDSGN_CU MapObjectToIfEntity(CU cu, string district, 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 = String.IsNullOrEmpty(cu.PointNumber) ? " " : cu.PointNumber; //NotNull entity.NO_POINT_SPAN = String.IsNullOrEmpty(cu.PointSpanNumber) ? " " : cu.PointSpanNumber; //NotNull entity.CD_CU = cu.UnitCode; entity.IND_ACCT = String.IsNullOrEmpty(cu.Account) ? GetCUAccount(cu.UnitCode) : cu.Account; //NotNull - C, M or O entity.IND_ON_OFF = String.IsNullOrEmpty(cu.OnOff) ? "N" : cu.OnOff; //NotNull entity.FG_CNTCR = "N"; //NotNull entity.CD_USAGE = GetCUUsage(cu.UnitCode); //NotNull - get from twmCU table entity.CD_SUPPLY_METHOD = String.IsNullOrEmpty(cu.SupplyMethod) ? " " : cu.SupplyMethod; //NotNull entity.NO_EQUIP = String.IsNullOrEmpty(cu.EquipNumber) ? " " : cu.EquipNumber; //NotNull entity.CD_WO = string.Empty; entity.DT_COMPLETE = null; entity.IND_ACTION = String.IsNullOrEmpty(cu.UnitAction) ? " " : cu.UnitAction; //NotNull entity.QT_ACTION = String.IsNullOrEmpty(cu.Quantity) ? -1 : (decimal)int.Parse(cu.Quantity); //NotNull entity.FC_DIFFICULTY = null; entity.CD_DIST = district; entity.CD_WR = String.IsNullOrEmpty(cu.WorkRequest) ? 0 : Convert.ToInt32(cu.WorkRequest); entity.CD_OWNERSHIP = string.Empty; entity.CD_BDGT_ITEM = string.Empty; entity.CD_CREW = string.Empty; entity.IND_PROCESS = "A"; //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; entity.CD_MU = String.IsNullOrEmpty(cu.MUID) ? " " : cu.MUID; //NotNull entity.CD_SEQ_ERROR_RUN = null; entity.CD_WORKPACKET = null; return(entity); }
// ------------------------- 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); }
public IFExtDsgnCU GetByEntity(TWMIFEXTDSGN_CU entity) { return(MapEntityToObject(entity)); }