protected void loadClientAndVendorDetails(String rfId, String otherEntId) { String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); String context = Request.QueryString.GetValues("context")[0]; context = context.Equals("client") || context.Equals("clientInvoiceGrid") ? "client" : context; String localId = ""; String vendDetails = ""; String custDetails = ""; String vendContact = ""; String custContact = ""; //Populate the vendor details Dictionary <String, Object> vendObj = ActionLibrary.customerDetails. getContactDetails(otherEntId, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); if (vendObj.ContainsKey(ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_CONTACT_DETAILS)) { BackEndObjects.Contacts cOBJ = (BackEndObjects.Contacts)vendObj[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_CONTACT_DETAILS]; if (context.Equals("client")) { Label_Vendor_Name.Text = cOBJ.getContactName(); vendContact = cOBJ.getMobNo(); vendDetails += cOBJ.getStreetName() + ","; localId = cOBJ.getLocalityId(); } else { Label_Client_Name.Text = cOBJ.getContactName(); custContact = cOBJ.getMobNo(); custDetails += cOBJ.getStreetName() + ","; localId = cOBJ.getLocalityId(); } } else { BackEndObjects.MainBusinessEntity mBObj = (BackEndObjects.MainBusinessEntity)vendObj[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_MAIN_BUSINESS_ENTITY]; BackEndObjects.AddressDetails addrObjEnt = BackEndObjects.AddressDetails.getAddressforMainBusinessEntitybyIdDB(mBObj.getEntityId()); if (context.Equals("client")) { Label_Vendor_Name.Text = mBObj.getEntityName(); vendContact = mBObj.getPhNo(); if (addrObjEnt != null) { vendDetails += addrObjEnt.getAddrLine1() + ","; } } else { Label_Client_Name.Text = mBObj.getEntityName(); custContact = mBObj.getPhNo(); if (addrObjEnt != null) { custDetails += addrObjEnt.getAddrLine1() + ","; } } if (mBObj.getAddressDetails() != null) { localId = mBObj.getAddressDetails().getLocalityId(); } } if (localId != null && !localId.Equals("")) { BackEndObjects.Localities lclObj = BackEndObjects.Localities.getLocalitybyIdDB(localId); BackEndObjects.City ctObj = BackEndObjects.Localities.getCityDetailsforLocalitywoOtherAsscLocalitiesDB(localId); String cityId = (ctObj != null && ctObj.getCityId() != null && !ctObj.getCityId().Equals("") ? ctObj.getCityId() : localId); BackEndObjects.State stObj = BackEndObjects.City.getStateDetailsforCitywoOtherAsscCitiesDB(cityId); if (cityId.Equals(localId)) { ctObj = BackEndObjects.City.getCitybyIdwoLocalitiesDB(localId); } String stateId = (stObj != null && stObj.getStateId() != null && !stObj.getStateId().Equals("") ? stObj.getStateId() : localId); BackEndObjects.Country cntObj = BackEndObjects.State.getCountryDetailsforStatewoOtherAsscStatesDB(stateId); if (stateId.Equals(localId)) { stObj = BackEndObjects.State.getStatebyIdwoCitiesDB(stateId); } if (context.Equals("client")) { vendDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + vendContact; } else { custDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + custContact; } } if (context.Equals("client")) { Label_Vendor_Addr.Text = vendDetails; } else { Label_Client_Addr.Text = custDetails; } //Get the customer details BackEndObjects.MainBusinessEntity custObj = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(entId); if (context.Equals("client")) { Label_Client_Name.Text = custObj.getEntityName(); custContact = custObj.getPhNo(); } else { Label_Vendor_Name.Text = custObj.getEntityName(); vendContact = custObj.getPhNo(); } BackEndObjects.AddressDetails addrObj = BackEndObjects.AddressDetails.getAddressforMainBusinessEntitybyIdDB(entId); if (addrObj.getLocalityId() != null && !addrObj.getLocalityId().Equals("")) { if (context.Equals("client")) { custDetails += addrObj.getAddrLine1() + ","; } else { vendDetails += addrObj.getAddrLine1() + ","; } localId = addrObj.getLocalityId(); if (localId != null && !localId.Equals("")) { BackEndObjects.Localities lclObj = BackEndObjects.Localities.getLocalitybyIdDB(localId); BackEndObjects.City ctObj = BackEndObjects.Localities.getCityDetailsforLocalitywoOtherAsscLocalitiesDB(localId); String cityId = (ctObj != null && ctObj.getCityId() != null && !ctObj.getCityId().Equals("") ? ctObj.getCityId() : localId); BackEndObjects.State stObj = BackEndObjects.City.getStateDetailsforCitywoOtherAsscCitiesDB(cityId); if (cityId.Equals(localId)) { ctObj = BackEndObjects.City.getCitybyIdwoLocalitiesDB(localId); } String stateId = (stObj != null && stObj.getStateId() != null && !stObj.getStateId().Equals("") ? stObj.getStateId() : localId); BackEndObjects.Country cntObj = BackEndObjects.State.getCountryDetailsforStatewoOtherAsscStatesDB(stateId); if (stateId.Equals(localId)) { stObj = BackEndObjects.State.getStatebyIdwoCitiesDB(stateId); } if (context.Equals("client")) { custDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + custContact; } else { vendDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + vendContact; } } } if (context.Equals("client")) { Label_Client_Addr.Text = custDetails; } else { Label_Vendor_Addr.Text = vendDetails; } }