public ShopVM Setup_To_Create_Shop_Get(string returnUrl, string menuPathMainId) { menuPathMainId.IsNullOrWhiteSpaceThrowException("No Menu Path"); UserId.IsNullOrWhiteSpaceThrowException("You must be logged in to continue."); decimal ratePerMonth = getShopRatePerMonth(); int noOfMonths = 1; decimal totalAmount = ratePerMonth * noOfMonths; AddressStringWithNames customerAddress = getDefaultCustomerAddress(); MenuPathMain mpm = MenuPathMainBiz.Find(menuPathMainId); mpm.IsNullThrowException("Menu Path not found"); CashDistributionEngine cashDistributionEnginge = get_CashDistributionEngineAndCheckBalance(totalAmount, true); string explaintion = string.Format("{0}. All your products will be collected and will be shown in your shop. Note, every shop must have a unique name and will be created in its own area. This shop will be created in: ", cashDistributionEnginge.Message); List <string> shopNames = getShopNamesForCurrUser(); string shopName = getAUniqueNameForShop(); ShopVM shopCreate = new ShopVM("", shopName, explaintion, noOfMonths, ratePerMonth, returnUrl, shopNames, mpm, customerAddress); return(shopCreate); }
public bool AssignUserToServiceRequestHdr(string serviceRequestHdrId) { UserId.IsNullOrWhiteSpaceThrowException("Not logged in"); serviceRequestHdrId.IsNullOrWhiteSpaceThrowArgumentException(); ServiceRequestHdr srh = ServiceRequestHdrBiz.Find(serviceRequestHdrId); srh.IsNullThrowException(); if (srh.ServiceRequestStatusEnum == ServiceRequestStatusENUM.Open) { //Person userPerson = PersonBiz.GetPersonForUserId(UserId); //userPerson.IsNullThrowException(); srh.PersonToId = CurrentUserParameter.PersonId; srh.ServiceRequestStatusEnum = ServiceRequestStatusENUM.Closed; ServiceRequestHdrBiz.Update(srh); PenaltyHeader ph = setupPenaltyHeaderForServiceRequestDetail(srh); } else { throw new Exception("This item is not open"); } return(true); }
public override IList <ICommonWithId> GetListForIndex() { try { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in"); var lstAsFileDoc = base.GetListForIndex().Cast <TEntity>().ToList(); if (lstAsFileDoc.IsNullOrEmpty()) { return(null); } var lst = lstAsFileDoc.Where(x => x.UserId == UserId).ToList(); if (lst.IsNullOrEmpty()) { return(null); } var lstIcommonwithId = lst.Cast <ICommonWithId>().ToList(); return(lstIcommonwithId); } catch (Exception e) { ErrorsGlobal.Add("Unable to continue", MethodBase.GetCurrentMethod(), e); throw new Exception(ErrorsGlobal.ToString()); } }
public override void Fix(ControllerCreateEditParameter parm) { UserId.IsNullOrWhiteSpaceThrowException("User is not logged in"); CashTrx paymentTrx = parm.Entity as CashTrx; paymentTrx.IsNullThrowException("Unable to unbox payment trx"); if (paymentTrx.DocNumber == 0) { paymentTrx.DocNumber = GetNextDocNumber(); } if (parm.Entity.Name.IsNullOrWhiteSpace()) { parm.Entity.Name = UserName; parm.Entity.Name = parm.Entity.MakeUniqueName(); } if (paymentTrx.PersonFromId.IsNullOrEmpty()) { paymentTrx.PersonFromId = null; } paymentTrx.PersonToId.IsNullOrWhiteSpaceThrowException("You must declare who you are paying."); Person personTo = PersonBiz.Find(paymentTrx.PersonToId); personTo.IsNullThrowException("personTo"); paymentTrx.PersonTo = personTo; base.Fix(parm); }
public override void Fix(ControllerCreateEditParameter parm) { UserId.IsNullOrWhiteSpaceThrowException("User is not logged in"); BuySellDoc bsd = BuySellDoc.UnBox(parm.Entity); fixDocumentNumber(bsd); fixName(parm); fixCustomer(bsd); fixSeller(bsd); fixCustomerSalesman(bsd); fix_Super_Customer_Salesman(bsd); fix_Super_Super_Customer_Salesman(bsd); fixOwnerSalesman(bsd); fix_Super_Owner_Salesman(bsd); fix_Super_Super_Owner_Salesman(bsd); fixDeliverymanSalesman(bsd); fix_Super_Deliveryman_Salesman(bsd); fix_Super_Super_Deliveryman_Salesman(bsd); fixAddresses(bsd); fixVehicalType(bsd); fixFreight(bsd); fixDate(bsd); fixFreightOfferTrxId(bsd); fix_Update_BuySellDocStateModifierEnum_InBuySell(parm, bsd); fix_MenuManager(bsd, parm); fix_OptedOutOfSystem(bsd); base.Fix(parm); }
private CashDistributionEngine get_CashDistributionEngineAndCheckBalance(decimal paymentAmount, bool isNonRefundablePaymentAllowed) { UserId.IsNullOrWhiteSpaceThrowException("You must be logged in"); decimal amountToBuyShop = MenuPathMain.Payment_To_Buy_Shop(); Person person = PersonBiz.GetPersonForUserId(UserId); person.IsNullThrowException(); CashBalanceVM cashBalance = BalanceFor_Person(person.Id, CashStateENUM.Available); CashDistributionEngine cde = new CashDistributionEngine( cashBalance, paymentAmount, 0, isNonRefundablePaymentAllowed); if (cde.CanBuy()) { string msg = string.Format("You have a total balance of: Rs{0:N2}. Money = {1:N2}, Non Refundable Tokens {2:N2}. You can buy the shop for this month! The expected spending will be as follows: Money = Rs{3:N2}, Tokens = Rs{4:N2}", cde.CashBalance.Total(), cde.CashBalance.Refundable, cde.CashBalance.NonRefundable, cde.Refundable_Final, cde.NonRefundable_Final); cde.Message = msg; return(cde); } else { throw new Exception("You have a total balance of: Rs" + cde.CashBalance.Total().ToString("N2") + ". You do not have sufficent money to buy the shop."); } }
/// <summary> /// This is loaded during CreateMailerVMForAssigningVerifList /// </summary> //ICollection<AddressVerificationHdr> Inprocess_AddressVerificationHdrsList(string mailerId) //{ // //all the ones in proccess can be printed. // return GetAllHeadersFor(mailerId, SuccessENUM.InProccess); //} /// <summary> /// This is used as the first screen to assign mailings. It provides all the info to the /// mailer about his current status. /// </summary> /// <returns></returns> public MailerVMForAssigningVerifList CreateMailerVMForAssigningVerifList() { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in."); string mailerId = getMailerIdFor(UserId); mailerId.IsNullOrWhiteSpaceThrowException("You are not authorized to be a mailer."); MailerVMForAssigningVerifList mv = factory_MailerVMForAssigningVerifList(); mv.Pakistan_Postal_Verifications_Available = pakistan_Postal_Verifications_Available(); mv.Foreign_Courier_Verifications_Available = total_Foreign_Courier_Available(); mv.Foreign_Postal_Verifications_Available = foreign_Postal_Verifications_Available(); mv.Pakistan_Courier_Verifications_Available = pakistan_Courier_Verifications_Available(); mv.MailerId = mailerId; //initialize Enums mv.MailLocalOrForiegnEnum = MailLocalOrForiegnENUM.Unknown; mv.MailServiceEnum = MailServiceENUM.Unknown; int openMailingsForMailer = total_Open_Mailings_For_Mailer(mv.MailerId); mv.Total_Open_Mailings_For_Mailer = openMailingsForMailer.ToString(); if (openMailingsForMailer > 0) { mv.AddressVerificationHdrList_InProcessOrPrinted = verifHdrs_ReadyForPrintingOrCosts(mv.MailerId); } return(mv); }
private void attachPerson(FileDoc entity) { UserId.IsNullOrWhiteSpaceThrowException(); entity.Person = UserBiz.GetPersonFor(UserId); entity.Person.IsNullThrowException("No attached person to user"); entity.PersonId = entity.Person.Id; }
public Person GetPersonForCurrentUser() { UserId.IsNullOrWhiteSpaceThrowException("User not logged in."); Person person = GetPersonForUserId(UserId); person.IsNullThrowException("No person attached to this user"); return(person); }
public override IList <ICommonWithId> GetListForIndex() { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in"); Owner owner = OwnerBiz.GetOwnerForUser(UserId); owner.IsNullThrowException("Owner not found."); IList <ProductChild> lst = FindAll().Where(x => x.OwnerId == owner.Id && x.Hide == IsShowHidden).ToList() as IList <ProductChild>; return(lst.Cast <ICommonWithId>().ToList()); }
public override void Fix(ControllerCreateEditParameter parm) { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in."); base.Fix(parm); TEntity entity = parm.Entity as TEntity; entity.IsNullThrowException("Unable to unbox email"); if (entity.PersonId.IsNullOrWhiteSpace()) { string personId = GetPersonIdForCurrentUser(); entity.PersonId = personId; } }
//public override void Event_ModifyIndexList(IndexListVM indexListVM, ControllerIndexParams parameters) //{ // base.Event_ModifyIndexList(indexListVM, parameters); // indexListVM.Heading.Column = "All Addresses for User"; // indexListVM.Show.EditDeleteAndCreate = true; // indexListVM.Show.VerificationIcon = true; // indexListVM.Show.MakeDefaultIcon = true; //} public override void Event_ModifyIndexItem(IndexListVM indexListVM, IndexItemVM indexItem, InterfacesLibrary.SharedNS.ICommonWithId icommonWithId) { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in."); base.Event_ModifyIndexItem(indexListVM, indexItem, icommonWithId); //get the current Person from user Person person = UserBiz.GetPersonFor(UserId); person.IsNullThrowException("Person"); if (indexItem.Id == person.DefaultBillAddressId) { indexItem.IsDefault = true; } }
public override void Fix(ControllerCreateEditParameter parm) { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in. Please log in"); base.Fix(parm); Phone phone = parm.Entity as Phone; if (phone.CountryId.IsNullOrWhiteSpace()) { phone.CountryId = null; } //if(phone.PersonId.IsNullOrEmpty()) //{ // Person person = UserBiz.GetPersonFor(UserId); // person.IsNullThrowException(); // phone.PersonId = person.Id; // phone.Person = person; //} }
/// <summary> /// This throws an exception if the deliveryman and the vendor are the same. /// </summary> /// <param name="freightOfferAcceptedTrx"></param> /// <param name="buyselldoc"></param> private void exceptionSellerAndDeliveryManIsTheSame(FreightOfferTrx freightOfferAcceptedTrx, BuySellDoc buyselldoc) { //do not allow if the DeliveryPerson and the VendorPerson and currentUser are the same UserId.IsNullOrWhiteSpaceThrowException(); Person deliveryPerson = DeliverymanBiz.GetPersonForPlayer(freightOfferAcceptedTrx.DeliverymanId); Person sellerPerson = OwnerBiz.GetPersonForPlayer(buyselldoc.OwnerId); Person userPerson = UserBiz.GetPersonFor(UserId); deliveryPerson.IsNullThrowException(); sellerPerson.IsNullThrowException(); deliveryPerson.Id.IsNullOrWhiteSpaceThrowException(); sellerPerson.Id.IsNullOrWhiteSpaceThrowException(); userPerson.IsNullThrowException(); if (deliveryPerson.Id == sellerPerson.Id && userPerson.Id == sellerPerson.Id && buyselldoc.BuySellDocStateEnum == BuySellDocStateENUM.ReadyForPickup) { throw new Exception("You are the seller. You cannot bid for this. If you want to deliver the item, ask the customer to accept you."); } }
public SelectList SelectListBillAddressCurrentUser() { try { UserId.IsNullOrWhiteSpaceThrowException("Not logged in"); return(SelectListBillAddressForUser(UserId)); //throw new NotImplementedException(); //string pId = GetPersonIdForCurrentUser(); ////get all address with this personId //IQueryable<AddressMain> iqAllBillToForUserId = FindAll().Where(x => x.PersonId == pId && x.AddressType.IsBillAddress == true); //SelectList allForUserId = Dal.SelectList_Engine(iqAllBillToForUserId); //return allForUserId; } catch (System.Exception) { } return(new SelectList(Enumerable.Empty <SelectListItem>())); }
//public override async Task<IList<ICommonWithId>> GetListForIndexAsync(ControllerIndexParams parameters) //{ // IList<ProductChild> lst = await FindAllAsync(); // lst = lst.Where(x => x.Hide == IsDontShowHidden).ToList() as IList<ProductChild>; // return lst.Cast<ICommonWithId>().ToList(); //} public override async Task <IList <ICommonWithId> > GetListForIndexAsync(ControllerIndexParams parameters) { //var lstEntities = await FindAllAsync(); UserId.IsNullOrWhiteSpaceThrowException("You are not logged in"); Owner owner = OwnerBiz.GetOwnerForUser(UserId); owner.IsNullThrowException("Owner not found."); List <ProductChild> lstEntities; if (IsShowHidden) { lstEntities = await FindAll().Where(x => x.OwnerId == owner.Id && x.Hide == IsShowHidden).ToListAsync(); } else { lstEntities = await FindAll().Where(x => x.OwnerId == owner.Id).ToListAsync(); } IList <ICommonWithId> lstIcom = lstEntities.Cast <ICommonWithId>().ToList(); return(lstIcom); }
private AddressVerificationHdr CreateVerificationMailingList_Helper(MailLocalOrForiegnENUM mailLocalOrForiegnEnum, MailServiceENUM mailServiceEnum) { //mv.MailerId.IsNullOrWhiteSpaceThrowArgumentException("View lost the data of Mailer Id"); //always a mailer will be logged in and the mailer id will be with the User id. UserId.IsNullOrWhiteSpaceThrowException("You are not logged in"); Person person = UserBiz.GetPersonFor(UserId); person.IsNullThrowException("Person not found for user"); person.Mailers.IsNullOrEmptyThrowException("You are not an authorized mailer"); Mailer mailer = person.Mailers.FirstOrDefault(x => x.MetaData.IsDeleted == false); mailer.IsNullThrowException("You are not an authourized mailer"); var verificationHdr = CreateVerificationMailingListFor(mailer, mailServiceEnum, mailLocalOrForiegnEnum, VerificaionStatusENUM.Requested); return(verificationHdr); }
private long GetNextFileNumber() { UserId.IsNullOrWhiteSpaceThrowException("UserId"); Person person = PersonBiz.GetPersonForUserId(UserId); person.IsNullThrowException("person"); string personId = person.Id; var fileDocs = FindAll().Where(x => x.PersonId == personId).ToList(); long nextFileNumber = 0; if (fileDocs.IsNullOrEmpty()) { nextFileNumber = 1; } else { nextFileNumber = fileDocs.Max(x => x.FileNumber) + 1; } return(nextFileNumber); }
/// <summary> /// Every Owner can add only One product of a specific name. /// We need to load the product in this at a higher level because we are unable to access ProductBiz here /// </summary> /// <param name="parm"></param> public override void Fix(ControllerCreateEditParameter parm) { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in."); ProductChild pc = parm.Entity as ProductChild; pc.IsNullThrowException("Unable to unbox Product Child"); //Product comes from the controller. pc.ProductId.IsNullOrWhiteSpaceThrowException("There is no parent Product"); pc.Product.IsNullThrowException("Product Has not been loaded!"); if (pc.Name.IsNullOrWhiteSpace()) { pc.Name = pc.Product.Name; } //we need to load the owner in because the name is used to create //a directory for the uploads. //first get the Owners Id Owner owner = OwnerBiz.GetOwnerForUser(UserId); owner.IsNullThrowException("Owner not found!"); pc.OwnerId = owner.Id; pc.Owner = owner; ////I dont want to add the features. I will add them temporarily when it is being presented, ////addProductFeatures(pc); FixProductChildFeatures(pc); base.Fix(parm); //check the address. If the address is a new address, make it past of the database for the ProductChild Owner //check if the address exists AddShippingAddressToOwnerPersonIfItIsNew(pc); //AddPhoneNumberToOwnerPersonIfItsNew(pc); }
/// <summary> /// This is the root of the payment trx from where payments will be added. /// We have to decide if non-refundable should only be ransacted by the bank. /// </summary> /// <param name="fromPersonId"></param> /// <param name="personToId"></param> /// <param name="amount"></param> /// <param name="cashTypeEnum"></param> /// <param name="comment"></param> /// <param name="isBank"></param> /// <returns></returns> public bool AddPayment(string fromPersonId, string personToId, decimal amount, CashTypeENUM cashTypeEnum, string comment, bool isBank, decimal availableFund) { UserId.IsNullOrWhiteSpaceThrowException("You must be logged in"); fromPersonId.IsNullOrWhiteSpaceThrowArgumentException("fromId"); personToId.IsNullOrWhiteSpaceThrowArgumentException("toId"); if (cashTypeEnum == CashTypeENUM.Unknown) { throw new Exception("Cash Type is unknown"); } if (amount == 0) { throw new Exception("Amount is zero!"); } if (isBank) { if (availableFund < amount) { string adminComment = "Cash Creation!"; //create cash for that amount createCashTransaction(null, fromPersonId, amount - availableFund, cashTypeEnum, adminComment); } } else { if (availableFund < amount) { throw new Exception(string.Format("Unavailable funds. Currently, you only have {0} which is less than your payment amount of {1}", availableFund, amount)); } } createCashTransaction(fromPersonId, personToId, amount, cashTypeEnum, comment); return(true); }
public override async Task <IList <ICommonWithId> > GetListForIndexAsync(ControllerIndexParams parameters) { UserId.IsNullOrWhiteSpaceThrowException(); //now make sure only those are here which have the same person Person person = UserBiz.GetPersonFor(UserId); person.IsNullThrowException("There is no Person for this user"); List <TEntity> lst = new List <TEntity>(); if (UserBiz.IsAdmin(UserId)) { lst = await FindAllAsync(); parameters.IsUserAdmin = true; } else { lst = await FindAll().Where(x => x.PersonId == person.Id).ToListAsync(); parameters.IsUserAdmin = false; } if (lst.IsNullOrEmpty()) { return(null); } IList <ICommonWithId> lstEntitiesForPersonAsCommonWithId = lst.Cast <ICommonWithId>().ToList(); return(lstEntitiesForPersonAsCommonWithId); }
public async Task <ShopCreatedSuccessfullyVM> Setup_To_Edit_Shop_Post_Async(ShopVM shopVm, string button, HttpPostedFileBase[] httpMiscUploadedFiles) { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in."); shopVm.IsNullThrowExceptionArgument("Shop"); button.IsNullOrWhiteSpaceThrowArgumentException("button"); Owner userOwner = OwnerBiz.GetPlayerFor(UserId); userOwner.IsNullThrowException("You are not authourized to create a shop. Please become a seller first."); if (button == "accept") { //locate the shop if (shopVm.NoOfMonths == 0) { throw new Exception("No of months is zero"); } decimal salePrice = MenuPathMain.Payment_To_Buy_Shop(); int quantity = shopVm.NoOfMonths; //see if User has the money to do what they want. decimal paymentAmount = salePrice * quantity; bool isNonRefundablePaymentAllowed = true; CashDistributionEngine cde = get_CashDistributionEngineAndCheckBalance(paymentAmount, isNonRefundablePaymentAllowed); //get the shop Child Product ProductChild shopBuySellItem = ProductChildBiz.FindForName(ProductChild.GetShopName()); shopBuySellItem.IsNullThrowException("Shop not found"); Owner ownerOfProductChild = shopBuySellItem.Owner; ownerOfProductChild.IsNullThrowException("No Product Child Owner"); Customer customerUser = getCustomerOfUser(); Product product = ProductBiz.Find(shopVm.Id); product.IsNullThrowException("product"); string shopId = product.Id; updateTheProductFromTheShopVm(product, shopVm); SelectList selectListOwner = null; SelectList selectListCustomer = null; SelectList selectListBillTo = null; SelectList selectListShipTo = null; string addressBillToId = ""; string addressShipToId = ""; DateTime expectedDeliveryDate = DateTime.Now; DateTime guaranteePeriodEnds = DateTime.Now; BuySellDoc sale = CreateSale( shopBuySellItem, ownerOfProductChild, quantity, salePrice, customerUser, selectListOwner, selectListCustomer, addressBillToId, addressShipToId, selectListBillTo, selectListShipTo, BuySellDocStateENUM.RequestUnconfirmed, BuySellDocStateModifierENUM.Accept, expectedDeliveryDate, guaranteePeriodEnds, shopId); product.BuySellDocs.Add(sale); ControllerCreateEditParameter parm = new ControllerCreateEditParameter( product as ICommonWithId, httpMiscUploadedFiles, null, null, null, null, null, null, null, MenuENUM.EditDefault, UserName, UserId, shopVm.ReturnUrl, null, //globalObject not required for products button); await ProductBiz.UpdateAndSaveAsync(parm); MenuPathMain mpm = product.MenuPathMains_Fixed.FirstOrDefault(); decimal refundable_Spent = cde.Refundable_Final; decimal nonRefundable_spent = cde.NonRefundable_Final; string shopName = product.FullName(); string mp1Name = mpm.MenuPath1.FullName(); string mp2Name = mpm.MenuPath2.FullName(); string mp3Name = mpm.MenuPath3.FullName(); int numberOfMonths = quantity; DateTime expiryDate = product.ShopExpiryDate.Date_NotNull_Min; ShopCreatedSuccessfullyVM shopCreatedSuccessfully = new ShopCreatedSuccessfullyVM( refundable_Spent, nonRefundable_spent, shopName, mp1Name, mp2Name, mp3Name, numberOfMonths, expiryDate, shopVm.ReturnUrl); return(shopCreatedSuccessfully); } return(null); }
public async Task <ShopCreatedSuccessfullyVM> Setup_To_Create_Shop_Post_Async(ShopVM shopCreate, string button, HttpPostedFileBase[] httpMiscUploadedFiles) { UserId.IsNullOrWhiteSpaceThrowException("You are not logged in."); shopCreate.MenuPathMainId.IsNullOrWhiteSpaceThrowException("Main Menu Path not received"); Owner userOwner = OwnerBiz.GetPlayerFor(UserId); userOwner.IsNullThrowException("You are not authourized to create a shop. Please become a seller first."); if (button == "accept") { //CashDistributionEngine cde; //int quantity; //Product product; //MenuPathMain mpm; //ControllerCreateEditParameter parm = setup_Shop_Into_ControllerCreateEditParameter(shopCreate, button, httpMiscUploadedFiles, userOwner, out cde, out quantity, out product, out mpm, out parm); decimal paymentAmount = MenuPathMain.Payment_To_Buy_Shop(); decimal commissionPct = BuySellDoc.Get_Maximum_Commission_Product_Percent(); bool isNonRefundablePaymentAllowed = true; CashDistributionEngine cde = get_CashDistributionEngineAndCheckBalance(paymentAmount, isNonRefundablePaymentAllowed); //check the name, if it is already used, throw error and return to create screen if (isShopNameExists(shopCreate.ShopName)) { string err = string.Format("The shop name '{0}' already exists... sorry. Try again.", shopCreate.ShopName); throw new Exception(err); } //create the shop int quantity = shopCreate.NoOfMonths; if (quantity == 0) { throw new Exception("The quantity is zero. This is not allowed"); } Customer customerUser = getCustomerOfUser(); SelectList selectListOwner = null; SelectList selectListCustomer = null; SelectList selectListBillTo = null; SelectList selectListShipTo = null; string addressBillToId = ""; string addressShipToId = ""; decimal salePrice = MenuPathMain.Payment_To_Buy_Shop(); DateTime expectedDeliveryDate = DateTime.Now; DateTime guaranteePeriodEnds = DateTime.Now; //MenuPathMain mpm = MenuPathMainBiz.Find(shopCreate.MenuPathMainId); //mpm.IsNullThrowException("Menu Path Main is null"); MenuPathMain mpm = getMainMenuPath(shopCreate); Product product = setup_Product_For_Shop(shopCreate, userOwner); //get the shop Child Product ProductChild shopBuySellItem = ProductChildBiz.FindForName(ProductChild.GetShopName()); shopBuySellItem.IsNullThrowException("Shop not found"); string shopId = product.Id; Owner ownerOfProductChild = shopBuySellItem.Owner; ownerOfProductChild.IsNullThrowException("No Product Child Owner"); BuySellDoc sale = CreateSale( shopBuySellItem, ownerOfProductChild, quantity, salePrice, customerUser, selectListOwner, selectListCustomer, addressBillToId, addressShipToId, selectListBillTo, selectListShipTo, BuySellDocStateENUM.RequestUnconfirmed, BuySellDocStateModifierENUM.Accept, expectedDeliveryDate, guaranteePeriodEnds, shopId); product.BuySellDocs.Add(sale); ControllerCreateEditParameter parm = new ControllerCreateEditParameter( product as ICommonWithId, httpMiscUploadedFiles, null, null, null, null, null, null, null, MenuENUM.EditDefault, UserName, UserId, shopCreate.ReturnUrl, GetGlobalObject(), button); await ShopBiz.CreateAndSaveAsync(parm); decimal refundable_Spent = cde.Refundable_Final; decimal nonRefundable_spent = cde.NonRefundable_Final; string shopName = product.FullName(); string mp1Name = mpm.MenuPath1.FullName(); string mp2Name = mpm.MenuPath2.FullName(); string mp3Name = mpm.MenuPath3.FullName(); int numberOfMonths = quantity; DateTime expiryDate = product.ShopExpiryDate.Date_NotNull_Min; ShopCreatedSuccessfullyVM shopCreatedSuccessfully = new ShopCreatedSuccessfullyVM( refundable_Spent, nonRefundable_spent, shopName, mp1Name, mp2Name, mp3Name, numberOfMonths, expiryDate, shopCreate.ReturnUrl); //BuySellDocBiz.SaveChanges(); return(shopCreatedSuccessfully); } else { string err = string.Format("You caneled the operation."); throw new Exception(err); } }
public string GetPersonIdForCurrentUser() { UserId.IsNullOrWhiteSpaceThrowException("User not logged in."); return(GetPersonIdFor(UserId)); }