Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public static TillSoilJob FindTillSoilJobForSeed(FarmManager farmManager, Character character)
        {
            TillSoilJob tillSoilJob = farmManager.FindTillSoilJob(character);

            if (tillSoilJob == null)
            {
                return(null);
            }
            Vector3     position    = tillSoilJob.Position;
            Map         map         = GnomanEmpire.Instance.Map;
            MapCell     cell        = map.GetCell(position);
            Designation designation = cell.Designation;
            Farm        farm        = designation as Farm;

            if (farm != null)
            {
                int          seedMaterial = farm.SeedMaterial;
                StockManager stockManager = GnomanEmpire.Instance.Fortress.StockManager;
                if (stockManager.FindClosestItem(position, ItemID.Seed, seedMaterial) != null)
                {
                    return(tillSoilJob);
                }
            }
            tillSoilJob.Cancel();
            return(null);
        }
Exemplo n.º 2
0
    public IEnumerator Initialize()
    {
        manager = GameObject.FindGameObjectWithTag("FarmManager").GetComponent <FarmManager> ();

        float numRows, numCols;

        numRows = node ["num_rows"].AsFloat;
        numCols = node ["num_cols"].AsFloat;

        marginOffset = Mathf.Min(transform.localScale.z * margin, transform.localScale.x * margin);

        rowOffset = transform.localScale.z * margin;
        colOffset = transform.localScale.x * margin;

        rowScale = (1.0f - 2 * rowOffset) / (numRows);
        colScale = (1.0f - 2 * colOffset) / (numCols);

        JSONArray sites = node ["plant_sites"].AsArray;

        foreach (JSONNode site in sites)
        {
            yield return(StartCoroutine("LoadSite", site));
        }

        yield return(null);
    }
Exemplo n.º 3
0
        public bool CreateAccount(Account userdata, out bool IsDuplicate)
        {
            bool result = default(bool);

            IsDuplicate = false;
            try
            {
                result = new RepositoryCreator().AccountRepository.CreateAccount(userdata, out IsDuplicate);

                if (result == true && userdata.UserId > default(int))
                {
                    var         connectionString = "AggieGlobal";
                    FarmManager fmanager         = new FarmManager(connectionString);
                    FarmDetail  fDetail          = new FarmDetail();
                    fDetail.FarmId              = default(int);
                    fDetail.FarmName            = "Farm_" + userdata.EmailId;
                    fDetail.FarmSize            = default(int);
                    fDetail.FarmSizeUnit        = string.Empty;
                    fDetail.FarmAddress         = string.Empty;
                    fDetail.FarmEstablishedDate = DateTime.Now;
                    userdata.FarmId             = fmanager.CreateUpdateFarm(fDetail);
                    if (userdata.FarmId > default(int))
                    {
                        fmanager.MapFarmByUserDetail(userdata.FarmId, userdata.UserId);
                    }
                    fmanager.Dispose();
                }
            }
            catch (Exception ex)
            {
                AggieGlobalLogManager.Fatal("AccountManager :: CreateAccount failed :: " + ex.Message);
            }
            return(result);
        }
Exemplo n.º 4
0
    public IEnumerator Initialize(string URL)
    {
        farmManager = GameObject.FindGameObjectWithTag ("FarmManager").GetComponent<FarmManager> ();
        url = URL.Replace(System.Environment.NewLine, "");
        WWW www = new WWW (url);
        yield return www;
        JSONClass node = (JSONClass)JSON.Parse (www.text);

        string typeURL = node ["sensor_type"].Value.Replace(System.Environment.NewLine, "");
        www = new WWW (typeURL);
        yield return www;

        JSONNode typeNode = JSON.Parse (www.text);
        sensorType = typeNode ["name"];

        JSONArray sensingPoints = node ["sensing_points"].AsArray;
        SensorDisplayManager manager = GameObject.FindGameObjectWithTag ("SensorDisplayManager").GetComponent<SensorDisplayManager> ();
        foreach(JSONNode point in sensingPoints)
        {
            //manager.CreateModule(point, this);
            yield return StartCoroutine("LoadSensingPoint", point);
        }

        yield return null;
    }
