Пример #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            Cargar c = new Cargar(table: "caja", type: 1);

            c.LoadComplete += (
                (object s, Objects.FormClosedEventArgsS f) =>
            {
                textBox4.Text = (f.CloseArguments as Array).GetValue(0).ToString();
                textBox1.Text = (f.CloseArguments as Array).GetValue(1).ToString();
                numericUpDown7.Value = int.Parse((f.CloseArguments as Array).GetValue(2).ToString());
                numericUpDown1.Value = decimal.Parse((f.CloseArguments as Array).GetValue(3).ToString());
                numericUpDown2.Value = decimal.Parse((f.CloseArguments as Array).GetValue(4).ToString());
            }
                );
            c.ShowDialog();
        }
Пример #2
0
        private void button15_Click(object sender, EventArgs e)
        {
            Cargar a = new Forms.Cargar("caja", -1);

            a.LoadComplete += (
                (object s, Objects.FormClosedEventArgsS f) =>
            {
                object[] values = f.CloseArguments as object[];
                textBox1.Text = values[0].ToString().PadLeft(3, '0');
                N145.Value = (decimal)values[3] > N145.Maximum ? N145.Maximum : (decimal)values[3] < N145.Minimum ? N145.Minimum : (decimal)values[3];
                N146.Value = (decimal)values[4] > N146.Maximum ? N146.Maximum : (decimal)values[4] < N146.Minimum ? N146.Minimum : (decimal)values[4];
                N147.Value = (decimal)values[5] > N147.Maximum ? N147.Maximum : (decimal)values[5] < N147.Minimum ? N147.Minimum : (decimal)values[5];
                N148.Value = (decimal)values[6] > N148.Maximum ? N148.Maximum : (decimal)values[6] < N148.Minimum ? N148.Minimum : (decimal)values[6];
                N149.Value = (decimal)values[7] > N149.Maximum ? N149.Maximum : (decimal)values[7] < N149.Minimum ? N149.Minimum : (decimal)values[7];
                N150.Value = (decimal)values[8] > N150.Maximum ? N150.Maximum : (decimal)values[8] < N150.Minimum ? N150.Minimum : (decimal)values[8];

                /* Escribir npos
                 * N145.SendKey(Keys.Enter);
                 */

                Tag ta, tb, tc, td;
                Tag tan, tbn, tcn, tdn;

                ta = Module1.TagList.Select(x => x).Where(x => x.Handle == 151).FirstOrDefault();
                tb = Module1.TagList.Select(x => x).Where(x => x.Handle == 152).FirstOrDefault();
                tc = Module1.TagList.Select(x => x).Where(x => x.Handle == 153).FirstOrDefault();
                td = Module1.TagList.Select(x => x).Where(x => x.Handle == 154).FirstOrDefault();
                tan = Module1.TagList.Select(x => x).Where(x => x.Handle == 145).FirstOrDefault();
                tbn = Module1.TagList.Select(x => x).Where(x => x.Handle == 146).FirstOrDefault();
                tcn = Module1.TagList.Select(x => x).Where(x => x.Handle == 147).FirstOrDefault();
                tdn = Module1.TagList.Select(x => x).Where(x => x.Handle == 148).FirstOrDefault();

                switch ((decimal)ta.Value >= (decimal)tan.Value)
                {
                case true:
                    bGOb.PerformClick();
                    bGOc.PerformClick();
                    TagChanged += (Tag t) =>
                    {
                        switch (t.Handle)
                        {
                        case 171:
                            bGOa.PerformClick();
                            break;

                        case 170:
                            bGOd.PerformClick();
                            break;

                        default:
                            break;
                        }
                    };
                    break;

                case false:
                    bGOa.PerformClick();
                    bGOd.PerformClick();
                    TagChanged += (Tag t) =>
                    {
                        switch (t.Handle)
                        {
                        case 172:
                            bGOc.PerformClick();
                            break;

                        case 169:
                            bGOb.PerformClick();
                            break;

                        default:
                            break;
                        }
                    };
                    break;

                default:
                    break;
                }

                //bGOe.PerformClick();
                //bGOf.PerformClick();
            });
            a.ShowDialog();
        }