示例#1
0
 public RentalRequest GetRentalRequestOk(Customer customer, int quantity, RentalType type)
 {
     return(new RentalRequest
     {
         Customer = customer,
         Quantity = quantity,
         RentalType = type
     });
 }
 public ActionResult Edit([Bind(Include = "rentalTypeID,description,discount")] RentalType rentalType)
 {
     if (ModelState.IsValid)
     {
         Biz.Edit(rentalType);
         return(RedirectToAction("Index"));
     }
     return(View(rentalType));
 }
示例#3
0
        /// <summary>
        /// Adds a new rental to a promo
        /// </summary>
        /// <param name="rentalType">rental type</param>
        /// <param name="dateFrom">starting date</param>
        /// <param name="prices">rental prices object</param>
        public void AddRental(RentalType rentalType, DateTime dateFrom, Prices prices)
        {
            var rental = Rental.ByType(rentalType);

            rental.Prices   = prices;
            rental.BikeId   = Guid.NewGuid();
            rental.DateFrom = dateFrom;
            this.Rentals.Add(rental);
        }
        private void CheckAlternativeMaterialsSettings()
        {
            RentalType rt = ControlObjectContext.GetObjectByKey(new EntityKey("ModelTMSContainer.RentalTypeSet", "Id", new Guid(ComboBoxMaterialType.SelectedValue))) as RentalType;

            URLPopUpControlAlternativeMaterials.Visible    = rt.AlternativeRentalTypes.Count > 0;
            URLPopUpControlAlternativeMaterials.URLToPopup = "WebFormPopUp.aspx?uc=RentAlternativeMaterials&RentalType=" + ComboBoxMaterialType.SelectedValue +
                                                             "&LocationId=" + EntityDataSourceMaterials.CommandParameters["LocationId"].DefaultValue +
                                                             "&StartDate=" + EntityDataSourceMaterials.CommandParameters["StartDate"].DefaultValue +
                                                             "&EndDate=" + EntityDataSourceMaterials.CommandParameters["EndDate"].DefaultValue;
        }
示例#5
0
        public static RentalType CreateRentalType(TestContext ctx, int rentalTypeId, string description, string unit, double priceUnit)
        {
            RentalType rentalType = new RentalType();

            rentalType.RentalTypeId = rentalTypeId;
            rentalType.Description  = description;
            rentalType.Unit         = unit;
            rentalType.PriceUnit    = priceUnit;
            ctx.RentalTypes.Add(rentalType);
            return(rentalType);
        }
        public void ShouldPassRentByHour(RentalType rentalType, int total, int expectedCharge)
        {
            var customerService = GetCustomerService(rentalType, total);

            var actual = sut.Save(customerService);

            Assert.False(actual.HasErrors);

            var actualResult = ((CustomerService)actual.ResultData).TotalCharge;

            Assert.AreEqual(expectedCharge, actualResult);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ButtonSearch_Click(sender, e);

                // get the parent description
                ModelTMSContainer _ControlObjectContext = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);
                EntityKey         TempKey = new EntityKey("ModelTMSContainer.RentalTypeSet", "Id", Guid.Parse(Request.Params["Id"]));
                RentalType        TempObj = _ControlObjectContext.GetObjectByKey(TempKey) as RentalType;
                LabelObjectName.Text = TempObj.Description;
            }
        }
        public void ConstructQuery()
        {
            RentalType rt = ControlObjectContext.GetObjectByKey(new System.Data.EntityKey("ModelTMSContainer.RentalTypeSet", "Id", new Guid(Request.Params["RentalType"]))) as RentalType;

            StringBuilder Query = new StringBuilder();

            Query.Append("select distinct it.Id, it.ItemNumber, it.Description, it.Description, it.BaseRentalPrice, it.RentPerDay, it.RentPerWeek, it.RentPerMonth, it.BailPrice, it.Location.Description as LocationDescription " +
                         "from RentalItemSet as it  " +
                         "where  " +
                         "it.IsActive and  " +
                         "( (it.ItemState = \"Available\") or (it.ItemState = \"Rented\") ) and " +
                         "( it not in ( " +
                         "	select value itx2.RentalItem  "+
                         "	from RentalItemActivitySet as itx2  "+
                         "	where itx2.RentalItem.Id = it.Id and "+
                         "	 (  "+
                         "	   ((@StartDate <= itx2.RentStartDateTime) and (@EndDate >= itx2.RentStartDateTime))  "+
                         "	 ) or "+
                         "	 ( "+
                         "	   ((@StartDate >= itx2.RentStartDateTime) and (@StartDate <= itx2.RentEndStartDateTime)) "+
                         "	 ) "+
                         "  ) " +
                         ") and  ( cast(it.RentalType.Id as System.String) in { ");
            // insert the alternative rental type ID's
            foreach (RentalType rtAlt in rt.AlternativeRentalTypes)
            {
                Query.Append("'" + rtAlt.Id.ToString() + "'");
            }
            Query.Append("} ) ");

            // insert the location ID if required
            if (CheckBoxIncludeAlternativeLocations.Checked)
            {
                if (ComboBoxLocations.SelectedValue != "")
                {
                    Query.Append(" and (it.Location.Id = @LocationId) ");
                    EntityDataSourceMaterials.CommandParameters["LocationId"].DefaultValue = ComboBoxLocations.SelectedValue;
                }
            }
            else
            {
                Query.Append(" and (it.Location.Id = @LocationId) ");
                EntityDataSourceMaterials.CommandParameters["LocationId"].DefaultValue = Request.Params["LocationId"];
            }

            // add the ordering
            Query.Append("order by Description, BaseRentalPrice");

            // set as commandtext
            EntityDataSourceMaterials.CommandText = Query.ToString();
        }
        // GET: RentalTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RentalType rentalType = Biz.Get(id ?? 0);

            if (rentalType == null)
            {
                return(HttpNotFound());
            }
            return(View(rentalType));
        }
 private CustomerService GetCustomerService(RentalType rentalType, int total)
 {
     return(new CustomerService
     {
         RentServices = new List <RentService>
         {
             new RentService
             {
                 RentalType = rentalType,
                 Total = total
             }
         }
     });
 }
