Beispiel #1
0
        /// <summary>
        /// Executes the action for when a person has been named.
        /// </summary>
        /// <param name="action">The name action containing the name of the user.</param>
        /// <returns>A Task object for this method is asynchronous.</returns>
        private async Task Execute(NameAction action)
        {
            if (sleeping)
            {
                return;
            }

            if (GetClientForCurrentUser().PersonId.Equals(AnonymousPersonId, StringComparison.OrdinalIgnoreCase))
            {
                var personId = await eyes.CreatePerson();

                currentIdentityPersonId = personId.ToString();
                pool.ChangeId(AnonymousPersonId, currentIdentityPersonId);

                var newName = await eyes.UpdatePerson(personId, action.Name);

                await eyes.StoreFaceFor(newName);
            }

            var p = new Profile
            {
                Name = action.Name
            };

            await GetClientForCurrentUser().UpdateProfile(p);

            await voice.Say($"Hi {action.Name}, nice to meet you!");
        }
Beispiel #2
0
        public void Init(NameAction a, List<string> t)
        {
            callback = a;

            foreach (string s in t)
            {
                tagBox.Items.Add(s);
            }

            text.SelectAll();
        }
Beispiel #3
0
        /// <summary>
        /// Updates the profile name and returns a reply.
        /// </summary>
        /// <remarks>While this specific intent handler isn't awaiting any calls, the intent handler always calls his intents asynchronously.</remarks>
        /// <returns>A list of actions for Robbie to execute, based on the current intent.</returns>
#pragma warning disable 1998
        public override async Task <IList <IAction> > HandleIntent()
#pragma warning restore 1998
        {
            const string entityName = "Name";

            var name = string.Empty;

            if (Intent.Entities.ContainsKey(entityName))
            {
                var entities = Intent.Entities;
                var entity   = entities[entityName];
                name = entity[0].Value;
            }

            var action = new NameAction(name);

            Actions.Add(action);
            return(Actions);
        }
        public void ReinsertLines()
        {
            if (Name != null)
            {
                NameAction.SetString(Name.LineText, 0);
            }

            if (PlaceActions.Count > 0)
            {
                for (int i = 0; i < Lines.Count; i++)
                {
                    PlaceActions[i].SetString(Lines[i].LineText, 3);
                }
            }
            else
            {
                for (int i = 0; i < Lines.Count; i++)
                {
                    LineActions[i].SetString(Lines[i].LineText, 0);
                }
            }
        }
