Exemple #1
0
 public Sale(Fuel fuel, double price, double cost, double quantity)
 {
     this.Fuel = fuel;
     this.Price = price;
     this.Cost = cost;
     this.Quantity = quantity;
 }
Exemple #2
0
 public static Cell<string> PriceLcd(
     Cell<IMaybe<Fuel>> fillActive,
     Cell<double> fillPrice,
     Fuel fuel,
     Inputs inputs)
 {
     Cell<double> idlePrice;
     switch (fuel)
     {
         case Fuel.One:
             idlePrice = inputs.Price1;
             break;
         case Fuel.Two:
             idlePrice = inputs.Price2;
             break;
         case Fuel.Three:
             idlePrice = inputs.Price3;
             break;
         default:
             idlePrice = null;
             break;
     }
     return fillActive.Lift(fillPrice, idlePrice,
         (fuelSelectedMaybe, fillPriceLocal, idlePriceLocal) =>
             fuelSelectedMaybe.Match(f => f == fuel ? Formatters.FormatPrice(fillPriceLocal, 4) : string.Empty, () => Formatters.FormatPrice(idlePriceLocal, 4)));
 }
 public bool LoadFuel(Fuel fuel)
 {
   if (!(fuel is Gasoline))
     return false;
   tank = fuel as Gasoline;
   return true;
 }
 public bool LoadFuel(Fuel fuel)
 {
   if (!(fuel is Diesel))
     return false;
   tank = fuel as Diesel;
   return true;
 }
Exemple #5
0
 public void LoadFuel(Fuel f)
 {
     if (f is Gasoline)
     {
         fuelAmount = 20;
     }
 }
Exemple #6
0
 public Car(Manufacturer manufacturer, String name, double engineCapacity, Fuel fuel, int width, int height, int length)
 {
     this.manufacturer = manufacturer;
     this.name = name;
     this.engineCapacity = engineCapacity;
     this.fuel = fuel;
     this.dimension = new Dimension(width, height, length);
 }
Exemple #7
0
 private static Event<End> WhenSetDown(Event<UpDown> eNozzle,
             Fuel nozzleFuel,
             Behavior<Optional<Fuel>> fillActive) 
 {
     return Event<End>.FilterOptional(
         eNozzle.Snapshot(fillActive,
             (u,f) => u == UpDown.DOWN &&
                      f.Equals(Optional<Fuel>.Of(nozzleFuel))
                                    ? Optional<End>.Of(End.END)
                                    : Optional<End>.Empty()));
 }
Exemple #8
0
	// Use this for initialization
	void Start () {
		
		player = GameObject.Find ("First Person Controller");
		playerBounds = GameObject.Find ("TileBounds");
		control = GameObject.Find ("GameMaster");
		fuel = control.GetComponent<Fuel> ();
		tileData = control.GetComponent<GameStats>().tileData;
		trashList = new List<GameObject>(GameObject.FindGameObjectsWithTag("Trash"));
		reedList = new List<GameObject>(GameObject.FindGameObjectsWithTag("Invasive"));
		mangroveList = new List<GameObject>(GameObject.FindGameObjectsWithTag("Mangrove"));
//		reedOption = GameObject.Find (
//		mapCamera = Camera.Find ("MapCamera");
		iTween.ColorTo(gameObject, iTween.Hash(
			"color", tileColor,
			"time", .1f

		));
		tilePosition = this.transform.position;
		TileReference ();

	}
 public static Behavior<String> PriceLCD(
         Behavior<Optional<Fuel>> fillActive,
         Behavior<Double> fillPrice,
         Fuel fuel,
         Inputs inputs) {
     Behavior<Double> idlePrice;
     switch (fuel) {
         case Fuel.ONE:   idlePrice = inputs.Price1; break;
         case Fuel.TWO:   idlePrice = inputs.Price2; break;
         case Fuel.THREE: idlePrice = inputs.Price3; break;
         default:    idlePrice = null; break;
     }
     return Behavior<string>.Lift((oFuelSelected, fillPrice_, idlePrice_) =>
         oFuelSelected.IsPresent
             ? oFuelSelected.Get() == fuel
                                   ? Formatters.FormatPrice(fillPrice_)
                                   : ""
             : Formatters.FormatPrice(idlePrice_),
         fillActive,
         fillPrice,
         idlePrice);
 }
Exemple #10
0
 public Sale(Fuel fuel, double price, double cost, double quantity) {
     Fuel = fuel;
     Price = price;
     Cost = cost;
     Quantity = quantity;
 }
Exemple #11
0
        public Guid SaveFuelInfo(Fuel fuel)
        {
            var adaptedFuel = new FuelHelper().AdaptFuel(fuel);

            return(_fuelRepository.SaveFuel(adaptedFuel));
        }
Exemple #12
0
 void Awake()
 {
     fuel      = gameObject.GetComponent <Fuel> ();
     rigidBody = gameObject.GetComponent <Rigidbody> ();
 }
Exemple #13
0
 public IResult Delete(Fuel fuel)
 {
     _fuelDal.Delete(fuel);
     return(new SuccessResult());
 }
    // TODO - variables for sprites

    private void Start()
    {
        playerFuel = FindObjectOfType <Fuel>();
    }
Exemple #15
0
 private static void AddToBook(Fuel fuel)
 {
     _book.Add(fuel.Name, fuel);
 }
Exemple #16
0
 public void AddFuelInList(Fuel fuel) => listOfFuel.Add(fuel);
 public IActionResult Index(Fuel fuel)
 {
     return(RedirectToAction("Result", fuel));
 }
        /// <summary>
        /// Add car to List<Car>, loaded  _lastId increments and assign to new car
        /// </summary>
        /// <param name="company"></param>
        /// <param name="model"></param>
        /// <param name="year"></param>
        /// <param name="kms"></param>
        /// <param name="price"></param>
        /// <param name="fuel"></param>
        /// <param name="city"></param>
        /// <param name="doors"></param>
        /// <param name="crashed"></param>
        public static void CarAdd(string company, string model, int year, int kms, int price, Fuel fuel, string city, int doors, bool crashed)
        {
            // Increment _last ID before creating car, so its fresh new ID
            _lastID++;
            // Create new car
            Car c = new Car(_lastID, company, model, year, kms, price, fuel, city, doors, crashed);

            // Add new car to List<Car>
            _carDetails.Add(c);
        }
Exemple #19
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        FuelService fuelService = new FuelService();
        Fuel        fuel        = new Fuel();
        int         FuelId      = 0;

        if (hdnEditId.Value != "")
        {
            try
            {
                FuelId = Convert.ToInt32(hdnEditId.Value.Trim());
            }
            catch
            { }
        }
        fuel.FuelName = txtTitle.Text.Trim();
        if (ddlGroupFuel.SelectedIndex > 0)
        {
            fuel.GroupFuelId = Convert.ToInt32(ddlGroupFuel.SelectedValue);
        }
        if (ddlMeasurement.SelectedIndex > 0)
        {
            fuel.MeasurementId = Convert.ToInt32(ddlMeasurement.SelectedValue);
        }
        if (FuelId > 0)
        {
            fuel.Id = FuelId;
            if (fuelService.Update(fuel) != null)
            {
                BindData();
                hdnEditId.Value = "0";
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showform", "updateFuel();", true);
            }
        }
        else
        {
            int id = fuelService.Insert(fuel);
            if (id > 0)
            {
                MeasurementFuelService measurementFuelService = new MeasurementFuelService();
                MeasurementFuel        objMeasurementFuel     = new MeasurementFuel();
                if (txtNoCO2_S.Text != "")
                {
                    objMeasurementFuel.NoCO2 = Convert.ToDecimal(txtNoCO2_S.Text.Trim());
                }
                if (txtFromTOE_S.Text != "" && txtToTOE_S.Text.Trim() != "" && ddlMeasurement.SelectedValue != "" && id > 0)
                {
                    if (ddlMeasurement.SelectedValue != "")
                    {
                        objMeasurementFuel.MeasurementId = Convert.ToInt32(ddlMeasurement.SelectedValue);
                    }
                    objMeasurementFuel.FuelId = fuel.Id;
                    decimal dfrom = 0;
                    decimal dto   = 0;
                    try
                    {
                        dfrom = Convert.ToDecimal(txtFromTOE_S.Text);
                    }
                    catch
                    {
                    }
                    if (txtToTOE_S.Text != "" && txtToTOE_S.Text.Trim() != "")
                    {
                        try
                        {
                            dto = Convert.ToDecimal(txtToTOE_S.Text.Trim());
                        }
                        catch
                        {
                        }
                    }
                    if (dfrom > 0)
                    {
                        objMeasurementFuel.From_TOE = dfrom;
                        objMeasurementFuel.TOE      = dfrom;
                    }
                    if (dto >= 0 && dto > dfrom)
                    {
                        objMeasurementFuel.To_TOE = dto;
                    }
                }
                measurementFuelService.UpdateTOE(objMeasurementFuel.FuelId, objMeasurementFuel.MeasurementId, objMeasurementFuel.From_TOE, objMeasurementFuel.To_TOE);
                BindData();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showform", "addFuel();", true);
            }
        }
    }