示例#11
0
        protected void ButtonNew_Click(object sender, EventArgs e)
        {
            RentalType        NewMat = new RentalType();
            ModelTMSContainer Temp   = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);

            NewMat.Description       = "Materiaalsoort " + Common.CurrentClientDateTime(Session).ToString();
            NewMat.LedgerBookingCode = Temp.LedgerBookingCodeSet.First <LedgerBookingCode>();

            Temp.AddToRentalTypeSet(NewMat);
            Temp.SaveChanges(SaveOptions.DetectChangesBeforeSave);

            WebUserControlRentMaterialTypeBase1.KeyID   = NewMat.Id;
            WebUserControlRentMaterialTypeBase1.Visible = true;
        }
 protected void SwitchOnCheckBoxesInAlternativeMaterialTypes()
 {
     if (DataItem != null)
     {
         RentalType rt = (DataItem as RentalType);
         foreach (RentalType CheckRt in rt.AlternativeRentalTypes)
         {
             ListItem li = CheckBoxListAlternativeMaterialTypes.Items.FindByValue(CheckRt.Id.ToString());
             if (li != null)
             {
                 li.Selected = true;
             }
         }
     }
 }
示例#13
0
        /// <summary>
        /// Creates a new rental by passing its type
        /// </summary>
        /// <param name="rentalType">rental type</param>
        /// <returns>returns a new rental</returns>
        public static Rental ByType(RentalType rentalType)
        {
            switch (rentalType)
            {
            case RentalType.ByHour:
                return(new RentalByHour());

            case RentalType.ByDay:
                return(new RentalByDay());

            case RentalType.ByWeek:
            default:
                return(new RentalByWeek());
            }
        }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // get the relation description
                ModelTMSContainer _ControlObjectContext = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);
                EntityKey         TempKey = new EntityKey("ModelTMSContainer.RentalTypeSet", "Id", Guid.Parse(Request.Params["Id"]));
                RentalType        TempObj = _ControlObjectContext.GetObjectByKey(TempKey) as RentalType;
                LabelObjectName.Text = TempObj.Description;

                // load up the combo
                Common.AddRentalItemStateList(ComboBoxItemState.Items, false);

                ButtonSearch_Click(null, null);
            }
        }
