Exemple #1
0
        private void ANC_TextChange(object sender, EventArgs e)
        {
            (sender as TextBox).Text.Replace('a', 'A');

            if ((sender as TextBox).Text.Length < 9)
            {
                (sender as TextBox).ForeColor = Color.Red;
                if (OldANCList.Contains(sender as TextBox))
                {
                    _ = new FindSTK(OldANCList.IndexOf(sender as TextBox), "Old", string.Empty, 0);
                }
                else if (NewANCList.Contains(sender as TextBox))
                {
                    _ = new FindSTK(NewANCList.IndexOf(sender as TextBox), "New", string.Empty, 0);
                }
            }
            else if ((sender as TextBox).Text.Length == 9)
            {
                (sender as TextBox).ForeColor = Color.Black;
                if (OldANCList.Contains(sender as TextBox))
                {
                    if (OldANCQList[OldANCList.IndexOf(sender as TextBox)].Text == "0")
                    {
                        OldANCQList[OldANCList.IndexOf(sender as TextBox)].Text = "1";
                    }

                    _ = new FindSTK(OldANCList.IndexOf(sender as TextBox), "Old", (sender as TextBox).Text, Convert.ToDouble(OldANCQList[OldANCList.IndexOf(sender as TextBox)].Text));
                }
                else if (NewANCList.Contains(sender as TextBox))
                {
                    if (NewANCQList[NewANCList.IndexOf(sender as TextBox)].Text == "0")
                    {
                        NewANCQList[NewANCList.IndexOf(sender as TextBox)].Text = "1";
                    }

                    _ = new FindSTK(NewANCList.IndexOf(sender as TextBox), "New", (sender as TextBox).Text, Convert.ToDouble(NewANCQList[NewANCList.IndexOf(sender as TextBox)].Text));
                }
            }
            ChecIFIsPermisionToSave();
            ActionID.Singleton.ANCModification = true;
        }
Exemple #2
0
        private void Quantity_Leave(object sender, EventArgs e)
        {
            if ((sender as TextBox).Text.Length == 0)
            {
                if ((sender as TextBox).Name[3] == 'O')
                {
                    int Number = OldANCQList.IndexOf(sender as TextBox);
                    if (OldANCList[Number].Text != string.Empty)
                    {
                        (sender as TextBox).Text = "1";
                    }
                    else
                    {
                        (sender as TextBox).Text = "0";
                    }
                    _ = new FindSTK(Number, "Old", OldANCList[Number].Text, Convert.ToDouble((sender as TextBox).Text));
                }
                else if ((sender as TextBox).Name[3] == 'N')
                {
                    int Number = NewANCQList.IndexOf(sender as TextBox);
                    if (NewANCList[Number].Text != string.Empty)
                    {
                        (sender as TextBox).Text = "1";
                    }
                    else
                    {
                        (sender as TextBox).Text = "0";
                    }
                    _ = new FindSTK(Number, "New", NewANCList[Number].Text, Convert.ToDouble((sender as TextBox).Text));
                }
            }
            else
            {
                if ((sender as TextBox).Text[0] == ',')
                {
                    (sender as TextBox).Text = "0" + (sender as TextBox).Text;
                }

                int Number;
                if ((sender as TextBox).Name[3] == 'O')
                {
                    Number = OldANCQList.IndexOf(sender as TextBox);

                    if ((sender as TextBox).Text == "0" && OldANCList[Number].Text.Length == 9)
                    {
                        (sender as TextBox).Text = "1";
                    }
                    else if ((sender as TextBox).Text != "0" && OldANCList[Number].Text.Length == 0)
                    {
                        (sender as TextBox).Text = "0";
                    }
                }
                else
                {
                    Number = NewANCQList.IndexOf(sender as TextBox);

                    if ((sender as TextBox).Text == "0" && NewANCList[Number].Text.Length == 9)
                    {
                        (sender as TextBox).Text = "1";
                    }
                    else if ((sender as TextBox).Text != "0" && NewANCList[Number].Text.Length == 0)
                    {
                        (sender as TextBox).Text = "0";
                    }
                }

                double Value = Convert.ToDouble((sender as TextBox).Text);
                if (Value > 100)
                {
                    Value = 100;
                }
                (sender as TextBox).Text = Math.Round(Value, 3, MidpointRounding.AwayFromZero).ToString();

                if ((sender as TextBox).Name[3] == 'O')
                {
                    _ = new FindSTK(Number, "Old", OldANCList[Number].Text, Convert.ToDouble((sender as TextBox).Text));
                }
                else if ((sender as TextBox).Name[3] == 'N')
                {
                    _ = new FindSTK(Number, "New", NewANCList[Number].Text, Convert.ToDouble((sender as TextBox).Text));
                }
            }
        }