Exemple #20
0
        public Fuel GetFuel(int carId, int fuelId)
        {
            Fuel fuel = _context.Fuels.FirstOrDefault(e => e.FuelId == fuelId);

            return(fuel);
        }
Exemple #21
0
    void Start()
    {
        _stasisScript = GetComponent <Stasis>();
        _fuelScript   = GetComponent <Fuel>();
        _rigidbody    = GetComponent <Rigidbody>();

        _wheels = new List <Transform>();

        foreach (Transform t in transform)
        {
            if (t.name == "Thruster")
            {
                _thruster = t.GetComponent <ParticleSystem>();
            }
            else if (t.name == "Exhaust")
            {
                _exhaust = t.GetComponent <ParticleSystem>();
            }
            if (t.name.Contains("Left"))
            {
                _wheels.Add(t);
            }
            if (t.name.Contains("Right"))
            {
                _wheels.Add(t);
            }
        }
        Vector3 wheelSize = _wheels[0].localScale;

        _wheelDefaultSize = wheelSize;
        _wheelClimbSize   = new Vector3(wheelSize.x, 0.7f, wheelSize.z);

        TurnOffFireEffects();

        _carState   = CarState.Driving;
        _driveState = DriveState.Park;

        if (START_POSITIONS == null)
        {
            START_POSITIONS = new List <Vector3>();
            START_POSITIONS.Add(transform.position);
        }
        _startPosition = transform.position;
        _startRotation = transform.rotation.eulerAngles;

        _currentStartPosition = -1;

        _teleport = false;

        _oldWallNormal = Vector3.zero;

        cameraRig.position    = transform.position;
        _freeLookCameraScript = cameraRig.GetComponent <FreeLookCam>();
        _mouseSpeed           = _freeLookCameraScript.m_MoveSpeed;
        _cameraTurnSpeed      = _freeLookCameraScript.m_TurnSpeed;

        _flash = GameObject.Find("Flash").GetComponent <RawImage>();

        _otherFreeLookCamerScript = cameraRig.GetComponent <ProtectCameraFromWallClip>();
        _camDistance = _otherFreeLookCamerScript.closestDistance;

        _canClimb = true;
        _drifting = false;
        _jetting  = false;
        _turbo    = false;

        _oldForward = Vector3.zero;

        _helpPad      = GameObject.Find("HelpControls");
        _helpKeyboard = GameObject.Find("HelpKeyboard");
        _helpRunes    = GameObject.Find("HelpRunes");

        if (!SHOW_CONTROLS)
        {
            _helpPad.SetActive(false);
            _helpKeyboard.SetActive(false);
        }
        else
        {
            if (StartMenu.USE_KEYBOARD)
            {
                _helpPad.SetActive(false);
            }
            else
            {
                _helpKeyboard.SetActive(false);
            }
        }
        _helpRunes.SetActive(false);

        _quitTick      = 0;
        _quitTime      = 2;
        _climbIdleTick = 0;
        _climbIdleTime = 3;
    }
 public void SetFuel(Fuel fuel)
 {
     _car.Fuel = fuel;
 }
 /// <summary>
 /// Метод заправки топливом
 /// </summary>
 /// <param name="fuel"></param>
 /// <returns></returns>
 public abstract void Refuel(Fuel fuel);
        public static bool AddCar(Company company, int id, string make, string model, string registration, Fuel fuelType, DateTime lastService, string comments)
        {
            //Check for duplicate ID
            if (CarIDExists(company, id))
            {
                return(false);
            }

            //Add to list and update listbox
            company.Cars.Add(new Car(id, make, model, registration, fuelType, lastService, comments));

            //this.BindCarsToList(company.Cars);

            return(true);
        }
Exemple #25
0
 public void LoadFuel(Fuel f)
 {
     if(f is Diesel)
     {
         fuelAmount = 50;
     }
 }
 public IActionResult Result(Fuel fuel)
 {
     return(View(fuel));
 }
Exemple #27
0
        public async Task <GeneratingStation> LoadSingleAsync(WRLDCWarehouseDbContext _context, ILogger _log, GeneratingStationForeign genStationForeign, EntityWriteOption opt)
        {
            // check if entity already exists
            GeneratingStation existingGenStation = await _context.GeneratingStations.SingleOrDefaultAsync(ss => ss.WebUatId == genStationForeign.WebUatId);

            // check if we should not modify existing entities
            if (opt == EntityWriteOption.DontReplace && existingGenStation != null)
            {
                return(existingGenStation);
            }

            // find the GeneratorClassification of the substation via the GenClassification WebUatId
            int genClassificationWebUatId             = genStationForeign.GenClassificationWebUatId;
            GeneratorClassification genClassification = await _context.GeneratorClassifications.SingleOrDefaultAsync(gc => gc.WebUatId == genClassificationWebUatId);

            // if GeneratorClassification doesnot exist, skip the import. Ideally, there should not be such case
            if (genClassification == null)
            {
                _log.LogCritical($"Could not find GeneratorClassification with WebUatId {genClassificationWebUatId} in warehouse while creating Generating Station with WebUat Id {genStationForeign.WebUatId} and name {genStationForeign.Name}");
                return(null);
            }

            // find the Generation Type of the substation via the Voltage WebUatId
            int            genTypeWebUatId = genStationForeign.GenerationTypeWebUatId;
            GenerationType genType         = await _context.GenerationTypes.SingleOrDefaultAsync(gt => gt.WebUatId == genTypeWebUatId);

            // if GenerationType doesnot exist, skip the import. Ideally, there should not be such case
            if (genType == null)
            {
                _log.LogCritical($"Could not find GenerationType with WebUatId {genTypeWebUatId} in warehouse while creating Generating Station with WebUat Id {genStationForeign.WebUatId} and name {genStationForeign.Name}");
                return(null);
            }

            // find the State of the substation via the State WebUatId
            int   stateWebUatId = genStationForeign.StateWebUatId;
            State state         = await _context.States.SingleOrDefaultAsync(s => s.WebUatId == stateWebUatId);

            // if state doesnot exist, skip the import. Ideally, there should not be such case
            if (state == null)
            {
                _log.LogCritical($"Could not find State with WebUatId {stateWebUatId} in warehouse while creating Generating Station with WebUat Id {genStationForeign.WebUatId} and name {genStationForeign.Name}");
                return(null);
            }

            // find the fuel of the substation via the State WebUatId
            int  fuelWebUatId = genStationForeign.FuelWebUatId;
            Fuel fuel         = await _context.Fuels.SingleOrDefaultAsync(f => f.WebUatId == fuelWebUatId);

            // if fuel doesnot exist, skip the import. Ideally, there should not be such case
            if (fuel == null)
            {
                _log.LogCritical($"Could not find Fuel with WebUatId {fuelWebUatId} in warehouse while creating Generating Station with WebUat Id {genStationForeign.WebUatId} and name {genStationForeign.Name}");
                // uncomment this after vendor complies to non null fuel types
                // return null;
            }

            // check if we have to replace the entity completely
            if (opt == EntityWriteOption.Replace && existingGenStation != null)
            {
                _context.GeneratingStations.Remove(existingGenStation);
            }

            // if entity is not present, then insert or check if we have to replace the entity completely
            if (existingGenStation == null || (opt == EntityWriteOption.Replace && existingGenStation != null))
            {
                GeneratingStation genStation = new GeneratingStation();
                genStation.Name                      = genStationForeign.Name;
                genStation.GenerationTypeId          = genType.GenerationTypeId;
                genStation.GeneratorClassificationId = genClassification.GeneratorClassificationId;
                genStation.StateId                   = state.StateId;
                if (fuel != null)
                {
                    genStation.FuelId = fuel.FuelId;
                }
                genStation.WebUatId = genStationForeign.WebUatId;

                _context.GeneratingStations.Add(genStation);
                await _context.SaveChangesAsync();

                return(genStation);
            }

            // check if we have to modify the entity
            if (opt == EntityWriteOption.Modify && existingGenStation != null)
            {
                existingGenStation.Name                      = genStationForeign.Name;
                existingGenStation.GenerationTypeId          = genType.GenerationTypeId;
                existingGenStation.GeneratorClassificationId = genClassification.GeneratorClassificationId;
                existingGenStation.StateId                   = state.StateId;
                if (fuel != null)
                {
                    existingGenStation.FuelId = fuel.FuelId;
                }
                await _context.SaveChangesAsync();

                return(existingGenStation);
            }
            return(null);
        }