示例#15
0
        /// <summary>
        /// Checks out a bike
        /// </summary>
        /// <param name="rentalType">rental type</param>
        /// <param name="dateFrom">finish date</param>
        /// <returns>returns the price to charge</returns>
        public Guid CheckoutBike(RentalType rentalType, DateTime dateFrom)
        {
            var rental = Rental.ByType(rentalType);

            rental.Prices = this.prices;

            this.log.Debug($"Checkout bike: rental type = {rentalType}, from: {dateFrom}");

            rental.BikeId   = Guid.NewGuid();
            rental.DateFrom = dateFrom;
            this.rentals.Add(rental);

            this.log.Debug($"Returning BikeId {rental.BikeId}");

            return(rental.BikeId);
        }
        private Result ValidateSaveItem(RentalType rentalType, int total)
        {
            var result = new Result();

            if (!rentalTypeMap.ContainsKey(rentalType))
            {
                result.AddError(RentalBikeResource.InvalidRentalTypeError, nameof(RentalBikeResource.InvalidRentalTypeError));
            }

            if (total == 0)
            {
                result.AddError(RentalBikeResource.InvalidTotalItemError, nameof(RentalBikeResource.InvalidTotalItemError));
            }

            return(result);
        }
示例#17
0
        protected void ButtonNew_Click(object sender, EventArgs e)
        {
            RentalItem        NewObj = new RentalItem();
            ModelTMSContainer Temp   = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);

            Temp.AddToRentalItemSet(NewObj);

            EntityKey  TempKey = new EntityKey("ModelTMSContainer.RentalTypeSet", "Id", Guid.Parse(Request.Params["Id"]));
            RentalType TempObj = Temp.GetObjectByKey(TempKey) as RentalType;

            NewObj.RentalType = TempObj;
            NewObj.Location   = Temp.LocationSet.First <Location>();
            NewObj.AssignRentalItemNumber(Temp);
            NewObj.Description = NewObj.RentalType.Description + " " + NewObj.ItemNumber;
            Temp.SaveChanges(SaveOptions.DetectChangesBeforeSave);

            WebUserControlRentMaterialBase1.KeyID   = NewObj.Id;
            WebUserControlRentMaterialBase1.Visible = true;
        }
        protected void SaveCheckBoxesInAlternativeMaterialTypes()
        {
            RentalType rt = (DataItem as RentalType);

            // delete all elements
            foreach (RentalType CheckRt in rt.AlternativeRentalTypes.ToArray <RentalType>())
            {
                rt.AlternativeRentalTypes.Remove(CheckRt);
            }

            // add new elements
            foreach (ListItem li in CheckBoxListAlternativeMaterialTypes.Items)
            {
                if (li.Selected)
                {
                    RentalType rtNew = ControlObjectContext.GetObjectByKey(new System.Data.EntityKey("ModelTMSContainer.RentalTypeSet", "Id", new Guid(li.Value))) as RentalType;
                    rt.AlternativeRentalTypes.Add(rtNew);
                }
            }
        }
        protected void ButtonNew_Click(object sender, EventArgs e)
        {
            RentalTypeVAT     NewMat = new RentalTypeVAT();
            ModelTMSContainer Temp   = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);

            Temp.AddToRentalTypeVATSet(NewMat);
            NewMat.Description = "BTW";

            EntityKey  TempKey = new EntityKey("ModelTMSContainer.RentalTypeSet", "Id", Guid.Parse(Request.Params["Id"]));
            RentalType TempObj = Temp.GetObjectByKey(TempKey) as RentalType;

            NewMat.RentalType = TempObj;
            NewMat.IsActive   = false;

            NewMat.Location = Temp.LocationSet.First <Location>();

            Temp.SaveChanges(SaveOptions.DetectChangesBeforeSave);

            WebUserControlRentVATBase1.KeyID   = NewMat.Id;
            WebUserControlRentVATBase1.Visible = true;
        }
        public void LoadRentalTypesCheckBoxes()
        {
            RentalType rt = (DataItem as RentalType);

            CheckBoxListAlternativeMaterialTypes.Items.Clear();
            IEnumerable <RentalType> query = ControlObjectContext.RentalTypeSet.Where <RentalType>(m => m.IsActive).OrderBy(m => m.Description);

            IEnumerator <RentalType> rtEnum = query.GetEnumerator();
            bool Show = true;

            while (rtEnum.MoveNext())
            {
                if (rt != null)
                {
                    Show = rt.Id != rtEnum.Current.Id;
                }
                if (Show)
                {
                    CheckBoxListAlternativeMaterialTypes.Items.Add(new ListItem(rtEnum.Current.Description, rtEnum.Current.Id.ToString()));
                }
            }
        }
