Ejemplo n.º 1
0
        private void MakeOrderButton_Click(object sender, EventArgs e)
        {
            try {
                var      result = Microsoft.VisualBasic.Interaction.InputBox("F&&V", "Enter the quantity", "1", -1, -1);
                string[] values = new string[8];
                //
                values[4] = DateTime.Today.ToShortDateString();
                values[1] = servConn.GetCurrentUser();
                values[0] = servConn.FindIdByName(goodsName).ToString();
                values[6] = result;
                Random rand = new Random();
                values[2] = "1";
                values[3] = rand.Next(10, 100).ToString();
                values[5] = "1";
                values[7] = "";


                List <string> attributes = new List <string>();
                attributes = servConn.GetAttributesTable("FV_Order").ToList();
                attributes.RemoveAt(0);

                servConn.InsertInto("FV_Order", values, attributes.ToArray());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        public static void СreateNewEntry(SQLServerConnect servConn, GroupBox gb, string tableName, int attributesCount)
        {
            string[] values     = new string[attributesCount];
            string[] attributes = new string[attributesCount];

            int i = 0;

            foreach (TextBox tb in gb.Controls.Cast <Control>().Where(x => x is TextBox).Select(x => x as TextBox))
            {
                values[i]     = tb.Text;
                attributes[i] = tb.Tag.ToString();
                i++;
            }
            servConn.InsertInto(tableName, values, attributes);
        }