private string GetTxtValue(TWMBILLINGMORE entity) { string actualValue = entity.TWMAMPACITY == null ? string.Empty : entity.TWMAMPACITY.CD_AMPACITY + entity.TWMSERVICETYPE == null ? string.Empty : entity.TWMSERVICETYPE.CD_SERVICE_TYPE + entity.TWMSERVICEVOLT == null ? string.Empty : entity.TWMSERVICEVOLT.CD_SERVICE_VOLT + entity.TWMCUSTTYPE == null ? string.Empty : entity.TWMCUSTTYPE.TP_CUSTOMER; if (actualValue == string.Empty) { return(entity.TXT_VALUE); } else { return(actualValue); } }
public IEnumerable <TWMBILLINGMORE> MapObjectToEntity(ExtraDetails obj) { List <TWMBILLINGMORE> entity = new List <TWMBILLINGMORE>(); foreach (System.Reflection.PropertyInfo item in new List <System.Reflection.PropertyInfo>(obj.GetType().GetProperties())) { var ent = new TWMBILLINGMORE(); ent.CD_DIST = obj.district; ent.CD_WR = Convert.ToInt64(obj.workRequestId); ent.TXT_VALUE = (string)item.GetValue(obj, null); ent.NM_FIELD = item.Name; if (item.Name != "workRequestId" && item.Name != "district") { ent.TXT_VALUE = (string)item.GetValue(obj, null); ent.NM_FIELD = item.Name; entity.Add(ent); } } return(entity); }