Esempio n. 1
0
        protected void loadClientAndVendorDetails()
        {
            String context     = Request.QueryString.GetValues("context")[0];
            String ClientEntId = "";
            String vendorId    = "";

            Label_To.Text = "Vendor Details:";

            if (context.Equals("client"))
            {
                ClientEntId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString();
                vendorId    = Request.QueryString.GetValues("respCompId")[0];
            }
            else
            {
                Dictionary <String, bool> accessList = (Dictionary <String, bool>)Session[SessionFactory.ACCESSLIST_FOR_USER];

                if (!accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_EDIT_POTENTIAL] &&
                    !accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_OWNER_ACCESS])
                {
                    Button_Create_PO.Enabled = false;
                }

                ClientEntId = Request.QueryString.GetValues("EntId")[0];
                vendorId    = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString();
                Label1.Text = "Sales Order";
            }

            String localId     = "";
            String vendDetails = "";
            String custDetails = "";
            String vendContact = "";
            String custContact = "";

            //Populate the vendor details
            Dictionary <String, Object> vendObj = ActionLibrary.customerDetails.getContactDetails(vendorId, 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];

                Label_Vendor_Name.Text = cOBJ.getContactName();
                vendContact            = cOBJ.getMobNo();
                localId = cOBJ.getLocalityId();
            }
            else
            {
                BackEndObjects.MainBusinessEntity mBObj = (BackEndObjects.MainBusinessEntity)vendObj[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_MAIN_BUSINESS_ENTITY];
                Label_Vendor_Name.Text = mBObj.getEntityName();
                vendContact            = mBObj.getPhNo();

                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);
                }

                vendDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + vendContact;
            }
            Label_Vendor_Addr.Text = vendDetails;

            //Get the customer details
            //BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(ClientEntId);
            Dictionary <String, Object> custObj = ActionLibrary.customerDetails.getContactDetails(ClientEntId, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            if (custObj.ContainsKey(ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_CONTACT_DETAILS))
            {
                BackEndObjects.Contacts cOBJ = (BackEndObjects.Contacts)custObj[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_CONTACT_DETAILS];

                Label_Client_Name.Text = cOBJ.getContactName();
                custContact            = cOBJ.getMobNo();
                localId = cOBJ.getLocalityId();
            }
            else
            {
                BackEndObjects.MainBusinessEntity mBObj = (BackEndObjects.MainBusinessEntity)custObj[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_MAIN_BUSINESS_ENTITY];
                Label_Client_Name.Text = mBObj.getEntityName();
                custContact            = mBObj.getPhNo();

                if (mBObj.getAddressDetails() != null)
                {
                    localId = mBObj.getAddressDetails().getLocalityId();
                }
            }

            //BackEndObjects.AddressDetails addrObj=BackEndObjects.AddressDetails.getAddressforMainBusinessEntitybyIdDB(ClientEntId);

            /*if (addrObj.getLocalityId() != null && !addrObj.getLocalityId().Equals(""))
             * {
             *  custDetails += addrObj.getAddrLine1() + ",";
             *  localId = addrObj.getLocalityId();
             *
             *  BackEndObjects.Localities lclObj = BackEndObjects.Localities.getLocalitybyIdDB(localId);
             *  BackEndObjects.City ctObj = BackEndObjects.Localities.getCityDetailsforLocalitywoOtherAsscLocalitiesDB(localId);
             *  BackEndObjects.State stObj = BackEndObjects.City.getStateDetailsforCitywoOtherAsscCitiesDB(ctObj.getCityId());
             *  BackEndObjects.Country cntObj = BackEndObjects.State.getCountryDetailsforStatewoOtherAsscStatesDB(stObj.getStateId());
             *
             *  custDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + custContact;
             *
             * }*/
            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);
                }

                custDetails += lclObj.getLocalityName() + "<br/>" + ctObj.getCityName() + "<br/>" + stObj.getStateName() + "<br/>" + cntObj.getCountryName() + "<br/> Phone:" + custContact;
            }
            Label_Client_Addr.Text = custDetails;
        }