public async void OnSuccess(ZTask task)
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Debug.WriteLine("success", RefreshData);

                RefreshData?.Invoke(task);
            });
        }
Exemple #2
0
        private void BtnUsun_Click(object sender, RoutedEventArgs e)
        {
            var Res = MessageBox.Show("Usunąć ?", "Usuwanie pozycji", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

            if (Res == MessageBoxResult.Yes)
            {
                var zp = this.grdZlecenie.DataContext as zlecenia_produkcyjne;
                frmZlecenieProdukcji_db.UsunZlecenie(zp);
                RefreshData?.Invoke();
            }
        }
Exemple #3
0
        private void BtnPopraw_Click(object sender, RoutedEventArgs e)
        {
            frmZlecenieProdukcji frmZlecenieProdukcji = new frmZlecenieProdukcji(this.grdZlecenie.DataContext as zlecenia_produkcyjne);

            frmZlecenieProdukcji.ShowDialog();
            //if (frmZlecenieProdukcji.DialogResult.HasValue && frmZlecenieProdukcji.DialogResult.Value)
            //    RefreshData?.Invoke();
            //;
            RefreshData?.Invoke();
            //this.grdZlecenie.DataContext;
        }
Exemple #4
0
        private void refreshTimer_Tick(object sender, EventArgs e)
        {
            levelName = EngineFunctions.GetCurrentLevelName.Call();
            if (levelName != previousLevelName)
            {
                LevelChanged?.Invoke(levelName);
                previousLevelName   = levelName;
                levelNameLabel.Text = levelName;
            }

            RefreshData?.Invoke();
        }
Exemple #5
0
    private void setCheckedCategory()
    {
        List <SRL_RecipeCategory> list = new List <SRL_RecipeCategory>();

        foreach (TreeNode node in tvCategories.CheckedNodes)
        {
            SRL_RecipeCategory recipeCat = new SRL_RecipeCategory(RecipeId, int.Parse(node.Value), node.Text);
            list.Add(recipeCat);
        }
        RecipeCategories = list.ToArray();

        if (RefreshData != null)
        {
            RefreshData.Invoke(RecipeCategories);
        }
    }
Exemple #6
0
 public void RaiseRefreshData()
 {
     RefreshData?.Invoke(this, new EventArgs());
 }
Exemple #7
0
 private void _client_SendContent(object sender, string e)
 {
     RefreshData?.Invoke(this, e);
 }
Exemple #8
0
 public void FireRefreshData()
 {
     RefreshData?.Invoke(this, EventArgs.Empty);
 }
Exemple #9
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Logger.Write("btnSave_Click -> Start", Logger.Level.Info);
        try
        {
            Page.Validate("general");
            if (!Page.IsValid)
            {
                return;
            }

            Recipe recipe;
            bool   isNewRecipe = false;

            if (RecipeId == 0)
            {
                recipe      = new Recipe();
                isNewRecipe = true;
            }
            else
            {
                recipe = BusinessFacade.Instance.GetRecipe(RecipeId);
            }

            if (recipe == null)
            {
                return; //TODO Exception (record is not exist)
            }

            Logger.Write("btnSave_Click -> Set recipe data", Logger.Level.Info);

            if (fuRecipeImage.HasFile && fuRecipeImage.PostedFile != null && ImageHelper.IsImage(fuRecipeImage.PostedFile.FileName))
            {
                Bitmap bitmap = ImageHelper.ResizeImage(new Bitmap(this.fuRecipeImage.PostedFile.InputStream, false), 300, 231);
                RecipePicture = ImageHelper.GetBitmapBytes(bitmap);
            }

            recipe.RecipeName        = txtRecipeName.Text;
            recipe.IsPublic          = chkPublic.Checked;
            recipe.Description       = txtRecipeDesc.Text;
            recipe.Tags              = txtTags.Text;
            recipe.PreparationMethod = txtPreparationMethod.Text;
            recipe.Remarks           = txtRemarks.Text;
            recipe.Tools             = txtTools.Text;

            if (ddlDifficulty.SelectedValue != "0")
            {
                recipe.DifficultyLevel = int.Parse(ddlDifficulty.SelectedValue);
            }
            else
            {
                recipe.DifficultyLevel = null;
            }

            if (!string.IsNullOrEmpty(txtPrepTime.Text))
            {
                recipe.PreperationTime = GetTimeInMinutes(txtPrepTime.Text, int.Parse(ddlPrepTimeUnits.SelectedValue));
            }
            else
            {
                recipe.PreperationTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtCookTime.Text))
            {
                recipe.CookingTime = this.GetTimeInMinutes(this.txtCookTime.Text, int.Parse(this.ddlCookTimeUnits.SelectedValue));
            }
            else
            {
                recipe.CookingTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtServings.Text))
            {
                recipe.Servings = int.Parse(this.txtServings.Text);
            }
            else
            {
                recipe.Servings = 1;
            }

            recipe.VideoLink = this.txtEmbeddedLink.Text;
            //recipe.Picture = this.RecipePicture;

            if (recipe.UserId == 0)
            {
                recipe.UserId = ((BasePage)Page).UserId;
            }

            int returnedRecipeId;
            if (BusinessFacade.Instance.SaveRecipe(recipe, Ingridiants.ListOfIngediants, RecipeCategories.ToList(), isNewRecipe, out returnedRecipeId))
            {
                if (RefreshData != null)
                {
                    RefreshData.Invoke();
                }
            }

            Logger.Write("btnSave_Click -> End and redirect", Logger.Level.Info);

            RecipeCategories = null;

            if (returnedRecipeId != 0)
            {
                Response.Redirect(string.Format("~/RecipeDetails.aspx?RecipeId={0}", returnedRecipeId));
            }
        }
        catch (Exception ex)
        {
            Logger.Write("Save recipe failed", ex, Logger.Level.Error);
        }
    }
 public void RefreshList(ZTask task)
 {
     RefreshData?.Invoke(task);
     taskOperation = TaskOperation.Modify;
 }