Beispiel #5
0
        private bool ActionSave(bool NewAction)
        {
            DataTable ActionList;

            DataRow[] TableRow;
            DataRow   NewRow = null;
            string    NameAction;
            string    NameAction2;
            decimal   Year;
            bool      New_Year = false;


            ActionList = LoadActionTable();

            Year = ((NumericUpDown)MainProgram.Self.TabControl.Controls.Find("num_Action_YearAction", true).First()).Value;

            if (NewAction)
            {
                NameAction = ((TextBox)MainProgram.Self.TabControl.Controls.Find("tb_Name", true).First()).Text;
                NameAction = NameAction.Replace(";", ",");
                bool NameExist = CheckIfActionNameExist(NameAction, ref ActionList);
                if (NameExist)
                {
                    MessageBox.Show("Please change Action Name, current Name Exist in DataBase");
                    return(false);
                }
                else
                {
                    NewRow = ActionList.NewRow();
                }
            }
            else
            {
                NameAction = ((GroupBox)MainProgram.Self.TabControl.Controls.Find("gb_ActiveAction", true).First()).Text;
                NameAction = NameAction.Replace(";", ",");

                NameAction2 = ((TextBox)MainProgram.Self.TabControl.Controls.Find("tb_Name", true).First()).Text;
                NameAction2 = NameAction2.Replace(";", ",");

                TableRow = ActionList.Select(string.Format("Name LIKE '%{0}%'", NameAction)).ToArray();
                foreach (DataRow Row in TableRow.Take(TableRow.Length))
                {
                    if (Row["StartYear"].ToString() == Year.ToString() && Row["Name"].ToString() == NameAction2)
                    {
                        NewRow = Row;
                    }
                    else if (Row["StartYear"].ToString() == (Year - 1).ToString() && Row["Name"].ToString() == NameAction2)
                    {
                        if (Year.ToString() != Row["StartYear"].ToString())
                        {
                            if (GridCheck(decimal.Parse(Row["StartYear"].ToString())))
                            {
                                Row["StartYear"] = "BU/" + Row["StartYear"].ToString();

                                NewRow   = ActionList.NewRow();
                                New_Year = true;
                            }
                            else
                            {
                                NewRow = Row;
                            }
                        }
                        else
                        {
                            NewRow = Row;
                        }
                    }
                    else if (Row["StartYear"].ToString() == (Year + 1).ToString() && Row["Name"].ToString() == NameAction2)
                    {
                        NewRow = Row;
                    }
                }

                if (NewRow == null)
                {
                    if (NameAction != NameAction2)
                    {
                        DialogResult dialogResult = MessageBox.Show("Do you want change Action Name for this Action?", "Change Action Name", MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.No)
                        {
                            MessageBox.Show("Action will be save with Old Name");
                        }
                        else if (dialogResult == DialogResult.Yes)
                        {
                            bool NameExist = CheckIfActionNameExist(NameAction2, ref ActionList);

                            if (NameExist)
                            {
                                MessageBox.Show("Name Exist in Data Base, please change Action Name");
                                return(false);
                            }
                            else
                            {
                                MessageBox.Show("Action will be Save with New Name");
                                TableRow = ActionList.Select(string.Format("Name LIKE '%{0}%'", NameAction)).ToArray();


                                foreach (DataRow Row in TableRow.Take(TableRow.Length))
                                {
                                    if (Row["StartYear"].ToString() == Year.ToString() && Row["Name"].ToString() == NameAction)
                                    {
                                        NewRow = Row;
                                    }
                                    else if (Row["StartYear"].ToString() == (Year - 1).ToString() && Row["Name"].ToString() == NameAction)
                                    {
                                        NewRow = Row;
                                    }
                                }
                                NameAction = NameAction2;
                                ((GroupBox)MainProgram.Self.TabControl.Controls.Find("gb_ActiveAction", true).First()).Text = NameAction2;
                            }
                        }
                    }
                }
            }


            NewRow["Name"] = NameAction;

            NewRow["Description"] = ActionDescription();

            NewRow["Group"]  = ((ComboBox)MainProgram.Self.TabControl.Controls.Find("comBox_Devision", true).First()).Text;
            NewRow["Leader"] = ((ComboBox)MainProgram.Self.TabControl.Controls.Find("comBox_Leader", true).First()).Text;

            NewRow["Status"] = Active_Idea_Action();

            NewRow["Factory"] = ((ComboBox)MainProgram.Self.TabControl.Controls.Find("comBox_Factory", true).First()).Text;


            NewRow["StartYear"]  = Year.ToString();
            NewRow["StartMonth"] = ((ComboBox)MainProgram.Self.TabControl.Controls.Find("comBox_Month", true).First()).Text;

            //ClearDataforUse(((ComboBox)MainProgram.Self.TabControl.Controls.Find("comBox_Month", true).First()).Text);

            NewRow["Platform"] = Platform();

            NewRow["Installation"] = Installation();

            if (((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_CalcANC", true).First()).Checked)
            {
                NewRow["Calculate"] = "ANC";
                ANCSave(ref NewRow);
            }
            else if (((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_CalcANCby", true).First()).Checked)
            {
                NewRow["Calculate"] = "ANCSpec";
                ANCSave(ref NewRow);
                NewRow["Calc"]     = ANCCalcby();
                NewRow["CalcMass"] = ANCCalcbyMass();
            }
            else if (((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_CalcPNC", true).First()).Checked)
            {
                NewRow["Calculate"] = "PNC";
                ANCSave(ref NewRow);
                NewRow["PNC"] = PNCReader();
            }
            else if (((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_CalcPNCSpec", true).First()).Checked)
            {
                NewRow["Calculate"] = "PNCSpec";
                ANCSave(ref NewRow);
                PNCSpecReader(ref NewRow);
                NewRow["PNCEstyma"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("TB_EstymacjaPNC", true).First()).Text;
            }

            NewRow["PNCANCPersent"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("TB_PercentANCPNC", true).First()).Text;

            NewRow["ECCC"] = ECCCReader(NewRow["ECCC"].ToString());

            string[] GridValue;

            //Quantity
            DataGridView Grid = (DataGridView)MainProgram.Self.TabControl.Controls.Find("dg_Quantity", true).First();

            GridValue = GridReader(Grid);
            GridSave(ref NewRow, GridValue, "Quantity", Year);

            //Saving
            Grid      = (DataGridView)MainProgram.Self.TabControl.Controls.Find("dg_Saving", true).First();
            GridValue = GridReader(Grid);
            GridSave(ref NewRow, GridValue, "Saving", Year);

            //ECCC
            Grid      = (DataGridView)MainProgram.Self.TabControl.Controls.Find("dg_ECCC", true).First();
            GridValue = GridReader(Grid);
            GridSave(ref NewRow, GridValue, "ECCC", Year);

            //Sprawdzenie czy to jest Akcja dodatnia czy ujemna
            PozitiveOrNegative(ref NewRow);

            //Sprawdzenie czy jakiś Calc jest nie wpisany - jak nie jest to ma zamienić na same "//////////////"
            IfEmptyCalc(ref NewRow);

            //Dodanie IDCO do pliku
            IDCOAdd(ref NewRow);

            //Zapis kalkulacji poszczególych ANC?PNC
            if (!New_Year)
            {
                PerANC_PNC(ref NewRow, Year);
            }

            //Jesli zmienił się rok to ma do gridów wpisać puste warości
            if (New_Year)
            {
                Calc_Clear(ref NewRow, "Quantity");
                Calc_Clear(ref NewRow, "Saving");
                Calc_Clear(ref NewRow, "ECCC");
                Grid = (DataGridView)MainProgram.Self.TabControl.Controls.Find("dg_Quantity", true).First();
                Grid_Clear(Grid);
                Grid = (DataGridView)MainProgram.Self.TabControl.Controls.Find("dg_Saving", true).First();
                Grid_Clear(Grid);
                Grid = (DataGridView)MainProgram.Self.TabControl.Controls.Find("dg_ECCC", true).First();
                Grid_Clear(Grid);
                //NewRow["IDCO"] = "";
            }


            //Jeśli to była nowa akcja to dodaje wiersz
            if (NewAction || New_Year)
            {
                ActionList.Rows.Add(NewRow);
            }


            //Zapis do pliku
            Data_Import.Singleton().Save_DataTableToTXT2(ref ActionList, "Action");

            return(true);
        }