示例#21
0
文件: Login.aspx.cs 项目: Quopt/TMS
        private void CreateAndCheckDatabase()
        {
            // check if the database is there
            TMSService.CheckDatabase(Session);

            // check if the database fillings are correct
            // check if all required objects are present (the database cannot be accessed and is therefore already upgraded)
            ModelTMSContainer TempContext = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);

            // locations
            Location          location = null;
            LedgerBookingCode TempLedgerBookingCode = null;

            // ledgerbookingcodes not present? Then init the database ...
            if (TempContext.LedgerBookingCodeSet.Count() == 0)
            {
                TempLedgerBookingCode = new LedgerBookingCode();
                //LedgerBookingCode DebugCode = new LedgerBookingCode();
                TempContext.AddToLedgerBookingCodeSet(TempLedgerBookingCode);
                //TempContext.AddToLedgerBookingCodeSet(DebugCode);

                TempLedgerBookingCode.Description       = ClassTranslate.TranslateString("DBDefaults", "StandardBookingCode", "Standard booking code");
                TempLedgerBookingCode.IsActive          = true;
                TempLedgerBookingCode.IsDebugLedgerCode = false;
                TempLedgerBookingCode.LedgerCurrency    = "Eur";

                // debug code
                //DebugCode.Description = ClassTranslate.TranslateString("DBDefaults","StandardBookingDebugCode", "Standard book debugging code");
                //DebugCode.IsActive = true;
                //DebugCode.IsDebugLedgerCode = true;

                TempContext.SaveChanges();

                // location
                location = new Location();
                TempContext.AddToLocationSet(location);
                location.Description = "Standard location";
                location.DefaultWeighingTariffBookingCode = TempLedgerBookingCode;
                location.DefaultBailPriceBookingCode      = TempLedgerBookingCode;

                TempContext.SaveChanges();

                // ledgers (bank and cash MUST be present)
                Ledger BankLedger = new Ledger();
                Ledger CashLedger = new Ledger();
                //Ledger DebugLedger = new Ledger();
                //TempContext.AddToLedgerSet(DebugLedger);
                TempContext.AddToLedgerSet(BankLedger);
                TempContext.AddToLedgerSet(CashLedger);

                BankLedger.Description     = ClassTranslate.TranslateString("DBDefaults", "BankCode", "Bank");
                BankLedger.Comments        = ClassTranslate.TranslateString("DBDefaults", "BankCodeComment", "Automatisch aangemaakt. Vul aub de gegevens van uw bankrekening hier in.");
                BankLedger.LedgerCurrency  = "Eur";
                BankLedger.LedgerLevel     = 0;
                BankLedger.LedgerType      = "Bank";
                BankLedger.IsActive        = true;
                BankLedger.LimitToLocation = location;

                CashLedger.Description     = ClassTranslate.TranslateString("DBDefaults", "CashCode", "Kas");
                CashLedger.Comments        = ClassTranslate.TranslateString("DBDefaults", "CashCodeComment", "Automatisch aangemaakt. Vul hier aub de gegevens van uw kas register in.");
                CashLedger.LedgerCurrency  = "Eur";
                CashLedger.LedgerLevel     = 0;
                CashLedger.LedgerType      = "Cash";
                CashLedger.IsActive        = true;
                CashLedger.LimitToLocation = location;

                /*
                 * DebugLedger.Description = ClassTranslate.TranslateString("DBDefaults","DebugCode","Debug");
                 * DebugLedger.Comments = ClassTranslate.TranslateString("DBDefaults","DebugCodeComment","Auto created. Please fill in all details of your Cash account. This is the system debugging ledger for testing purposes only. Please do not use for business purposes.");
                 * DebugLedger.LedgerCurrency = "Eur";
                 * DebugLedger.LedgerLevel = 0;
                 * DebugLedger.LedgerType = "Bank";
                 * DebugLedger.IsActive = true;
                 * DebugLedger.LimitToLocation = null;
                 * DebugLedger.IsDebugLedger = true;
                 */
                location.BankLedger = BankLedger;
                location.CashLedger = CashLedger;
                TempContext.SaveChanges();

                // standard material units
                MaterialUnit KGUnit = new MaterialUnit();
                TempContext.AddToMaterialUnitSet(KGUnit);

                KGUnit.Description       = "KG";
                KGUnit.IsActive          = true;
                KGUnit.StockKgMultiplier = 1;
                KGUnit.StockUnit         = "KG";

                TempContext.SaveChanges();

                //KGUnit = new MaterialUnit();
                //TempContext.AddToMaterialUnitSet(KGUnit);

                //KGUnit.Description = "N/A";
                //KGUnit.IsActive = true;
                //KGUnit.StockKgMultiplier = 1;
                //KGUnit.StockUnit = "N/A";

                //TempContext.SaveChanges();

                // standard material
                // material
                Material TempMat = new Material();
                // man hours
                Material TempHours = new Material();
                // dirt / excess material
                Material TempDirt = new Material();
                TempContext.AddToMaterialSet(TempMat);
                TempContext.AddToMaterialSet(TempHours);
                TempContext.AddToMaterialSet(TempDirt);

                LedgerBookingCode MatBookingCode = TempContext.LedgerBookingCodeSet.First();

                TempMat.Description  = ClassTranslate.TranslateString("DBDefaults", "StandardMaterial", "Standaard materiaal");
                TempMat.MaterialUnit = TempContext.MaterialUnitSet.First();
                TempMat.Location     = TempContext.LocationSet.First();
                TempMat.PurchaseLedgerBookingCode = MatBookingCode;
                TempMat.SalesLedgerBookingCode    = MatBookingCode;
                TempMat.Category      = "Other";
                TempMat.VATPercentage = 21;

                TempHours.Description               = ClassTranslate.TranslateString("DBDefaults", "ManHours", "Man uren");
                TempHours.IsWorkInsteadOfMaterial   = true;
                TempHours.MaterialUnit              = TempContext.MaterialUnitSet.First();
                TempHours.PurchaseLedgerBookingCode = MatBookingCode;
                TempHours.SalesLedgerBookingCode    = MatBookingCode;
                TempHours.Location      = TempContext.LocationSet.First();
                TempHours.Category      = "Other";
                TempHours.VATPercentage = 21;

                TempDirt.Description               = ClassTranslate.TranslateString("DBDefaults", "Dirt", "Vuil");
                TempDirt.StockMayBeNegative        = true;
                TempDirt.MaterialUnit              = TempContext.MaterialUnitSet.First();
                TempDirt.PurchaseLedgerBookingCode = MatBookingCode;
                TempDirt.SalesLedgerBookingCode    = MatBookingCode;
                TempDirt.Location      = TempContext.LocationSet.First();
                TempDirt.VATPercentage = 21;
                TempDirt.Category      = "Other";

                // settings : standard dirt material, standard work material
                SystemSettingSet.SetSystemSettingValue(TempContext, "Standard.Material.Dirt", TempDirt.Id.ToString(), ClassTranslate.TranslateString("DBDefaults", "StandardMaterialForDirt", "Standaard materiaal voor vuil."));
                SystemSettingSet.SetSystemSettingValue(TempContext, "Standard.Material.Labour", TempHours.Id.ToString(), ClassTranslate.TranslateString("DBDefaults", "StandardMaterialForLabour", "Standaard materiaal voor uren."));

                // VAT percentages

                /*
                 * MaterialVAT TempVAT = new MaterialVAT();
                 * TempContext.AddToMaterialVATSet(TempVAT);
                 * TempVAT.Description = "19%";
                 * TempVAT.VATPercentage = 19;
                 * TempVAT.Material = TempMat;
                 * TempVAT.Location = TempContext.LocationSet.First();
                 *
                 * TempVAT = new MaterialVAT();
                 * TempContext.AddToMaterialVATSet(TempVAT);
                 * TempVAT.Description = "19%";
                 * TempVAT.VATPercentage = 19;
                 * TempVAT.Material = TempHours;
                 * TempVAT.Location = TempContext.LocationSet.First();
                 *
                 * TempVAT = new MaterialVAT();
                 * TempContext.AddToMaterialVATSet(TempVAT);
                 * TempVAT.Description = "19%";
                 * TempVAT.VATPercentage = 19;
                 * TempVAT.Material = TempDirt;
                 * TempVAT.Location = TempContext.LocationSet.First();
                 *
                 * TempContext.SaveChanges();
                 */

                // standard rental type equipment
                RentalType    TempRental    = new RentalType();
                RentalTypeVAT TempRentalVAT = new RentalTypeVAT();

                TempContext.AddToRentalTypeSet(TempRental);
                TempContext.AddToRentalTypeVATSet(TempRentalVAT);

                TempRental.Description       = ClassTranslate.TranslateString("DBDefaults", "AnyRental", "Elke verhuur");
                TempRental.LedgerBookingCode = TempContext.LedgerBookingCodeSet.First();
                TempRentalVAT.VATPercentage  = 21;
                TempRentalVAT.Description    = "21%";
                TempRentalVAT.RentalType     = TempRental;
                TempRentalVAT.Location       = TempContext.LocationSet.First();

                TempContext.SaveChanges();

                // standard truck
                Truck TempTruck = new Truck();
                TempContext.AddToTruckSet(TempTruck);

                TempTruck.Description          = ClassTranslate.TranslateString("DBDefaults", "Any truck", "Een vrachtwagen");
                TempTruck.CurrentTruckLocation = TempContext.LocationSet.First();
                TempTruck.HomeTruckLocation    = TempContext.LocationSet.First();

                TempContext.SaveChanges();

                // standard security role
                SecurityRole SecRole = new SecurityRole();
                TempContext.AddToSecurityRoleSet(SecRole);

                SecRole.Description        = ClassTranslate.TranslateString("DBDefaults", "UnlimitedAccess", "Onbeperkte toegang");
                SecRole.HasUnlimitedAccess = true;

                TempContext.SaveChanges();

                // standard relations (general purchase, stock correction and general sales account)
                Relation Sales           = new Relation();
                Relation Purchase        = new Relation();
                Relation StockCorrection = new Relation();
                TempContext.AddToRelationSet(Sales);
                TempContext.AddToRelationSet(Purchase);
                TempContext.AddToRelationSet(StockCorrection);

                Sales.Description       = ClassTranslate.TranslateString("DBDefaults", "DirectSales", "Directe verkoop");
                Sales.CustomerType      = "Debtor";
                Sales.IsSystemUser      = true;
                Sales.PreferredLocation = location;

                Purchase.Description       = ClassTranslate.TranslateString("DBDefaults", "DirectPurchase", "Directe inkoop");
                Purchase.CustomerType      = "Creditor";
                Purchase.IsSystemUser      = true;
                Purchase.PreferredLocation = location;

                StockCorrection.Description       = ClassTranslate.TranslateString("DBDefaults", "StockCorrection", "Voorraad correctie");
                StockCorrection.CustomerType      = "Both";
                StockCorrection.IsSystemUser      = true;
                StockCorrection.PreferredLocation = location;

                // settings: standard sales, standard purchase, standard stock correction customer
                SystemSettingSet.SetSystemSettingValue(TempContext, "Standard.Relation.Purchase", Purchase.Id.ToString(), ClassTranslate.TranslateString("DBDefaults", "StandardPurchaseRelationUnnamed", "Standard relatie voor onbekende inkopers."));
                SystemSettingSet.SetSystemSettingValue(TempContext, "Standard.Relation.Sales", Sales.Id.ToString(), ClassTranslate.TranslateString("DBDefaults", "StandardSalesRelationUnnamed", "Standard relatie voor onbekende kopers."));
                SystemSettingSet.SetSystemSettingValue(TempContext, "Standard.Relation.StockCorrection", StockCorrection.Id.ToString(), ClassTranslate.TranslateString("DBDefaults", "StandardStockCorrectionRelation", "Standard relatie voor voorraad correcties."));

                TempContext.SaveChanges();
            }


            // standard user if there are none
            if (TempContext.StaffMemberSet.Count() == 0)
            {
                StaffMember TempMem = new StaffMember();
                TempContext.AddToStaffMemberSet(TempMem);

                TempMem.Description   = ClassTranslate.TranslateString("DBDefaults", "DefaultUser", "Standaard aanwezig gebruiker");
                TempMem.HasVMSAccount = true;
                TempMem.AccountName   = "Admin";
                TempMem.Password      = "******";
                TempMem.HomeLocation  = TempContext.LocationSet.First();
                TempMem.SecurityRole.Add(TempContext.SecurityRoleSet.First());

                TempContext.SaveChanges();
            }
        }
 public IApplyFilter RentalType(RentalType numberOfBedrooms)
 {
     throw new NotImplementedException();
 }