Exemplo n.º 5
0
    public IEnumerator Initialize()
    {
        manager = GameObject.FindGameObjectWithTag ("FarmManager").GetComponent<FarmManager> ();

        float numRows, numCols;

        numRows = node ["num_rows"].AsFloat;
        numCols = node ["num_cols"].AsFloat;

        marginOffset = Mathf.Min(transform.localScale.z * margin, transform.localScale.x * margin);

        rowOffset = transform.localScale.z * margin;
        colOffset = transform.localScale.x * margin;

        rowScale = (1.0f - 2 * rowOffset) / (numRows);
        colScale = (1.0f - 2 * colOffset) / (numCols);

        JSONArray sites = node ["plant_sites"].AsArray;
        foreach (JSONNode site in sites)
        {
            yield return StartCoroutine("LoadSite", site);
        }

        yield return null;
    }
Exemplo n.º 6
0
    public IEnumerator Initialize(string URL)
    {
        farmManager = GameObject.FindGameObjectWithTag("FarmManager").GetComponent <FarmManager> ();
        url         = URL.Replace(System.Environment.NewLine, "");
        WWW www = new WWW(url);

        yield return(www);

        JSONClass node = (JSONClass)JSON.Parse(www.text);

        string typeURL = node ["sensor_type"].Value.Replace(System.Environment.NewLine, "");

        www = new WWW(typeURL);
        yield return(www);

        JSONNode typeNode = JSON.Parse(www.text);

        sensorType = typeNode ["name"];

        JSONArray            sensingPoints = node ["sensing_points"].AsArray;
        SensorDisplayManager manager       = GameObject.FindGameObjectWithTag("SensorDisplayManager").GetComponent <SensorDisplayManager> ();

        foreach (JSONNode point in sensingPoints)
        {
            //manager.CreateModule(point, this);
            yield return(StartCoroutine("LoadSensingPoint", point));
        }

        yield return(null);
    }
Exemplo n.º 7
0
 public void Awake()
 {
     if (farmManager == null)
     {
         farmManager = this;
     }
 }
Exemplo n.º 8
0
    //OLD
    public void PopulateTray()
    {
        float numRows, numCols;

        numRows = node ["num_rows"].AsFloat;
        numCols = node ["num_cols"].AsFloat;

        //marginOffset = Mathf.Min(transform.localScale.z * margin, transform.localScale.x * margin);

        rowOffset = transform.localScale.z * margin;
        colOffset = margin;        //transform.localScale.x * margin;

        rowScale = (1.0f - 2 * rowOffset) / (numRows);
        colScale = (1.0f - 2 * colOffset) / (numCols);

        JSONArray   sites   = node ["plant_sites"].AsArray;
        FarmManager manager = GameObject.FindGameObjectWithTag("FarmManager").GetComponent <FarmManager> ();

        foreach (JSONNode site in sites)
        {
            GameObject siteObj = Instantiate(manager.sitePrefab) as GameObject;
            FarmSite   script  = siteObj.GetComponent <FarmSite>();
            script.myTray = this;
            script.StartCoroutine("Initialize", site.Value);
            mySites.Add(script);
        }
    }
Exemplo n.º 9
0
 public void Awake()
 {
     if (farmManager == null)
     {
         farmManager = this;
     }
 }
Exemplo n.º 10
0
 public void HarvestTooSoon()
 {
     timer       = 0;
     currentCrop = null;
     tiletype    = TileType.Plot;
     FarmManager.SetMainTile(position.x, position.y, null);
 }
Exemplo n.º 11
0
    public static List <string> AutocompleteCode(string code)
    {
        var farmManager =
            new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);

        return(farmManager.GetCodesForAutocomplete(code));
    }