Exemple #11
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Logger.Write("btnSave_Click -> Start", Logger.Level.Info);
        try
        {
            Page.Validate("general");
            if (!Page.IsValid)
            {
                return;
            }

            Recipe recipe;
            if (RecipeId == 0)
            {
                recipe = new Recipe();
            }
            else
            {
                recipe = BusinessFacade.Instance.GetRecipe(this.RecipeId);
            }

            if (recipe == null)
            {
                return; //TODO Exception (record is not exist)
            }

            Logger.Write("btnSave_Click -> Set recipe data", Logger.Level.Info);

            if (fuRecipeImage.HasFile && fuRecipeImage.PostedFile != null && ImageHelper.IsImage(fuRecipeImage.PostedFile.FileName))
            {
                Bitmap bitmap = ImageHelper.ResizeImage(new Bitmap(this.fuRecipeImage.PostedFile.InputStream, false), 300, 231);
                RecipePicture = ImageHelper.GetBitmapBytes(bitmap);
            }

            recipe.RecipeName        = txtRecipeName.Text;
            recipe.IsPublic          = chkPublic.Checked;
            recipe.Description       = txtRecipeDesc.Text;
            recipe.Tags              = txtTags.Text;
            recipe.PreparationMethod = txtPreparationMethod.Text;
            recipe.Remarks           = txtRemarks.Text;
            recipe.Tools             = txtTools.Text;

            if (ddlDifficulty.SelectedValue != "0")
            {
                recipe.DifficultyLevel = int.Parse(ddlDifficulty.SelectedValue);
            }
            else
            {
                recipe.DifficultyLevel = null;
            }

            if (!string.IsNullOrEmpty(txtPrepTime.Text))
            {
                recipe.PreperationTime = GetTimeInMinutes(txtPrepTime.Text, int.Parse(ddlPrepTimeUnits.SelectedValue));
            }
            else
            {
                recipe.PreperationTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtCookTime.Text))
            {
                recipe.CookingTime = this.GetTimeInMinutes(this.txtCookTime.Text, int.Parse(this.ddlCookTimeUnits.SelectedValue));
            }
            else
            {
                recipe.CookingTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtServings.Text))
            {
                recipe.Servings = int.Parse(this.txtServings.Text);
            }
            else
            {
                recipe.Servings = 1;
            }

            recipe.VideoLink = this.txtEmbeddedLink.Text;
            recipe.Picture   = this.RecipePicture;

            if (recipe.UserId == 0)
            {
                recipe.UserId = ((BasePage)Page).UserId;
            }

            Logger.Write("btnSave_Click -> Set recipe categories", Logger.Level.Info);

            recipe.RecipeCategories.Clear();
            foreach (SRL_RecipeCategory rcat in this.RecipeCategories)
            {
                recipe.RecipeCategories.Add(new RecipeCategory(rcat.RecipeId, rcat.CategoryId));
            }

            Logger.Write("btnSave_Click -> Set recipe ingrediants", Logger.Level.Info);

            recipe.Ingredients.Clear();

            int index = 0;
            foreach (SRL_Ingredient item in Ingridiants.ListOfIngediants)
            {
                decimal fraction;
                decimal.TryParse(item.FractionValue, out fraction);

                Ingredient ing = new Ingredient
                {
                    //IngredientId = item.Id,
                    RecipeId          = RecipeId,
                    FoodId            = item.FoodId,
                    FoodName          = item.FoodName,
                    MeasurementUnitId = item.MeasurementUnitId,
                    //Quantity = item.IntQuantity + fraction,
                    Remarks   = item.Remarks,
                    SortOrder = ++index
                };

                recipe.Ingredients.Add(ing);
            }

            Logger.Write("btnSave_Click -> Save recipe", Logger.Level.Info);

            int returnedRecipeId;
            if (BusinessFacade.Instance.SaveRecipe(recipe, out returnedRecipeId))
            {
                if (RefreshData != null)
                {
                    RefreshData.Invoke();
                }
            }

            Logger.Write("btnSave_Click -> End and redirect", Logger.Level.Info);

            RecipeCategories = null;
            Response.Redirect(string.Format("~/RecipeDetails.aspx?RecipeId={0}", returnedRecipeId));
        }
        catch (Exception ex)
        {
            Logger.Write("Save recipe failed", ex, Logger.Level.Error);
        }
    }