Exemplo n.º 1
0
        public ClientRegistrationModel()
        {
            StateDistrictPlacesControlNames = new List <Cams.Web.MVCRazor.Models.Shared.StateDistrictCityControlNamesModel>();
            StateDistrictPlacesControlNames.Add(new Shared.StateDistrictCityControlNamesModel(""));
            designationModel = new List <DesignationModel>();
            dOBnAgeModellist = new List <DOBnAgeModel>();

            if (!IsActive)
            {
                RegistrationDate = null;
            }

            #region Company Profile
            ClientContacts = new List <ContactDetailsDto>();
            ClientContacts.Add(new ContactDetailsDto()
            {
                ContactNoType      = Common.ContactType.MobileNo,
                ContactNo          = "",
                STDCode            = "020",
                CountryCallingCode = "+91"
            });
            #endregion

            #region Initialize Primary Contact Person
            string PCPPrefix = "PCP";
            ClientPrimaryContactPerson = new ClientPrimaryContactPersonDto();
            StateDistrictPlacesControlNames.Add(new Shared.StateDistrictCityControlNamesModel(PCPPrefix));
            StateDistrictPlacesControlNames[1].LeftLabelsClassName = "width100";
            designationModel.Add(new DesignationModel(PCPPrefix));
            dOBnAgeModellist.Add(new DOBnAgeModel(PCPPrefix));
            dOBnAgeModellist[0].MaxDate = DateTime.Today;
            dOBnAgeModellist[0].Width   = 110;
            ClientPrimaryContactPerson.ClientPrimaryContacts = new List <ContactDetailsDto>();
            ClientPrimaryContactPerson.ClientPrimaryContacts.Add(new ContactDetailsDto()
            {
                ContactNoType      = Common.ContactType.MobileNo,
                ContactNo          = "",
                STDCode            = "020",
                CountryCallingCode = "+91"
            });
            #endregion

            #region Client APMC
            ClientAPMC = new APMCDto();
            GetAllCommodities();
            ApmcModel = new APMCModel();
            #endregion

            #region Subscription Details
            SubscriptionMasterList = getSubscriptionMaster();
            ClientSubscription     = new ClientSubscriptionDto();
            ClientSubscription.SubscriptionMaster         = new SubscriptionMasterDto();
            ClientSubscription.SubscriptionPeriodFromDate = DateTime.Now;
            ClientSubscription.SubscriptionPeriodToDate   = DateTime.Now;
            ClientSubscription.ActivationDate             = DateTime.Now;
            #endregion

            #region Business Constitution
            ClientBusinessConstitution = new BusinessConstitutionDto();
            businessConstitutionModel  = new BusinessConstitutionModel();
            businessConstitutionModel.ClientPartners = new List <ClientPartnerDetailsDto>();
            ClientPartners = new List <ClientPartnerDetailsDto>();
            #endregion

            #region ClientSubscriptionPaymentDetails
            ClientSubscriptionPaymentDetailsModel = new List <ClientSubscriptionPaymentDetailsModel>();
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.Cash
            });
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.Cheque
            });
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.Online
            });
            ClientSubscriptionPaymentDetailsModel.Add(new ClientSubscriptionPaymentDetailsModel {
                PaymentMode = PaymentMode.DD
            });
            #endregion

            CompanyAddress          = new AddressReadOnlyViewModel("");
            CompanyContacts         = new ContactsReadOnlyViewModel("");
            PrimaryContactsAddress  = new AddressReadOnlyViewModel("PCP");
            PrimaryContactsContacts = new ContactsReadOnlyViewModel("PCP");
            APMCAddress             = new AddressReadOnlyViewModel("APMC");
            APMCContacts            = new ContactsReadOnlyViewModel("APMC");
            //#region Account Manager
            //accountManagerModel = new AccountManagerModel();
            //#endregion
        }
        public void SavePrimaryContactDetails(ClientRegistrationModel clientRegistrationModel)
        {
            ClientRegistrationModel companyProfile = GetClientModelFromSession();

            Session["ClientRegistrationActiveTab"] = GetValueFromRequestParams("currentIndex");
            ClientPrimaryContactPersonDto cPCPDetails = new ClientPrimaryContactPersonDto();

            if (Request.IsAjaxRequest())
            {
                cPCPDetails.Title             = GetValueFromRequestParams("Title");
                cPCPDetails.Gender            = GetValueFromRequestParams("Gender");
                cPCPDetails.MothersMaidenName = GetValueFromRequestParams("MothersMaidenName");
                cPCPDetails.DateOfBirth       = ConvertStringToDate(GetValueFromRequestParams("DateOfBirth"));
                cPCPDetails.PAN = GetValueFromRequestParams("PAN");
                cPCPDetails.UID = GetValueFromRequestParams("UID");
                cPCPDetails.CAPrimaryConatactPersonName = GetValueFromRequestParams("CLRPCPName");
                cPCPDetails.IsSameAsCompanyAddress      = GetBoolValueFromRequestParams("IsSameAsCompanyAddress");
                cPCPDetails.IsSameAsCompanyContact      = GetBoolValueFromRequestParams("IsSameAsCompanyContact");

                cPCPDetails.ClientPrimaryContactPersonDesignation = new DesignationDto
                {
                    DesignationId = GetIntValueFromRequestParams("DesignationId")
                };
                cPCPDetails.ClientPrimaryContactPersonAddress = new Common.Dto.Address.AddressDto
                {
                    AddressLine1 = GetValueFromRequestParams("AddressLine1")
                };
                int cityVillageId = (Request.Params["CityVillageId"]) != null?Convert.ToInt32(Request.Params["CityVillageId"]) : 0;

                if (cityVillageId != 0)
                {
                    CityVillageServiceReference.CityVillageServiceClient cityVillageServiceClient = new CityVillageServiceClient();
                    CityVillageDto cityVillageDto = cityVillageServiceClient.GetById(cityVillageId);
                    cPCPDetails.ClientPrimaryContactPersonAddress.CityVillage = cityVillageDto;
                }
                cPCPDetails.ClientPrimaryContactPersonAddress.PIN = GetValueFromRequestParams("PIN");
                cPCPDetails.Email1 = GetValueFromRequestParams("Email1");
                cPCPDetails.Email2 = GetValueFromRequestParams("Email2");
                cPCPDetails.ClientPrimaryContacts = GetContactsFromString(Request.Params["contactDetails"]);
            }
            else
            {
                cPCPDetails.Title             = clientRegistrationModel.ClientPrimaryContactPerson.Title;
                cPCPDetails.Gender            = clientRegistrationModel.ClientPrimaryContactPerson.Gender;
                cPCPDetails.MothersMaidenName = clientRegistrationModel.ClientPrimaryContactPerson.MothersMaidenName;
                cPCPDetails.DateOfBirth       = clientRegistrationModel.ClientPrimaryContactPerson.DateOfBirth;
                cPCPDetails.PAN = clientRegistrationModel.ClientPrimaryContactPerson.PAN;
                cPCPDetails.UID = clientRegistrationModel.ClientPrimaryContactPerson.UID;
                cPCPDetails.CAPrimaryConatactPersonName = clientRegistrationModel.ClientPrimaryContactPerson.CAPrimaryConatactPersonName;
                cPCPDetails.IsSameAsCompanyAddress      = clientRegistrationModel.ClientPrimaryContactPerson.IsSameAsCompanyAddress;
                cPCPDetails.IsSameAsCompanyContact      = clientRegistrationModel.ClientPrimaryContactPerson.IsSameAsCompanyContact;

                if (ComboBoxExtension.GetValue <object>(clientRegistrationModel.designationModel[0].DDLDesignations) != null)
                {
                    cPCPDetails.ClientPrimaryContactPersonDesignation = new DesignationDto
                    {
                        DesignationId = ComboBoxExtension.GetValue <int>(clientRegistrationModel.designationModel[0].DDLDesignations)
                    };
                }

                cPCPDetails.ClientPrimaryContactPersonAddress = new Common.Dto.Address.AddressDto
                {
                    AddressLine1 = clientRegistrationModel.ClientPrimaryContactPerson.ClientPrimaryContactPersonAddress.AddressLine1
                };
                int cityVillageId = clientRegistrationModel.StateDistrictPlacesControlNames[1].HiddenFieldForCityVillageValue;
                if (cityVillageId != 0)
                {
                    CityVillageServiceReference.CityVillageServiceClient cityVillageServiceClient = new CityVillageServiceClient();
                    CityVillageDto cityVillageDto = cityVillageServiceClient.GetById(cityVillageId);
                    cPCPDetails.ClientPrimaryContactPersonAddress.CityVillage = cityVillageDto;
                }
                cPCPDetails.ClientPrimaryContactPersonAddress.PIN = clientRegistrationModel.ClientPrimaryContactPerson.ClientPrimaryContactPersonAddress.PIN;
                cPCPDetails.Email1 = clientRegistrationModel.ClientPrimaryContactPerson.Email1;
                cPCPDetails.Email2 = clientRegistrationModel.ClientPrimaryContactPerson.Email2;
                cPCPDetails.ClientPrimaryContacts = clientRegistrationModel.ClientPrimaryContactPerson.ClientPrimaryContacts;
            }
            companyProfile.ClientPrimaryContactPerson = cPCPDetails;
            if (Session["PrimaryContactPersonUploadedImageFileName"] != null)
            {
                companyProfile.ClientPrimaryContactPerson.Image = Session["PrimaryContactPersonUploadedImageFileName"].ToString();
            }
            Session["CompanyProfile"] = companyProfile;
        }