Exemplo n.º 12
0
    void Start()
    {
        farmManager   = GetComponent <FarmManager> ();
        playerHunger  = GameObject.Find("Player").GetComponent <Hunger> ();
        reportManager = GetComponent <ReportManager> ();

        GenerateHungerBar();
    }
Exemplo n.º 13
0
    void StartNewDay()
    {
        Debug.Log("New day");
        ++_currDay;
        _currTime = DayTimeSeconds;

        FarmManager.GetInstance().OnNextDay();
    }
Exemplo n.º 14
0
        public void LoadCustomFarmByMtnData(string FarmType)
        {
            MtnFarmData farmData = new MtnFarmData {
                FarmTypeName = FarmType
            };

            Canon = FarmManager.Load(farmData);
        }
Exemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="whichFarm"></param>
 public void LoadCustomFarm(int whichFarm)
 {
     Canon = FarmManager.Load(whichFarm);
     if (!Canon)
     {
         GreenhouseManager.LinkToFarm(FarmManager.LoadedFarm);
     }
 }
 public MainWindow()
 {
     collectionsXML.loadCollectionsXML();
     CalendarManager.buildCalendar();
     FarmManager.loadFarmInformation();
     OptionsMenu.loadConfig();
     InitializeComponent();
     farmPlanner = new FarmPlanner();
 }
Exemplo n.º 17
0
    public List <Fabrica> createTable()
    {
        var farmManager =
            new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);

        var factory = Fabrica.Text.Length > 0 ? Fabrica.Text.Trim() : null;
        var farm    = Ferma.Text.Length > 0 ? Ferma.Text.Trim() : null;
        var cod     = Code.Text.Length > 0 ? Code.Text.Trim() : null;

        var farms = farmManager.GetAllFarms(farm, cod);

        var factoryManager =
            new FactoryManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
        var factories = factoryManager.GetFactories(factory);

        var countiesManager =
            new CountyManager(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        var counties = countiesManager.GetAllCounties();

        var values = farms.Select(x => new Fabrica
        {
            id        = x.Id.ToString(),
            cod       = x.Cod,
            nume      = x.Nume,
            numar     = x.Numar,
            email     = x.Email,
            telefon   = x.Telefon,
            oras      = x.Oras,
            strada    = x.Strada,
            fabricaid = x.FabricaId.ToString(),
            judet     = x.Judet
        }).ToList();

        var farctorieslist = values.ToList();

        foreach (var fabrica in farctorieslist)
        {
            var factoryEntity = factories.FirstOrDefault(x => x.Id.ToString(CultureInfo.InvariantCulture) == fabrica.fabricaid);
            if (factoryEntity == null)
            {
                values.Remove(fabrica);
            }
            else
            {
                fabrica.fabricaid = factoryEntity.Nume;
            }

            var countyEntity = counties.FirstOrDefault(x => x.Id.ToString(CultureInfo.InvariantCulture) == fabrica.judet);
            if (countyEntity != null)
            {
                fabrica.judet = countyEntity.DenLoc;
            }
        }

        lcount.Text = values.Count + " ferme";
        return(values);
    }