Exemple #28
0
 public override void UpdateViewItem(IdentifiedRegistry identifiedRegistry)
 {
     _fuel = identifiedRegistry as Fuel;
     UpdateView();
 }
Exemple #29
0
 public Audi(
     double price, string model, int horsePower, string MotorName, int NumCyl, Fuel _Fuel,
     double fuelUsage, int year, int fuelTank,
     Transmisson transmisson, Bitmap picture)
     : base(
         price, model, horsePower, fuelUsage, year,
         fuelTank, transmisson, picture
         )
 {
     base._Motor = new Motor(MotorName, NumCyl, _Fuel);
 }
Exemple #30
0
        public void Start()
        {
            m_Garage = new Garage();
            while (true)
            {
                int userOp = getOp();
                Console.Clear();
                switch (userOp)
                {
                case 1:
                    InsertUI.Insert(ref m_Garage);
                    break;

                case 2:
                    displayVehicles();
                    break;

                case 3:
                    changeVehicleStatus();
                    break;

                case 4:
                    inflateWheelsInVehicle();
                    break;

                case 5:
                    Vehicle vehicleFuel;
                    bool    checkFuel = EnergyUI.checkIfValidVehicleLicenseNumAndEnergy("Fuel", out vehicleFuel, ref m_Garage);
                    if (checkFuel)
                    {
                        Fuel   fuel           = vehicleFuel.Energy as Fuel;
                        string fuelTypeToAdd  = EnergyUI.askForFuelTypeToAdd();
                        float  amountToRefuel = EnergyUI.askForAmount("Fuel");
                        try
                        {
                            fuel.Refuel(amountToRefuel, fuelTypeToAdd);
                        }
                        catch (ArgumentException)
                        {
                            System.Console.WriteLine(string.Format(@"Wrong type of fuel! This vehicle has fuel of type {0}.
", vehicleFuel.FuelType));
                        }
                        catch (ValueOutOfRangeException)
                        {
                            System.Console.WriteLine(@"You added too much fuel or a negative amount of fuel!
");
                        }
                    }
                    break;

                case 6:
                    Vehicle vehicleElect;
                    bool    checkElect = EnergyUI.checkIfValidVehicleLicenseNumAndEnergy("Electricity", out vehicleElect, ref m_Garage);
                    if (checkElect)
                    {
                        Electricity electricity      = vehicleElect.Energy as Electricity;
                        float       amountToRecharge = EnergyUI.askForAmount("Electricity");
                        electricity.Recharge(amountToRecharge);
                    }
                    break;

                case 7:
                    string licenseNum;
                    bool   check = getLicenseNumFromUser(out licenseNum, ref m_Garage);
                    if (check)
                    {
                        VehicleInGarage vehicleInGarage = m_Garage.GetVehicleInGarage(licenseNum);
                        System.Console.WriteLine(vehicleInGarage);
                    }
                    break;
                }
            }
        }
Exemple #31
0
 public IResult Add(Fuel fuel)
 {
     _fuelDal.Add(fuel);
     return(new SuccessResult());
 }
Exemple #32
0
 public Motor(string motorName, int numCyl, Fuel fuel)
 {
     MotorName = motorName;
     NumCyl    = numCyl;
     Fuel      = fuel;
 }
Exemple #33
0
 public IResult Update(Fuel fuel)
 {
     _fuelDal.Update(fuel);
     return(new SuccessResult());
 }
Exemple #34
0
 public override string ToString()
 {
     return(CarName + ";" + Fuel.ToString() + ";" + Gearbox.ToString());
 }
Exemple #35
0
 private static Event<Fuel> WhenLifted(Event<UpDown> eNozzle,
                                       Fuel nozzleFuel) 
 {
     return eNozzle.Filter(u => u == UpDown.UP)
                   .Map(u => nozzleFuel);
 }
Exemple #36
0
 public void LoadFuel(Fuel f)
 {
     if (f is Dilithium)
     {
         fuelAmount = 5000;
     }
 }
	// Generates references to each type of powerup object
	public static void GenerateAllPowerups () {
		if (PowerUps == null) {
			//initializes the array
			PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];
			
			//the array of all possible PowerUps the spawned PowerUp could be
			PowerUps[0] = new LaneConversion(durationLaneConversion);
			PowerUps[1] = new SlowFall(fallSpeedModifierSlowFall,timeBonusSlowFall,durationSlowFall);
			PowerUps[2] = new Fuel(timeBonusAddTime) ;
			PowerUps[3] = new Multiply(multiplierElementMultiply);
			PowerUps[4] = new BucketShield(bucketShieldHitPoints);
			PowerUps[5] = new TapToCollect(durationTapToCollect);
			PowerUps[6] = new Invincible(durationInvincible, spawnRateModifierInvincible);
			PowerUps[7] = new TotalConversion(durationTotalConversion);
			PowerUps[8] = new CollectAll();
		}
	}
        public Fuel GetFuelPercentage(int Id)
        {
            Fuel fuel = new Fuel();

            if (Id == 1)
            {
                fuel = new Fuel
                {
                    VehicleId = 1,
                    Level     = 100,
                    Type      = "Gas"
                };
            }
            if (Id == 2)
            {
                fuel = new Fuel
                {
                    VehicleId = 2,
                    Level     = 75,
                    Type      = "Gas"
                };
            }
            if (Id == 3)
            {
                fuel = new Fuel
                {
                    VehicleId = 3,
                    Level     = 50,
                    Type      = "Gas"
                };
            }
            if (Id == 4)
            {
                fuel = new Fuel
                {
                    VehicleId = 4,
                    Level     = 25,
                    Type      = "Gas"
                };
            }
            if (Id == 5)
            {
                fuel = new Fuel
                {
                    VehicleId = 5,
                    Level     = 10,
                    Type      = "Gas"
                };
            }
            if (Id == 6)
            {
                fuel = new Fuel
                {
                    VehicleId = 6,
                    Level     = 5,
                    Type      = "Gas"
                };
            }

            return(fuel);
        }
        public static bool EditCar(Company company, Car car, int id, string make, string model, string registration, Fuel fuelType, DateTime lastService, string comments)
        {
            //Check for duplicate ID
            if (CarIDExists(company, car.ID, id))
            {
                return(false);
            }

            //Update company and refresh listbox
            car.UpdateInfo(id, make, model, registration, fuelType, lastService, comments);
            return(true);
        }
Exemple #40
0
 private static Stream<Fuel> WhenLifted(Stream<UpDown> sNozzle, Fuel nozzleFuel)
 {
     return sNozzle.Filter(u => u == UpDown.Up).Map(u => nozzleFuel);
 }
 public bool LoadFuel(Fuel fuel)
 {
   if (!(fuel is Dilithium))
     return false;
   tank = fuel as Dilithium;
   return true;
 }
Exemple #42
0
 public Car(T profile, Fuel fuel)
 {
     Profile  = profile;
     FuelType = fuel;
     Console.WriteLine("Super Car Created");
 }
Exemple #43
0
    // Use this for initialization
    void Start()
    {
        //make PowerUpScreen active since Content is referenced
        powerScreen = GameObject.Find("Canvas/PowerUpScreen");
        powerScreen.SetActive(true);
        contentList = GameObject.Find("Canvas/PowerUpScreen/ScrollView/Content");
        powerScreen.SetActive(false);

        buttonScale       = new Vector3(buttonSize, buttonSize, buttonSize);
        upgradeBarImages  = new Sprite[] { upgradeBar0, upgradeBar1, upgradeBar2, upgradeBar3 };
        upgradeCardImages = new Sprite[] { upgradeCard0, upgradeCard1, upgradeCard2, upgradeCard3 };

        PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];

        //the array of all possible PowerUps the spawned PowerUp could be
        PowerUps[0] = new LaneConversion(DEFAULT_NUMBER);
        PowerUps[1] = new SlowFall(DEFAULT_NUMBER, DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[2] = new Fuel(DEFAULT_NUMBER);
        PowerUps[3] = new Multiply(DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[4] = new BucketShield(DEFAULT_NUMBER);
        PowerUps[5] = new TapToCollect(DEFAULT_NUMBER);
        PowerUps[6] = new Invincible(DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[7] = new TotalConversion(DEFAULT_NUMBER);
        PowerUps[8] = new CollectAll();

        powerDescriptions = new string[TOTAL_BASE_POWERUPS * UPGRADE_LEVELS] {
            "Tap or drag this ability into a specific lane to convert the elements contained to the lane’s elemental type.",                                                                //power 1, level 1
            "Tap or drag this ability into a specific lane to convert the elements contained, and an adjacent lane, to each lane’s elemental type.",                                        //power 1, level 2
            "Tap or drag this ability to convert the elements contained within each lane to the lane’s elemental type.",                                                                    //power 1, level 3
            "Tap or drag this ability into a specific lane to slow down the fall of elements contained.",                                                                                   //power 2, level 1
            "Tap or drag this ability into a specific lane to significantly slow down the fall of elements contained.",                                                                     //power 2, level 2
            "Tap or drag this ability to significantly slow down the fall all elements.",                                                                                                   //power 2, level 3
            "Your fuel does not deplete for a certain duration.",                                                                                                                           //power 3, level 1
            "You gain additional fuel and it does not deplete for a certain duration.",                                                                                                     //power 3, level 2
            "You gain a significant amount of additional fuel and it does not deplete for a certain duration.",                                                                             //power 3, level 3
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type.",                                        //power 4, level 1
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type, and an adjacent lane’s elemental type.", //power 4, level 2
            "Tap or drag this ability to receive a score multiplier for elements collected of all elemental types.",                                                                        //power 4, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 2 incorrect elements that fall into it.",                                         //power 5, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 4 incorrect elements that fall into it.",                                         //power 5, level 2
            "Tap or drag this ability to give all lanes no miss penalty for the next 4 incorrect elements that fall into them, for each lane.",                                             //power 5, level 3
            "Simply tap elements to automatically collect them.",                                                                                                                           //power 6, level 1
            "Simply tap elements to automatically collect them.",                                                                                                                           //power 6, level 2
            "Simply tap elements to automatically collect them.",                                                                                                                           //power 6, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a small amount of time.",                                                                  //power 7, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a decent amount of time.",                                                                 //power 7, level 2
            "Tap or drag this ability to give all lanes no miss penalty for a decent amount of time.",                                                                                      //power 7, level 3
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a small amount of time.",                                       //power 8, level 1
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a decent amount of time.",                                      //power 8, level 2
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type and gain invincibility for a decent amount of time.",               //power 8, level 3
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane.",                                                                            //power 9, level 1
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane and an adjacent lane.",                                                       //power 9, level 2
            "Tap or drag this ability to automatically collect all elements in all lanes."
        };                                                                                                                                                                                  //power 9, level 3

        bonusTexts = new string[TOTAL_BASE_POWERUPS * UPGRADE_LEVELS] {
            "1 Lane",                        //power 1, level 1
            "2 Lanes",                       //power 1, level 2
            "All Lanes",                     //power 1, level 3
            "Slow",                          //power 2, level 1
            "Slower",                        //power 2, level 2
            "Slower & All Lanes",            //power 2, level 3
            "Fuel",                          //power 3, level 1
            "Fuel+",                         //power 3, level 2
            "Fuel++",                        //power 3, level 3
            "1 Element",                     //power 4, level 1
            "2 Elements",                    //power 4, level 2
            "4 Element",                     //power 4, level 3
            "2 Saves & 1 Lane",              //power 5, level 1
            "4 Saves & 1 Lane",              //power 5, level 2
            "4 Saves & All Lanes",           //power 5, level 3
            "Tap Time",                      //power 6, level 1
            "Tap Time+",                     //power 6, level 2
            "Tap Time++",                    //power 6, level 3
            "Invincible Time & 1 Lane",      //power 7, level 1
            "Invincible Time+ & 1 Lane",     //power 7, level 2
            "Invincible Time+ & All Lanes",  //power 7, level 3
            "Conversion Time",               //power 8, level 1
            "Conversion Time+",              //power 8, level 2
            "Conversion Time+ & Invincible", //power 8, level 3
            "1 Lane",                        //power 9, level 1
            "2 Lanes",                       //power 9, level 2
            "All Lanes"
        };                                   //power 9, level 3

        elem = new string[TOTAL_BASE_POWERUPS * TIMES_UPGRADED, TYPES_OF_ELEMENTS_PER_UNLOCK] {
            { FirstPowerUpElements[0], FirstPowerUpElements[1], FirstPowerUpElements[2], FirstPowerUpElements[3] }, //power 1, upgrade 1
            { "magma", "cloud", "mud", "energy" },                                                                  //power 1, upgrade 2
            { "desert", "earthquake", "blizzard", "mountain" },                                                     //power 2, upgrade 1
            { "storm", "glass", "clay", "brick" },                                                                  //power 2, upgrade 2
            { "coal", "volcano", "tornado", "glacier" },                                                            //power 3, upgrade 1
            { "ion", "fission", "ceramics", "monsoon" },                                                            //power 3, upgrade 2
            { "diamond", "aurora", "smoke", "flood" },                                                              //power 4, upgrade 1
            { "metal", "grass", "radiation", "tsunami" },                                                           //power 4, upgrade 2
            { "meteoroid", "supernova", "archipelago", "rust" },                                                    //power 5, upgrade 1
            { "wasteland", "voltage", "tide", "edifice" },                                                          //power 5, upgrade 2
            { "algae", "pulsar", "dynamo", "windmill" },                                                            //power 6, upgrade 1
            { "aliens", "fusion", "whirlpool", "resistance" },                                                      //power 6, upgrade 2
            { "forest", "crater", "maze", "apocalypse" },                                                           //power 7, upgrade 1
            { "dreams", "balance", "coincidence", "fate" },                                                         //power 7, upgrade 2
            { "valley", "fruit", "sorcery", "prophecy" },                                                           //power 8, upgrade 1
            { "inertia", "morality", "method", "insight" },                                                         //power 8, upgrade 2
            { "emotion", "chaos", "deception", "reason" },                                                          //power 9, upgrade 1
            { "information", "chronology", "absurd", "motivation" }
        };                                                                                                          //power 9, upgrade 2
        cost = new int[TOTAL_BASE_POWERUPS * TIMES_UPGRADED, TYPES_OF_ELEMENTS_PER_UNLOCK] {
            { 50, 50, 50, 50 },                                                                                     //power 1, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 1, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 2, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 2, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 3, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 3, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 4, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 4, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 5, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 5, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 6, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 6, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 7, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 7, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 8, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 8, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 9, upgrade 1
            { 99, 99, 99, 99 }
        };                                                                                                          //power 9, upgrade 2


        notEnoughColor = new Color(255.0f / 255.0f, 135.0f / 255.0f, 126.0f / 255.0f);
    }
Exemple #44
0
        public async Task <GenerationTypeFuel> LoadSingleAsync(WRLDCWarehouseDbContext _context, ILogger _log, GenerationTypeFuelForeign genTypeFuelForeign, EntityWriteOption opt)
        {
            // check if entity already exists
            GenerationTypeFuel existingGenTypeFuel = await _context.GenerationTypeFuels.SingleOrDefaultAsync(gtf => gtf.WebUatId == genTypeFuelForeign.WebUatId);

            // check if we should not modify existing entities
            if (opt == EntityWriteOption.DontReplace && existingGenTypeFuel != null)
            {
                return(existingGenTypeFuel);
            }

            // find the GenerationType via the Substation WebUatId
            int            genTypeWebUatId = genTypeFuelForeign.GenerationTypeWebUatId;
            GenerationType genType         = await _context.GenerationTypes.SingleOrDefaultAsync(gt => gt.WebUatId == genTypeWebUatId);

            // if GenerationType doesnot exist, skip the import. Ideally, there should not be such case
            if (genType == null)
            {
                _log.LogCritical($"Unable to find GenerationType with webUatId {genTypeWebUatId} while inserting GenerationTypeFuel with webUatId {genTypeFuelForeign.WebUatId}");
                return(null);
            }

            // find the Fuel via the Fuel WebUatId
            int  fuelWebUatId = genTypeFuelForeign.FuelWebUatId;
            Fuel fuel         = await _context.Fuels.SingleOrDefaultAsync(f => f.WebUatId == fuelWebUatId);

            // if fuel doesnot exist, skip the import. Ideally, there should not be such case
            if (fuel == null)
            {
                _log.LogCritical($"Unable to find Fuel with webUatId {fuelWebUatId} while inserting GenerationTypeFuel with webUatId {genTypeFuelForeign.WebUatId}");
                return(null);
            }

            // check if we have to replace the entity completely
            if (opt == EntityWriteOption.Replace && existingGenTypeFuel != null)
            {
                _context.GenerationTypeFuels.Remove(existingGenTypeFuel);
            }

            // if entity is not present, then insert or check if we have to replace the entity completely
            if (existingGenTypeFuel == null || (opt == EntityWriteOption.Replace && existingGenTypeFuel != null))
            {
                GenerationTypeFuel newGenTypeFuel = new GenerationTypeFuel();
                newGenTypeFuel.FuelId           = fuel.FuelId;
                newGenTypeFuel.GenerationTypeId = genType.GenerationTypeId;
                newGenTypeFuel.WebUatId         = genTypeFuelForeign.WebUatId;

                _context.GenerationTypeFuels.Add(newGenTypeFuel);
                await _context.SaveChangesAsync();

                return(newGenTypeFuel);
            }

            // check if we have to modify the entity
            if (opt == EntityWriteOption.Modify && existingGenTypeFuel != null)
            {
                existingGenTypeFuel.FuelId           = fuel.FuelId;
                existingGenTypeFuel.GenerationTypeId = genType.GenerationTypeId;
                await _context.SaveChangesAsync();

                return(existingGenTypeFuel);
            }
            return(null);
        }
Exemple #45
0
 public void add(Manufacturer manufacturer, String name, double engineCapacity, Fuel fuel, int width, int height, int length)
 {
     this.items.Add(new Car(manufacturer, name, engineCapacity, fuel, width, height, length));
 }
Exemple #46
0
 void Start()
 {
     fuel = Generator.GetComponent <Fuel>();
 }
    // Use this for initialization
    void Start()
    {
        //make PowerUpScreen active since Content is referenced
        powerScreen = GameObject.Find ("Canvas/PowerUpScreen");
        powerScreen.SetActive (true);
        contentList = GameObject.Find ("Canvas/PowerUpScreen/ScrollView/Content");
        powerScreen.SetActive (false);

        buttonScale = new Vector3 (buttonSize, buttonSize, buttonSize);
        upgradeBarImages = new Sprite[]{upgradeBar0,upgradeBar1,upgradeBar2,upgradeBar3};
        upgradeCardImages = new Sprite[]{upgradeCard0,upgradeCard1,upgradeCard2,upgradeCard3};

        PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];

        //the array of all possible PowerUps the spawned PowerUp could be
        PowerUps[0] = new LaneConversion(DEFAULT_NUMBER);
        PowerUps[1] = new SlowFall(DEFAULT_NUMBER,DEFAULT_NUMBER,DEFAULT_NUMBER);
        PowerUps[2] = new Fuel(DEFAULT_NUMBER) ;
        PowerUps[3] = new Multiply(DEFAULT_NUMBER,DEFAULT_NUMBER);
        PowerUps[4] = new BucketShield(DEFAULT_NUMBER);
        PowerUps[5] = new TapToCollect(DEFAULT_NUMBER);
        PowerUps[6] = new Invincible(DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[7] = new TotalConversion(DEFAULT_NUMBER);
        PowerUps[8] = new CollectAll();

        powerDescriptions = new string[TOTAL_BASE_POWERUPS*UPGRADE_LEVELS]{
            "Tap or drag this ability into a specific lane to convert the elements contained to the lane’s elemental type.",//power 1, level 1
            "Tap or drag this ability into a specific lane to convert the elements contained, and an adjacent lane, to each lane’s elemental type.",//power 1, level 2
            "Tap or drag this ability to convert the elements contained within each lane to the lane’s elemental type.",//power 1, level 3
            "Tap or drag this ability into a specific lane to slow down the fall of elements contained.",//power 2, level 1
            "Tap or drag this ability into a specific lane to significantly slow down the fall of elements contained.",//power 2, level 2
            "Tap or drag this ability to significantly slow down the fall all elements.",//power 2, level 3
            "Your fuel does not deplete for a certain duration.",//power 3, level 1
            "You gain additional fuel and it does not deplete for a certain duration.",//power 3, level 2
            "You gain a significant amount of additional fuel and it does not deplete for a certain duration.",//power 3, level 3
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type.",//power 4, level 1
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type, and an adjacent lane’s elemental type.",//power 4, level 2
            "Tap or drag this ability to receive a score multiplier for elements collected of all elemental types.",//power 4, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 2 incorrect elements that fall into it.",//power 5, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 4 incorrect elements that fall into it.",//power 5, level 2
            "Tap or drag this ability to give all lanes no miss penalty for the next 4 incorrect elements that fall into them, for each lane.",//power 5, level 3
            "Simply tap elements to automatically collect them.",//power 6, level 1
            "Simply tap elements to automatically collect them.",//power 6, level 2
            "Simply tap elements to automatically collect them.",//power 6, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a small amount of time.",//power 7, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a decent amount of time.",//power 7, level 2
            "Tap or drag this ability to give all lanes no miss penalty for a decent amount of time.",//power 7, level 3
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a small amount of time.",//power 8, level 1
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a decent amount of time.",//power 8, level 2
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type and gain invincibility for a decent amount of time.",//power 8, level 3
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane.",//power 9, level 1
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane and an adjacent lane.",//power 9, level 2
            "Tap or drag this ability to automatically collect all elements in all lanes."};//power 9, level 3

        bonusTexts = new string[TOTAL_BASE_POWERUPS*UPGRADE_LEVELS]{
            "1 Lane",//power 1, level 1
            "2 Lanes",//power 1, level 2
            "All Lanes",//power 1, level 3
            "Slow",//power 2, level 1
            "Slower",//power 2, level 2
            "Slower & All Lanes",//power 2, level 3
            "Fuel",//power 3, level 1
            "Fuel+",//power 3, level 2
            "Fuel++",//power 3, level 3
            "1 Element",//power 4, level 1
            "2 Elements",//power 4, level 2
            "4 Element",//power 4, level 3
            "2 Saves & 1 Lane",//power 5, level 1
            "4 Saves & 1 Lane",//power 5, level 2
            "4 Saves & All Lanes",//power 5, level 3
            "Tap Time",//power 6, level 1
            "Tap Time+",//power 6, level 2
            "Tap Time++",//power 6, level 3
            "Invincible Time & 1 Lane",//power 7, level 1
            "Invincible Time+ & 1 Lane",//power 7, level 2
            "Invincible Time+ & All Lanes",//power 7, level 3
            "Conversion Time",//power 8, level 1
            "Conversion Time+",//power 8, level 2
            "Conversion Time+ & Invincible",//power 8, level 3
            "1 Lane",//power 9, level 1
            "2 Lanes",//power 9, level 2
            "All Lanes"};//power 9, level 3

        elem = new string[TOTAL_BASE_POWERUPS*TIMES_UPGRADED,TYPES_OF_ELEMENTS_PER_UNLOCK]{
            {FirstPowerUpElements[0], FirstPowerUpElements[1], FirstPowerUpElements[2], FirstPowerUpElements[3]},//power 1, upgrade 1
            {"magma","cloud","mud","energy"},//power 1, upgrade 2
            {"desert","earthquake","blizzard","mountain"},//power 2, upgrade 1
            {"storm","glass","clay","brick"},//power 2, upgrade 2
            {"coal","volcano","tornado","glacier"},//power 3, upgrade 1
            {"ion","fission","ceramics","monsoon"},//power 3, upgrade 2
            {"diamond","aurora","smoke","flood"},//power 4, upgrade 1
            {"metal","grass","radiation","tsunami"},//power 4, upgrade 2
            {"meteoroid","supernova","archipelago","rust"},//power 5, upgrade 1
            {"wasteland","voltage","tide","edifice"},//power 5, upgrade 2
            {"algae","pulsar","dynamo","windmill"},//power 6, upgrade 1
            {"aliens","fusion","whirlpool","resistance"},//power 6, upgrade 2
            {"forest","crater","maze","apocalypse"},//power 7, upgrade 1
            {"dreams","balance","coincidence","fate"},//power 7, upgrade 2
            {"valley","fruit","sorcery","prophecy"},//power 8, upgrade 1
            {"inertia","morality","method","insight"},//power 8, upgrade 2
            {"emotion","chaos","deception","reason"},//power 9, upgrade 1
            {"information","chronology","absurd","motivation"}};//power 9, upgrade 2
        cost = new int[TOTAL_BASE_POWERUPS*TIMES_UPGRADED,TYPES_OF_ELEMENTS_PER_UNLOCK]{
            {50, 50, 50, 50},//power 1, upgrade 1
            {99,99,99,99},//power 1, upgrade 2
            {50,50,50,50},//power 2, upgrade 1
            {99,99,99,99},//power 2, upgrade 2
            {50,50,50,50},//power 3, upgrade 1
            {99,99,99,99},//power 3, upgrade 2
            {50,50,50,50},//power 4, upgrade 1
            {99,99,99,99},//power 4, upgrade 2
            {50,50,50,50},//power 5, upgrade 1
            {99,99,99,99},//power 5, upgrade 2
            {50,50,50,50},//power 6, upgrade 1
            {99,99,99,99},//power 6, upgrade 2
            {50,50,50,50},//power 7, upgrade 1
            {99,99,99,99},//power 7, upgrade 2
            {50,50,50,50},//power 8, upgrade 1
            {99,99,99,99},//power 8, upgrade 2
            {50,50,50,50},//power 9, upgrade 1
            {99,99,99,99}};//power 9, upgrade 2

        notEnoughColor = new Color(255.0f/255.0f,135.0f/255.0f,126.0f/255.0f);
    }
Exemple #48
0
 // Use this for initialization
 void Start()
 {
     fuel     = FindObjectOfType <Fuel>();
     fuelText = GetComponent <Text>();
 }
Exemple #49
0
 private static Stream<End> WhenSetDown(Stream<UpDown> sNozzle, Fuel nozzleFuel, Cell<IMaybe<Fuel>> fillActive)
 {
     return sNozzle.Snapshot(fillActive, (u, f) => u == UpDown.Down && f.Equals(Maybe.Just(nozzleFuel)) ? Maybe.Just(End.Value) : Maybe.Nothing<End>()).FilterMaybe();
 }
    protected void btnExport_Click(object sender, EventArgs e)
    {
        #region get data
        WordExtend ex   = new WordExtend();
        string     temp = "TempReport/TemMauBaoCao" + drpmaubaocao.SelectedValue + ".doc";
        ex.OpenFile(Server.MapPath(ResolveUrl("~") + temp));
        Enterprise        or    = new Enterprise();
        EnterpriseService orser = new EnterpriseService();
        or = orser.FindByKey(Convert.ToInt32(memVal.OrgId));

        DataTable dtinfo = new DataTable();
        ex.WriteToMergeField("BC_MaDN", "");
        if (memVal.OrgId > 0)
        {
            dtinfo = new ReportFuelService().GetInfoReportFuel(ReportId);
        }

        if (or != null)
        {
            ex.WriteToMergeField("BC_Title", or.Title);
            ex.WriteToMergeField("BC_TenCoSo", or.Title);
            ex.WriteToMergeField("BC_TenCoSo1", or.Title);
            ex.WriteToMergeField("BC_TenCoSo2", or.Title);
        }
        else
        {
            ex.WriteToMergeField("BC_TenCoSo", "");
        }
        if (dtinfo.Rows[0]["Year"] != DBNull.Value)
        {
            string NextYear = (Convert.ToInt32(dtinfo.Rows[0]["Year"]) + 1).ToString();
            ex.WriteToMergeField("BC_NextYear", NextYear);
            ex.WriteToMergeField("BC_NextYear1", NextYear);
            ex.WriteToMergeField("BC_NextYear2", NextYear);
            ex.WriteToMergeField("BC_Year", dtinfo.Rows[0]["Year"].ToString());
            ex.WriteToMergeField("BC_Year1", dtinfo.Rows[0]["Year"].ToString());
        }
        if (dtinfo.Rows[0]["Responsible"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_ChiuTrachNhiem", dtinfo.Rows[0]["Responsible"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_ChiuTrachNhiem", "");
        }

        if (dtinfo.Rows[0]["ReportDate"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_NgayLap", Convert.ToDateTime(dtinfo.Rows[0]["ReportDate"]).ToString("dd/MM/yyyy"));
            ex.WriteToMergeField("BC_NgayBC", Convert.ToDateTime(dtinfo.Rows[0]["ReportDate"]).ToString("dd/MM/yyyy"));
        }
        if (dtinfo.Rows[0]["ReceivedDate"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_NgayNhan", Convert.ToDateTime(dtinfo.Rows[0]["ReceivedDate"]).ToString("dd/MM/yyyy"));
        }
        else
        {
            ex.WriteToMergeField("BC_NgayNhan", "");
        }
        if (dtinfo.Rows[0]["ConfirmedDate"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_NgayXacNhan", Convert.ToDateTime(dtinfo.Rows[0]["ConfirmedDate"]).ToString("dd/MM/yyyy"));
        }
        else
        {
            ex.WriteToMergeField("BC_NgayXacNhan", "");
        }
        if (dtinfo.Rows[0]["SubAreaName"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_PhanNganh", dtinfo.Rows[0]["SubAreaName"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_PhanNganh", "");
        }

        if (dtinfo.Rows[0]["TaxCode"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_TaxCode", dtinfo.Rows[0]["TaxCode"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_TaxCode", "");
        }

        ex.WriteToMergeField("BC_Owner", ltOwner.Text);

        if (or.Address != null)
        {
            ex.WriteToMergeField("BC_DiaChi", or.Address);
        }
        if (dtinfo.Rows[0]["DistrictName"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_Huyen", dtinfo.Rows[0]["DistrictName"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_Huyen", "");
        }
        if (dtinfo.Rows[0]["ProvinceName"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_Tinh", dtinfo.Rows[0]["ProvinceName"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_Tinh", "");
        }
        if (dtinfo.Rows[0]["ReporterName"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_NguoiBC", dtinfo.Rows[0]["ReporterName"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_NguoiBC", "");
        }

        if (dtinfo.Rows[0]["Fax"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_Fax", dtinfo.Rows[0]["Fax"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_Fax", "");
        }
        if (dtinfo.Rows[0]["Email"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_Email", dtinfo.Rows[0]["Email"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_Email", "");
        }

        if (dtinfo.Rows[0]["Phone"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_DienThoai", dtinfo.Rows[0]["Phone"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_DienThoai", "");
        }
        if (dtinfo.Rows[0]["ParentName"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_TenCtyMe", dtinfo.Rows[0]["ParentName"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_TenCtyMe", "");
        }

        if (dtinfo.Rows[0]["AddressParent"] != null)
        {
            ex.WriteToMergeField("BC_DiaChiP", dtinfo.Rows[0]["AddressParent"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_DiaChiP", "");
        }

        if (dtinfo.Rows[0]["DistrictNameP"] != null)
        {
            ex.WriteToMergeField("BC_HuyenP", dtinfo.Rows[0]["DistrictNameP"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_HuyenP", "");
        }

        if (dtinfo.Rows[0]["ProvinceNameP"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_TinhP", dtinfo.Rows[0]["ProvinceNameP"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_TinhP", "");
        }

        if (dtinfo.Rows[0]["PhoneParent"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_DienThoaiP", dtinfo.Rows[0]["PhoneParent"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_DienThoaiP", "");
        }

        if (dtinfo.Rows[0]["FaxParent"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_FaxP", dtinfo.Rows[0]["FaxParent"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_FaxP", "");
        }
        if (dtinfo.Rows[0]["EmailParent"] != DBNull.Value)
        {
            ex.WriteToMergeField("BC_EmailP", dtinfo.Rows[0]["EmailParent"].ToString());
        }
        else
        {
            ex.WriteToMergeField("BC_EmailP", "");
        }

        if (or.ActiveYear > 0)
        {
            ex.WriteToMergeField("ActiveYear", or.ActiveYear.ToString());
        }
        else
        {
            ex.WriteToMergeField("ActiveYear", "");
        }

        Infrastructure        infra        = new Infrastructure();
        InfrastructureService infraService = new InfrastructureService();

        infra = infraService.GetInfrastructureByReport(ReportId);
        if (infra != null)
        {
            if (infra.ProduceAreaNo > 0)
            {
                ex.WriteToMergeField("ProduceAreaNo", infra.ProduceAreaNo.ToString());
            }
            else
            {
                ex.WriteToMergeField("ProduceAreaNo", "");
            }
            if (infra.OfficeAreaNo > 0)
            {
                ex.WriteToMergeField("OfficeAreaNo", infra.OfficeAreaNo.ToString());
            }
            else
            {
                ex.WriteToMergeField("OfficeAreaNo", "");
            }
            if (infra.ProduceEmployeeNo > 0)
            {
                ex.WriteToMergeField("ProduceEmployeeNo", infra.ProduceEmployeeNo.ToString());
            }
            else
            {
                ex.WriteToMergeField("ProduceEmployeeNo", "");
            }
            if (infra.OfficeEmployeeNo > 0)
            {
                ex.WriteToMergeField("OfficeEmployeeNo", infra.OfficeEmployeeNo.ToString());
            }
            else
            {
                ex.WriteToMergeField("OfficeEmployeeNo", "");
            }
        }
        else
        {
            ex.WriteToMergeField("ProduceAreaNo", "");
            ex.WriteToMergeField("OfficeAreaNo", "");
            ex.WriteToMergeField("ProduceEmployeeNo", "");
            ex.WriteToMergeField("OfficeEmployeeNo", "");
        }


        UsingElectrict        usingElectrict        = new UsingElectrict();
        UsingElectrictService usingElectrictService = new UsingElectrictService();

        usingElectrict = usingElectrictService.GetUsingElectrictByReport(ReportId, false);
        if (usingElectrict != null)
        {
            //Su dung dien 2
            if (usingElectrict.Quantity > 0)
            {
                ex.WriteToMergeField("QuantityResult2", usingElectrict.Quantity.ToString());
            }
            else
            {
                ex.WriteToMergeField("QuantityResult2", "");
            }
            if (usingElectrict.InstalledCapacity > 0)
            {
                ex.WriteToMergeField("InstalledCapacityResult2", usingElectrict.InstalledCapacity.ToString());
            }
            else
            {
                ex.WriteToMergeField("InstalledCapacityResult2", "");
            }
            if (usingElectrict.Capacity > 0)
            {
                ex.WriteToMergeField("CapacityResult2", usingElectrict.Capacity.ToString());
            }
            else
            {
                ex.WriteToMergeField("CapacityResult2", "");
            }
            if (usingElectrict.BuyCost > 0)
            {
                ex.WriteToMergeField("BuyCostResult2", usingElectrict.BuyCost.ToString());
            }
            else
            {
                ex.WriteToMergeField("BuyCostResult2", "");
            }
            if (usingElectrict.BuyCost > 0 && usingElectrict.Capacity > 0)
            {
                ex.WriteToMergeField("BuyPriceResult2", Math.Round((usingElectrict.BuyCost / (usingElectrict.Capacity * 1000)), 0).ToString());
            }
            else
            {
                ex.WriteToMergeField("BuyPriceResult2", "");
            }
            if (usingElectrict.ProduceQty > 0)
            {
                ex.WriteToMergeField("ProduceQtyResult2", usingElectrict.ProduceQty.ToString());
            }
            else
            {
                ex.WriteToMergeField("ProduceQtyResult2", "");
            }
            if (usingElectrict.Technology != null)
            {
                ex.WriteToMergeField("TechnologyResult2", usingElectrict.Technology.ToString());
            }
            else
            {
                ex.WriteToMergeField("TechnologyResult2", "");
            }
            if (usingElectrict.FuelId > 0)
            {
                Fuel fuel = new Fuel();

                fuel = new FuelService().FindByKey(usingElectrict.FuelId);
                if (fuel != null)
                {
                    ex.WriteToMergeField("FuelNameResult2", fuel.FuelName);
                    ex.WriteToMergeField("FuelNameResult", fuel.FuelName);
                }
                else
                {
                    ex.WriteToMergeField("FuelNameResult2", "");
                    ex.WriteToMergeField("FuelNameResult", "");
                }
            }
            else
            {
                ex.WriteToMergeField("FuelNameResult2", "");
                ex.WriteToMergeField("FuelNameResult", "");
            }
            if (usingElectrict.PriceProduce > 0)
            {
                ex.WriteToMergeField("PriceProduceResult2", usingElectrict.PriceProduce.ToString());
            }
            else
            {
                ex.WriteToMergeField("PriceProduceResult2", "");
            }


            //Su dung dien 1
            if (usingElectrict.Quantity > 0)
            {
                ex.WriteToMergeField("QuantityResult", usingElectrict.Quantity.ToString());
            }
            else
            {
                ex.WriteToMergeField("QuantityResult", "");
            }
            if (usingElectrict.InstalledCapacity > 0)
            {
                ex.WriteToMergeField("InstalledCapacityResult", usingElectrict.InstalledCapacity.ToString());
            }
            else
            {
                ex.WriteToMergeField("InstalledCapacityResult", "");
            }
            if (usingElectrict.Capacity > 0)
            {
                ex.WriteToMergeField("CapacityResult", usingElectrict.Capacity.ToString());
            }
            else
            {
                ex.WriteToMergeField("CapacityResult", "");
            }
            if (usingElectrict.BuyCost > 0)
            {
                ex.WriteToMergeField("BuyCostResult", usingElectrict.BuyCost.ToString());
            }
            else
            {
                ex.WriteToMergeField("BuyCostResult", "");
            }
            if (usingElectrict.BuyCost > 0 && usingElectrict.Capacity > 0)
            {
                ex.WriteToMergeField("BuyPriceResult", Math.Round((usingElectrict.BuyCost / (usingElectrict.Capacity * 1000)), 0).ToString());
            }
            else
            {
                ex.WriteToMergeField("BuyPriceResult", "");
            }
            if (usingElectrict.ProduceQty > 0)
            {
                ex.WriteToMergeField("ProduceQtyResult", usingElectrict.ProduceQty.ToString());
            }
            else
            {
                ex.WriteToMergeField("ProduceQtyResult", "");
            }
            if (usingElectrict.Technology != null)
            {
                ex.WriteToMergeField("TechnologyResult", usingElectrict.Technology.ToString());
            }
            else
            {
                ex.WriteToMergeField("TechnologyResult", "");
            }
            if (usingElectrict.FuelId > 0)
            {
                ex.WriteToMergeField("FuelNameResult", usingElectrict.FuelId.ToString());
            }
            else
            {
                ex.WriteToMergeField("FuelNameResult", "");
            }
        }
        else
        {
            ex.WriteToMergeField("QuantityResult2", "");
            ex.WriteToMergeField("InstalledCapacityResult2", "");
            ex.WriteToMergeField("CapacityResult2", "");
            ex.WriteToMergeField("BuyCostResult2", "");
            ex.WriteToMergeField("ProduceQtyResult2", "");
            ex.WriteToMergeField("TechnologyResult2", "");
            ex.WriteToMergeField("FuelNameResult2", "");
            ex.WriteToMergeField("PriceProduceResult2", "");


            ex.WriteToMergeField("QuantityResult", "");
            ex.WriteToMergeField("InstalledCapacityResult", "");
            ex.WriteToMergeField("CapacityResult", "");
            ex.WriteToMergeField("BuyCostResult", "");
            ex.WriteToMergeField("ProduceQtyResult", "");
            ex.WriteToMergeField("TechnologyResult", "");
            ex.WriteToMergeField("FuelNameResult", "");
        }


        usingElectrict = new UsingElectrict();

        usingElectrict = usingElectrictService.GetUsingElectrictByReport(ReportId, true);
        if (usingElectrict != null)
        {
            //Su dung dien 2
            if (usingElectrict.Quantity > 0)
            {
                ex.WriteToMergeField("QuantityPlan", usingElectrict.Quantity.ToString());
            }
            else
            {
                ex.WriteToMergeField("QuantityPlan", "");
            }
            if (usingElectrict.InstalledCapacity > 0)
            {
                ex.WriteToMergeField("InstalledCapacityPlan", usingElectrict.InstalledCapacity.ToString());
            }
            else
            {
                ex.WriteToMergeField("InstalledCapacityPlan", "");
            }
            if (usingElectrict.Capacity > 0)
            {
                ex.WriteToMergeField("CapacityPlan", usingElectrict.Capacity.ToString());
            }
            else
            {
                ex.WriteToMergeField("CapacityPlan", "");
            }
            if (usingElectrict.BuyCost > 0)
            {
                ex.WriteToMergeField("BuyCostPlan", usingElectrict.BuyCost.ToString());
            }
            else
            {
                ex.WriteToMergeField("BuyCostPlan", "");
            }

            if (usingElectrict.BuyCost > 0)
            {
                ex.WriteToMergeField("BuyPricePlan", usingElectrict.BuyCost.ToString());
            }
            else
            {
                ex.WriteToMergeField("BuyPricePlan", "");
            }

            if (usingElectrict.ProduceQty > 0)
            {
                ex.WriteToMergeField("ProduceQtyPlan", usingElectrict.ProduceQty.ToString());
            }
            else
            {
                ex.WriteToMergeField("ProduceQtyPlan", "");
            }
            if (usingElectrict.Technology != null)
            {
                ex.WriteToMergeField("TechnologyPlan", usingElectrict.Technology.ToString());
            }
            else
            {
                ex.WriteToMergeField("TechnologyPlan", "");
            }
            if (usingElectrict.FuelId > 0)
            {
                Fuel fuel = new Fuel();

                fuel = new FuelService().FindByKey(usingElectrict.FuelId);
                if (fuel != null)
                {
                    ex.WriteToMergeField("FuelNamePlan", fuel.FuelName);
                }
                else
                {
                    ex.WriteToMergeField("FuelNamePlan", "");
                }
            }
            else
            {
                ex.WriteToMergeField("FuelNamePlan", "");
            }
            if (usingElectrict.PriceProduce > 0)
            {
                ex.WriteToMergeField("PriceProducePlan", usingElectrict.PriceProduce.ToString());
            }
            else
            {
                ex.WriteToMergeField("PriceProducePlan", "");
            }
        }
        else
        {
            ex.WriteToMergeField("QuantityPlan", "");
            ex.WriteToMergeField("InstalledCapacityPlan", "");
            ex.WriteToMergeField("CapacityPlan", "");
            ex.WriteToMergeField("BuyCostPlan", "");
            ex.WriteToMergeField("ProduceQtyPlan", "");
            ex.WriteToMergeField("TechnologyPlan", "");
            ex.WriteToMergeField("FuelNamePlan", "");
            ex.WriteToMergeField("PriceProducePlan", "");
        }

        DataTable dthientai = new DataTable();
        DataTable dtdukien  = new DataTable();

        DataSet dshientai = new DataSet("tbl1");

        DataTable dt = new DataTable();

        dt = new ReportFuelDetailService().GetNoFuelDetailByReport(ReportId, false);

        dt.Columns.Add("dvnhietnang", typeof(string));
        dt.Columns.Add("dvnhieulieu", typeof(string));
        dthientai = dt.Clone();
        foreach (DataRow item in dt.Rows)
        {
            DataRow workRow = null;
            workRow = dthientai.NewRow();
            workRow = item;
            if (workRow["MeasurementName"].ToString().Contains("Mét khối"))
            {
                workRow["dvnhietnang"] = "kJ/m3";
            }
            else
            {
                workRow["dvnhietnang"] = "kJ/kg";
            }
            if (workRow["MeasurementName"].ToString().Contains("tấn") || workRow["MeasurementName"].ToString().Contains("Klg"))
            {
                workRow["dvnhieulieu"] = "kJ/tấn";
            }
            else
            {
                workRow["dvnhieulieu"] = "đ/m3";
            }
            workRow.AcceptChanges();
            dthientai.AcceptChanges();
            dthientai.ImportRow(workRow);
        }
        dt = new ReportFuelDetailService().GetNoFuelDetailByReport(ReportId, true);
        dt.Columns.Add("dvnhietnang", typeof(string));
        dt.Columns.Add("dvnhieulieu", typeof(string));
        dtdukien = dt.Clone();
        foreach (DataRow item in dt.Rows)
        {
            DataRow workRow = null;
            workRow = dtdukien.NewRow();
            workRow = item;
            if (workRow["MeasurementName"].ToString().Contains("Mét khối"))
            {
                workRow["dvnhietnang"] = "kJ/m3";
            }
            else
            {
                workRow["dvnhietnang"] = "kJ/kg";
            }
            if (workRow["MeasurementName"].ToString().Contains("tấn") || workRow["MeasurementName"].ToString().Contains("Klg"))
            {
                workRow["dvnhieulieu"] = "kJ/tấn";
            }
            else
            {
                workRow["dvnhieulieu"] = "đ/m3";
            }
            workRow.AcceptChanges();
            dtdukien.ImportRow(workRow);
            dtdukien.AcceptChanges();
        }
        ProductCapacityService productCapacityService = new ProductCapacityService();
        DataTable tblProductResult = new DataTable();
        tblProductResult = productCapacityService.GetDataCapacity(ReportId, false);
        dshientai.Merge(tblProductResult);
        dshientai.Tables[0].TableName = "tbl1";

        dshientai.Merge(dthientai);

        dshientai.Tables[1].TableName = "tbl2";
        //ex.WriteDataSetToMergeField(dshientai);

        DataTable tblProductPlan = new DataTable();
        tblProductPlan = productCapacityService.GetDataCapacity(ReportId, true);
        dshientai.Merge(tblProductPlan);
        dshientai.Tables[2].TableName = "tbl3";

        dshientai.Merge(dtdukien);
        dshientai.Tables[3].TableName = "tbl4";
        //ex.WriteDataSetToMergeField(dshientai);


        DataSet         dsData           = new DataSet();
        PlanTBService   plangpservice    = new PlanTBService();
        PlanTKNLService plangTKNLservice = new PlanTKNLService();
        DataTable       tblGPTKNLPlan    = new DataTable();
        tblGPTKNLPlan = plangTKNLservice.GetPlanTKNLEnerprise(Convert.ToInt32(memVal.OrgId), ReportId, false, true);
        dshientai.Merge(tblGPTKNLPlan);
        dshientai.Tables[4].TableName = "tbl5";

        DataTable tblTBPlan = new DataTable();
        tblTBPlan = plangpservice.GetPlanTBEnterprise(memVal.OrgId, ReportId, false, true);
        dshientai.Merge(tblTBPlan);
        dshientai.Tables[5].TableName = "tbl6";

        dshientai.Merge(tblProductPlan.Copy());
        dshientai.Tables[6].TableName = "tbl7";

        dshientai.Merge(dthientai.Copy());
        dshientai.Tables[7].TableName = "tbl8";

        DataTable tblGPTKNLResult = new DataTable();
        tblGPTKNLResult = plangTKNLservice.GetPlanTKNLEnerprise(Convert.ToInt32(memVal.OrgId), ReportId, false, false);
        dshientai.Merge(tblGPTKNLResult);
        dshientai.Tables[8].TableName = "tbl9";
        DataTable tblTBResult = new DataTable();
        tblTBResult = plangpservice.GetPlanTBEnterprise(memVal.OrgId, ReportId, false, false);
        dshientai.Merge(tblTBResult);
        dshientai.Tables[9].TableName = "tbl10";

        dshientai.Tables.Add(tblTBResult.Copy());
        dshientai.Tables[10].TableName = "tbl11";

        ex.WriteDataSetToMergeField(dshientai);
        // dsg.Tables.Add(dst);
        //var dt2 = ExcelExportHelper.CreateGroupInDT(dt, "DepName", "STT");
        #endregion
        ex.Save(Server.MapPath(ResolveUrl("~") + "TempReport/" + memVal.UserName + ".Bao-cao-hang-nam-" + dtinfo.Rows[0]["Year"] + ".doc"));
        HttpContext.Current.Response.Redirect(string.Format("~/Download.aspx?fp={0}&fn={1}",
                                                            System.IO.Path.GetFileName(Server.MapPath(ResolveUrl("~") + "TempReport/" + memVal.UserName + ".Bao-cao-hang-nam-" + dtinfo.Rows[0]["Year"] + ".doc")),
                                                            ""
                                                            ));
    }