//public AddressVerificationRequest GetAddressVerificationRequestConfirmation(AddressVerificationRequest avr) //{ // var avr2 = GetAddressVerificationRequest(avr.AddressId); // avr2.MailServiceEnum = avr.MailServiceEnum; // avr2.IsSure1 = avr.IsSure1; // avr2.DateIsSure1 = DateTime.UtcNow; // avr2.PaymentAmount = getVerificaionCost(avr2); // return avr2; //} //double getVerificaionCost(AddressVerificationRequest avr) //{ // string error = ""; // double verificationCost = 0; // switch (avr.MailServiceEnum) // { // case MailServiceENUM.Post: // switch (CountryBiz.IsAddressInPakistan(avr.CountryId)) // { // case true: // //is in Pakistan // verificationCost = VerificationConfig.Cost_Postal_Local; // break; // case false: // //is foreign // verificationCost = VerificationConfig.Cost_Postal_International; // break; // default: // error = string.Format("No such option"); // throw new Exception(error); // } // break; // case MailServiceENUM.Courier: // switch (CountryBiz.IsAddressInPakistan(avr.CountryId)) // { // case true: // //is in Pakistan // verificationCost = VerificationConfig.Cost_Courier_Local; // break; // case false: // verificationCost = VerificationConfig.Cost_Courier_International; // //is foreign // break; // default: // error = string.Format("No such option"); // throw new Exception(error); // } // break; // default: // error = string.Format("No such option: {0}", avr.MailServiceEnum); // throw new Exception(error); // } // return verificationCost; //} public void IssueAddressVerificationRequest(AddressVerificationRequest avr, GlobalObject globalObject) { avr.AddressId.IsNullOrWhiteSpaceThrowArgumentException("id"); if (avr.MailServiceEnum == MailServiceENUM.Unknown) { throw new Exception("Mail Service is unknown"); } if (avr.IsSure1 == false) { throw new Exception("Not Sure 1"); } if (avr.IsSure2 == false) { throw new Exception("Not Sure 2"); } if (avr.PaymentAmount == 0) { throw new Exception("No payment amount."); } AddressMain address = Find(avr.AddressId); address.IsNullThrowException("Address Not found"); AddressVerificationTrx addyVerfTrx = fixAddressVerificationTrx(avr, address); //this is where we give the verification number long verificationNumber = GenerateRandomVerificationNumber; addyVerfTrx.Verification.VerificationNumber = verificationNumber; if (address.AddressVerificationTrxs.IsNull()) { address.AddressVerificationTrxs = new List <AddressVerificationTrx>(); } address.AddressVerificationTrxs.Add(addyVerfTrx); address.Verification.VerificaionStatusEnum = VerificaionStatusENUM.Requested; AddressVerificationTrxBiz.Create(addyVerfTrx); ControllerCreateEditParameter param = new ControllerCreateEditParameter(); param.Entity = address as ICommonWithId; param.GlobalObject = globalObject; UpdateAndSave(param); //UpdateAndSave(address); }
public void AddPickupAddress(BuySellDoc buySellDoc) { //add the PickUp From Address to the Complex buySellDoc.AddressShipFromId.IsNullOrWhiteSpaceThrowException("AddressShipFromId"); AddressMain addressShipFrom = AddressBiz.Find(buySellDoc.AddressShipFromId); addressShipFrom.IsNullThrowException("addressShipFrom"); buySellDoc.AddressShipFromString = addressShipFrom.AddressWithoutContacts(); buySellDoc.AddressShipFromComplex = addressShipFrom.ToAddressComplex(); }
public AddressVerificationRequest GetAddressVerificationRequest(string addressId) { UserId.IsNullOrWhiteSpaceThrowArgumentException("Please log in"); addressId.IsNullOrWhiteSpaceThrowArgumentException("No Address Id"); AddressMain address = Find(addressId); address.IsNullThrowException("Address Not found"); return(load_AddressVerificationRequestModel(addressId, address)); }
public void UpdateAndSaveDefaultAddress(string userId, string addressId, GlobalObject globalObject) { userId.IsNullOrWhiteSpaceThrowArgumentException("userId"); addressId.IsNullOrWhiteSpaceThrowArgumentException("AddressId is null"); AddressMain address = Find(addressId); address.IsNullThrowException("Address"); //the default address must always be all three if (!address.AddressType.IsBillAddress || !address.AddressType.IsShipAddress || !address.AddressType.IsInformAddress) { if (!address.AddressType.IsBillAddress) { ErrorsGlobal.AddMessage("Updated to Billing address."); } if (!address.AddressType.IsShipAddress) { ErrorsGlobal.AddMessage("Updated to Shipping address."); } if (!address.AddressType.IsInformAddress) { ErrorsGlobal.AddMessage("Updated to Inform To address."); } address.AddressType.IsBillAddress = true; address.AddressType.IsShipAddress = true; address.AddressType.IsInformAddress = true; Update(address); } Person person = UserBiz.GetPersonFor(userId); person.IsNullThrowException("Person not found"); person.DefaultBillAddressId = addressId; ControllerCreateEditParameter param = new ControllerCreateEditParameter(); param.Entity = person as ICommonWithId; param.GlobalObject = globalObject; PersonBiz.UpdateAndSave(param); //PersonBiz.UpdateAndSave(person); }
public SelectList SelectListForAddressId(string addressId) { try { addressId.IsNullThrowException(); AddressMain addy = Find(addressId); addy.IsNullThrowException(); addy.PersonId.IsNullOrWhiteSpaceThrowException(); return(SelectListForPersonId(addy.PersonId)); } catch (System.Exception) { return(new SelectList(Enumerable.Empty <SelectListItem>())); } }