示例#23
0
        public Form_CarBack(int OrderID)
        {
            InitializeComponent();
            OrderSummery_Client = (OrderSummeryClient)ClientFactory.GetClient(ClientType.Type.OrderSummery);
            Order_Temp          = OrderSummery_Client.SelectOrderSummery_OrderID(OrderID);
            TimeSpan TS_Start = new TimeSpan(Order_Temp.Order_Start_Time.Ticks);
            TimeSpan TS_End   = new TimeSpan(Order_Temp.Checkout_Time.Ticks);
            TimeSpan TS       = TS_Start.Subtract(TS_End);
            decimal  RentalPrice;
            decimal  CatchPrice;
            decimal  OverPrice;
            decimal  RentalType;

            #region 设定4差别项

            if (Order_Temp.RentalType_Name == "自驾")
            {
                RentalType = 0;
                OverPrice  = Order_Temp.Version_Price_Over;
            }
            else
            {
                RentalType = Order_Temp.Version_Price_Riding;
                OverPrice  = Order_Temp.Version_Price_Over_Riding;
            }
            if (Order_Temp.Client_RoleName == "普通会员")
            {
                RentalPrice = Order_Temp.Version_Price_Normal_Rental;
                if (Order_Temp.Order_IsCatch)
                {
                    CatchPrice = Order_Temp.Version_Price_Normal_Catch;
                }
                else
                {
                    CatchPrice = 0;
                }
            }
            else
            {
                RentalPrice = Order_Temp.Version_Price_Member_Rental;
                if (Order_Temp.Order_IsCatch)
                {
                    CatchPrice = Order_Temp.Version_Price_Member_Catch;
                }
                else
                {
                    CatchPrice = 0;
                }
            }
            #endregion
            //租借车型
            Label_Version.Text = Order_Temp.Version_Name;
            Label_Type.Text    = Order_Temp.Type_Name;
            Label_Brand.Text   = Order_Temp.Brand_Name;
            this.OrderID       = OrderID;

            //基本租金
            Label_Count1.Text      = Order_Temp.Order_Count.ToString();
            Label_Day1.Text        = TS.Duration().Days.ToString();
            Label_PriceRental.Text = RentalPrice.ToString();
            decimal Total_Rental = RentalPrice * TS.Duration().Days *Order_Temp.Order_Count;
            Label_TotalRental.Text = Total_Rental.ToString();

            //接送费用
            Label_Count2.Text     = Order_Temp.Order_Count.ToString();
            Label_PriceCatch.Text = CatchPrice.ToString();
            decimal Total_Catch = Order_Temp.Order_Count * CatchPrice;
            Label_TotalCatch.Text = Total_Catch.ToString();

            //行驶费用
            Label_BaseKM.Text    = Order_Temp.Version_BaseKM.ToString();
            Label_OverKM.Text    = Order_Temp.Checkout_KM.ToString();
            Label_PriceOver.Text = OverPrice.ToString();
            decimal Total_Over = Order_Temp.Checkout_KM * OverPrice;
            Label_TotalOver.Text = Total_Over.ToString();

            //代驾费用
            Label_Count3.Text      = Order_Temp.Order_Count.ToString();
            Label_Day2.Text        = TS.Duration().Days.ToString();
            Label_PriceRiding.Text = RentalType.ToString();
            decimal Total_RentalType = Order_Temp.Order_Count * TS.Duration().Days *RentalType;
            Label_TotalRentalType.Text = Total_RentalType.ToString();

            //活动优惠
            Label_Count5.Text      = Order_Temp.Order_Count.ToString();
            Label_ActionPrice.Text = Order_Temp.Action_Price.ToString();
            decimal Total_Action = Order_Temp.Order_Count * Order_Temp.Action_Price;
            Label_TotalAction.Text = Total_Action.ToString();

            //押金退还
            Label_Count4.Text       = Order_Temp.Order_Count.ToString();
            Label_PriceDeposit.Text = Order_Temp.Version_Price_Deposit.ToString();
            decimal Total_Deposit = Order_Temp.Order_Count * Order_Temp.Version_Price_Deposit;
            Label_TotalDeposit.Text = Total_Deposit.ToString();


            Label_Total.Text = (Total_Rental + Total_Catch + Total_Over + Total_RentalType + Total_Action - Total_Deposit).ToString();
        }