Exemplo n.º 18
0
        public FarmDetailResponse MapFarmByUserDetail(string FarmId)
        {
            bool res = default(bool);
            FarmDetailResponse resposne      = null;
            SessionData        sessionObject = null;
            int farmId = default(int);
            int userId = default(int);

            try
            {
                if (HttpContext.Current.Session[ApplicationConstant.UserSession] != null)
                {
                    sessionObject = (SessionData)HttpContext.Current.Session[ApplicationConstant.UserSession];
                    resposne      = new FarmDetailResponse();
                    if (string.IsNullOrEmpty(FarmId))
                    {
                        resposne.Error  = "Failed to process";
                        resposne.Status = ResponseStatus.Failed;
                        return(resposne);
                    }
                    else
                    {
                        farmId = Convert.ToInt32(EncryptionHelper.AesDecryption(FarmId, EncryptionKey.LOG));
                        userId = sessionObject._userId;
                    }


                    AggieGlobalLogManager.Info("FarmDetailsController :: MapFarmByUserDetail started ");
                    var connectionString = "AggieGlobal";

                    var repo = new FarmManager(connectionString);

                    res = repo.MapFarmByUserDetail(farmId, userId);
                    if (res == true)
                    {
                        resposne.Status = ResponseStatus.Successful;
                    }
                    else
                    {
                        resposne.Error  = "Failed to process data";
                        resposne.Status = ResponseStatus.Failed;
                    }
                    AggieGlobalLogManager.Info("FarmDetailsController :: MapFarmByUserDetail ended ");
                    repo.Dispose();
                }
            }
            catch (Exception ex)
            {
                resposne.Error  = "Failed to process";
                resposne.Status = ResponseStatus.Failed;
                AggieGlobalLogManager.Fatal("FarmManager :: MapFarmByUserDetail failed :: " + ex.Message);
            }
            return(resposne);
        }
Exemplo n.º 19
0
    //public static GameManager Instance
    //{
    //    get
    //    {
    //        if (instance == null)
    //        {
    //            GameObject tempGM = new GameObject("GameManager");
    //            instance = tempGM.AddComponent<GameManager>();
    //            DontDestroyOnLoad(tempGM);
    //        }
    //        return instance;
    //    }
    //}

    void Awake()
    {
        if (instance)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;

        DontDestroyOnLoad(gameObject);
    }
Exemplo n.º 20
0
 private void Awake()
 {
     if (farmManager == null)
     {
         farmManager = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// Populates the List<CustomFarm> FarmList variable with all the Content Packs
        /// registered to MTN.
        /// </summary>
        /// <param name="helper">SMAPI's IModHelper, to load in the Content Packs</param>
        /// <param name="monitor">SMAPI's IMonitor, to print useful information</param>
        public void Populate(IModHelper helper, IMonitor monitor)
        {
            foreach (IContentPack contentPack in helper.ContentPacks.GetOwned())
            {
                monitor.Log($"Reading content pack: {contentPack.Manifest.Name} {contentPack.Manifest.Version}.");
                FarmManager.Populate(helper, contentPack, monitor);
                GreenhouseManager.Populate(contentPack, monitor);
            }

            return;
        }
Exemplo n.º 22
0
        public void SetInitialGameObjects()
        {
            this.farmManager = new FarmManager();

            this.market = Market.Instance;
            var ingredientFactory = EasterFarm.Models.MarketPlace.MarketFactory.Get(Category.Ingredient);

            this.FillMarketCategory(ingredientFactory, IngredientType.Basket);

            this.presentFactory = new PresentFactory();
        }
Exemplo n.º 23
0
 protected override void OnActivate()
 {
     try
     {
         this.menuManager = new MenuManager();
         this.farmManager = new FarmManager(this.menuManager);
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Exemplo n.º 24
0
    public List<Fabrica> createTable()
    {
        var farmManager =
          new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);

        var factory = Fabrica.Text.Length > 0 ? Fabrica.Text.Trim() : null;
        var farm = Ferma.Text.Length > 0 ? Ferma.Text.Trim() : null;
        var cod = Code.Text.Length > 0 ? Code.Text.Trim() : null;

        var farms = farmManager.GetAllFarms(farm, cod);

        var factoryManager =
          new FactoryManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
        var factories = factoryManager.GetFactories(factory);

        var countiesManager =
         new CountyManager(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        var counties = countiesManager.GetAllCounties();

        var values = farms.Select(x => new Fabrica
        {
            id = x.Id.ToString(),
            cod = x.Cod,
            nume = x.Nume,
            numar = x.Numar,
            email = x.Email,
            telefon = x.Telefon,
            oras = x.Oras,
            strada = x.Strada,
            fabricaid = x.FabricaId.ToString(),
            judet = x.Judet
        }).ToList();

        var farctorieslist = values.ToList();

        foreach (var fabrica in farctorieslist)
        {
            var factoryEntity = factories.FirstOrDefault(x => x.Id.ToString(CultureInfo.InvariantCulture) == fabrica.fabricaid);
            if (factoryEntity == null)
                values.Remove(fabrica);
            else
                fabrica.fabricaid = factoryEntity.Nume;

            var countyEntity = counties.FirstOrDefault(x => x.Id.ToString(CultureInfo.InvariantCulture) == fabrica.judet);
            if (countyEntity != null)
                fabrica.judet = countyEntity.DenLoc;
        }

        lcount.Text = values.Count + " ferme";
        return values;
    }
Exemplo n.º 25
0
 public void Plant(Crop crop)
 {
     if (FarmManager.player.score >= crop.pointCost)
     {
         currentCrop = crop;
         timer       = 0;
         stage       = 0;
         cropHealth  = currentCrop.witherTime;
         stepTime    = crop.GetStepTime();
         FarmManager.SetMainTile(position.x, position.y, currentCrop.tiles[0]);
         tiletype = TileType.Crop;
         FarmManager.player.score -= currentCrop.pointCost;
     }
 }
Exemplo n.º 26
0
    public IEnumerator SetPlant()
    {
        FarmManager manager = GameObject.FindGameObjectWithTag("FarmManager").GetComponent <FarmManager> ();

        GameObject siteObject;

        if (node["plant"].Value != "null")
        {
            isEmpty = false;
            Vector3 lp, ls;

            if (false)
            {
            }
            else
            {
                siteObject = Instantiate(manager.testPlantLeaf) as GameObject;
                lp         = new Vector3(0f, 1f, 0f);
                ls         = new Vector3(1f, 1f, 0.03f);
            }

            plantURL  = node["plant"].Value.Replace(System.Environment.NewLine, "");
            plantName = plantTypeNode["common_name"].Value;
            //siteObject = Instantiate(manager.testSitePrefab) as GameObject;
            //siteObject = Instantiate(manager.testPlantLeaf) as GameObject;
            siteObject.transform.SetParent(transform);
            siteObject.transform.localPosition = lp;
            siteObject.transform.localScale    = ls;
            siteObj = siteObject;
            FarmSiteObject script = siteObject.GetComponent <FarmSiteObject>();
            script.mySite    = this;
            script.hoverable = true;
            script.name      = plantName;
        }
        else
        {
            isEmpty    = true;
            plantName  = "EmptySite";
            siteObject = Instantiate(manager.emptySite) as GameObject;
            siteObject.transform.SetParent(transform);
            siteObject.transform.localPosition = new Vector3(0, 0, 0);
            siteObj = siteObject;
            FarmSiteObject script = siteObject.GetComponent <FarmSiteObject>();
            script.mySite    = this;
            script.hoverable = false;
            script.name      = plantName;
        }

        yield return(null);
    }
Exemplo n.º 27
0
        public Engine(IRenderer renderer, IUserKeyboardInput userInput, IAim aim, GameInitializator gameInitializator)
        {
            this.Renderer          = renderer;
            this.UserInput         = userInput;
            this.Aim               = aim;
            this.GameInitializator = gameInitializator;
            random = new Random();

            this.gameObjects = new HashSet <GameObject>();

            this.farm           = new Farm();
            this.farmManager    = new FarmManager();
            this.market         = new Market();
            this.presentFactory = new PresentFactory();
        }
Exemplo n.º 28
0
    public override void GetTileData(Vector3Int location, ITilemap tilemap, ref TileData tileData)
    {
        tileData.sprite = GrowthLevels[0].Texture;
        FarmManager mgr = FarmManager.GetInstance();

        if (mgr != null)
        {
            int         tileAge = mgr.GetTileAge(location);
            GrowthLevel level   = GetGrowthLevel(tileAge);
            if (level != null)
            {
                tileData.sprite = level.Texture;
            }
        }
    }
Exemplo n.º 29
0
        /// <summary>
        /// Gets the Asset Key of the Base Farm Map. Only does work on the base
        /// farm map of any custom map.
        /// </summary>
        /// <param name="map">The base farm map, loaded.</param>
        /// <returns>The Actual Asset Key</returns>
        public string GetAssetKey(out Map map, string type)
        {
            switch (type)
            {
            case "Farm":
                return(FarmManager.GetAssetKey(out map));

            case "Greenhouse":
                return(GreenhouseManager.GetAssetKey(out map));

            default:
                map = null;
                return(null);
            }
        }
Exemplo n.º 30
0
        public IList <FarmDetailResponse> GetAllFarmsDetails()
        {
            bool ret = default(bool);
            IEnumerable <FarmDetail>   farmData     = null;
            IList <FarmDetailResponse> responsedata = new List <FarmDetailResponse>();

            try
            {
                AggieGlobalLogManager.Info("FarmDetailsController :: GetFarmsDetails started ");
                var connectionString = "AggieGlobal";
                var repo             = new FarmManager(connectionString);
                farmData = repo.GetFarmDetails(default(int));
                if (farmData != null && farmData.Count() > default(int))
                {
                    foreach (FarmDetail det in farmData)
                    {
                        FarmDetailResponse resdata = new FarmDetailResponse();
                        resdata.FarmId              = EncryptionHelper.AesEncryption(Convert.ToString(det.FarmId), EncryptionKey.LOG);
                        resdata.FarmName            = det.FarmName;
                        resdata.CoOpName            = det.CoOpName;
                        resdata.FarmAddress         = det.FarmAddress;
                        resdata.FarmEstablishedDate = det.FarmEstablishedDate;
                        resdata.FarmSize            = det.FarmSize;
                        resdata.FarmSizeUnit        = det.FarmSizeUnit;
                        resdata.Status              = ResponseStatus.Successful;
                        responsedata.Add(resdata);
                    }
                }
                else
                {
                    FarmDetailResponse resdata = new FarmDetailResponse();
                    resdata.Error  = "Failed to retreive data";
                    resdata.Status = ResponseStatus.Failed;
                    responsedata.Add(resdata);
                }
                repo.Dispose();
            }
            catch (Exception ex)
            {
                FarmDetailResponse resdata = new FarmDetailResponse();
                resdata.Error  = "Failed to retreive data";
                resdata.Status = ResponseStatus.Failed;
                responsedata.Add(resdata);

                AggieGlobalLogManager.Fatal("FarmDetailsController :: GetFarmsDetails failed :: " + ex.Message);
            }
            return(responsedata);
        }
Exemplo n.º 31
0
    protected void InsertFarm(object sender, EventArgs e)
    {
        var farmManager =
            new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
        var farm = farmManager.GetFarmByName(FermaName.Text);

        if (farm != null)
        {
            FarmValidation.Text      = "Ferma " + FermaName.Text + " exista deja!";
            FarmValidation.Visible   = true;
            FarmValidation.ForeColor = Color.Red;
        }
        else
        {
            farm = new FCCL_DAL.Entities.Ferme_CCL
            {
                Cod                = FermaCod.Text,
                CodPostal          = CodPostal.Text,
                Email              = FarmEmail.Text,
                FabricaId          = Convert.ToInt32(Asociatia.SelectedValue),
                Fax                = Fax.Text,
                Ferme              = "F",
                FermierId          = 0,
                Judet              = Judet.SelectedValue,
                JudetId            = Convert.ToInt32(Judet.SelectedValue),
                Nume               = FermaName.Text,
                Numar              = Numar.Text,
                Oras               = Localitate.Text,
                PersoanaDeContact  = PersContact.Text,
                Telefon            = Telefon.Text,
                TelPersoanaContact = TelPersContact.Text,
                Strada             = Strada.Text,
                SendSms            = SendSms.Checked
            };
            var result = farmManager.InsertFarm(farm);
            if (result)
            {
                Response.Redirect("~/EditareFerme.aspx");
            }
            else
            {
                FarmValidation.Text      = "Ferma " + FermaName.Text + " nu poate fi inserata!";
                FarmValidation.Visible   = true;
                FarmValidation.ForeColor = Color.Red;
            }
        }
    }
Exemplo n.º 32
0
        private void FillInventory(FarmManager farmManager)
        {
            foreach (var item in this.inventoryItems)
            {
                farmManager.AddMultipleToInventory(item, 5);
            }

            foreach (var ingredient in this.marketIngredients)
            {
                farmManager.AddMultipleToInventory(ingredient, 5);
            }

            foreach (var present in this.presents)
            {
                farmManager.AddToInventory(present);
            }
        }
Exemplo n.º 33
0
    protected void DeleteFarm(object sender, EventArgs e)
    {
        var farmManager =
            new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
        var result = farmManager.DeleteFarm(IdFerma.Text);

        if (result)
        {
            Response.Redirect("~/EditareFerme.aspx");
        }
        else
        {
            FarmValidation.Text      = "Ferma " + FermaName.Text + " nu poate fi stearsa!";
            FarmValidation.Visible   = true;
            FarmValidation.ForeColor = Color.Red;
        }
    }
Exemplo n.º 34
0
 public void Harvest()
 {
     timer = 0;
     if (tiletype == TileType.GrownCrop)
     {
         FarmManager.player.score += currentCrop.pointReward;
     }
     tiletype = TileType.Plot;
     FarmManager.SetMainTile(position.x, position.y, null);
     FarmManager.player.currCapacity++;
     FarmManager.player.pointReserve += currentCrop.pointReward;
     currentCrop = null;
     if (sparkle != null)
     {
         GameObject.Destroy(sparkle);
     }
 }
Exemplo n.º 35
0
    private void FillGrid()
    {
        var userManager = new UserManager(ctx);
        var allUsers = userManager.GetUsers();

        var farmManager = new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
        var farms = farmManager.GetAllFarmsForDropDown();

        foreach (var user in allUsers)
        {
            var farm = farms.FirstOrDefault(x => x.Cod == user.UserCod);
            if (farm != null)
                user.UserCod = farm.Cod + " - " + farm.Nume;
        }

        lcount.Text = allUsers.Count + " useri";
        UserGrid.DataSource = allUsers;
        UserGrid.DataBind();

    }
Exemplo n.º 36
0
 public static TillSoilJob FindTillSoilJobForSeed(FarmManager farmManager, Character character)
 {
     TillSoilJob tillSoilJob = farmManager.FindTillSoilJob(character);
     if (tillSoilJob == null)
     {
         return null;
     }
     Vector3 position = tillSoilJob.Position;
     Map map = GnomanEmpire.Instance.Map;
     MapCell cell = map.GetCell(position);
     Designation designation = cell.Designation;
     Farm farm = designation as Farm;
     if (farm != null)
     {
         int seedMaterial = farm.SeedMaterial;
         StockManager stockManager = GnomanEmpire.Instance.Fortress.StockManager;
         if (stockManager.FindClosestItem(position, ItemID.Seed, seedMaterial) != null)
         {
             return tillSoilJob;
         }
     }
     tillSoilJob.Cancel();
     return null;
 }
Exemplo n.º 37
0
 protected void DeleteFarm(object sender, EventArgs e)
 {
     var farmManager =
            new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
     var result = farmManager.DeleteFarm(IdFerma.Text);
     if (result)
         Response.Redirect("~/EditareFerme.aspx");
     else
     {
         FarmValidation.Text = "Ferma " + FermaName.Text + " nu poate fi stearsa!";
         FarmValidation.Visible = true;
         FarmValidation.ForeColor = Color.Red;
     }
 }
Exemplo n.º 38
0
 protected void UpdateFarm(object sender, EventArgs e)
 {
     var farmManager =
            new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
     var farm = new FCCL_DAL.Entities.Ferme_CCL
     {
         Id = Convert.ToInt32(IdFerma.Text),
         Cod = FermaCod.Text,
         CodPostal = CodPostal.Text,
         Email = FarmEmail.Text,
         FabricaId = Convert.ToInt32(Asociatia.SelectedValue),
         Fax = Fax.Text,
         Ferme = "F",
         FermierId = 0,
         Judet = Judet.SelectedItem.Value,
         JudetId = Convert.ToInt32(Judet.SelectedItem.Value),
         Nume = FermaName.Text,
         Numar = Numar.Text,
         Oras = Localitate.Text,
         PersoanaDeContact = PersContact.Text,
         Telefon = Telefon.Text,
         TelPersoanaContact = TelPersContact.Text,
         Strada = Strada.Text,
         SendSms = SendSms.Checked
     };
     var result = farmManager.UpdateFarm(farm);
     if (result)
         Response.Redirect("~/EditareFerme.aspx");
     else
     {
         FarmValidation.Text = "Ferma " + FermaName.Text + " nu poate fi updatata!";
         FarmValidation.Visible = true;
         FarmValidation.ForeColor = Color.Red;
     }
 }
Exemplo n.º 39
0
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
			FCCL_DAL.Entities.Ferme_CCL farm = null;
			if (Request.Params["ID"] != null)
			{
				var farmManager = new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
				farm = farmManager.GetFarmById(Convert.ToInt32(Request.Params["ID"]));
			}

            var fabricaManager =
               new FactoryManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
            var fabrici = fabricaManager.GetFactories();
            Asociatia.DataSource = fabrici;
			if (farm != null && farm.FabricaId != null)
			{
				Asociatia.SelectedValue = farm.FabricaId.ToString();
			}
            Asociatia.DataBind();

            var countyManager =
                new CountyManager(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
            var counties = countyManager.GetAllCounties();
            Judet.DataSource = counties;
			if (farm != null && farm.JudetId != null)
			{
				Judet.SelectedValue = farm.JudetId.ToString();
			}
            Judet.DataBind();

            InsertF.Visible = true;

			if (farm != null)
			{
				//populate farm table
				IdFerma.Text = farm.Id.ToString();
				FermaCod.Text = farm.Cod;
				FermaName.Text = farm.Nume;
				FarmEmail.Text = farm.Email;
				Localitate.Text = farm.Oras;
				Strada.Text = farm.Strada;
				Numar.Text = farm.Numar;
				CodPostal.Text = farm.CodPostal;
				Telefon.Text = farm.Telefon;
				Fax.Text = farm.Fax;
				PersContact.Text = farm.PersoanaDeContact;
				TelPersContact.Text = farm.TelPersoanaContact;
				SendSms.Checked = farm.SendSms;

				//populate user table
				var userManager =
					new UserManager(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
				var userInfo = userManager.GetUserInformationByCod(farm.Cod);
				if (userInfo != null)
				{
					UserId.Value = userInfo.UserId.ToString();
					Nume.Text = userInfo.LastName;
					Prenume.Text = userInfo.FirstName;
					UserNameLbl.Text = userInfo.UserName;
					Email.Text = userInfo.Email;
					Update.Visible = true;
					ResetareParola.Visible = true;
					UserNameLbl.Visible = true;
					Parola.Visible = false;
				}
				else
				{
					Insert.Visible = true;
					UserName.Visible = true;
				}
				UserCodLbl.Text = farm.Cod;
				UpdateF.Visible = true;
				DeleteF.Visible = true;
			}
        }
    }
Exemplo n.º 40
0
 public static List<string> AutocompleteCode(string code)
 {
     var farmManager =
        new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
     return farmManager.GetCodesForAutocomplete(code);
 }
Exemplo n.º 41
0
 public static List<string> AutocompleteFarms(string farmName)
 {
     var farmManager =
                        new FarmManager(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString);
     return farmManager.GetFarmsForAutocomplete(farmName);
 }