コード例 #1
0
        public void InsertRecordsToCouterparty(string sProductStr, float sPrice, float sCount, float sSumm, string sDateStr)
        {
            General.Command = new SqlCommand(String.Format("insert into {0}(Продукт, Цена, Количество, Сумма, Дата) values(@name, @price, @count, @summ, @date)", Recipient), General.Connection);
            General.Connection.Open();
            General.Command.Parameters.AddWithValue("@name", sProductStr);
            General.Command.Parameters.AddWithValue("@price", sPrice);
            General.Command.Parameters.AddWithValue("@count", sCount);
            General.Command.Parameters.AddWithValue("@summ", sSumm);
            General.Command.Parameters.AddWithValue("@date", sDateStr);
            General.Command.ExecuteNonQuery();
            General.Connection.Close();

            General.DebtManager(Convert.ToInt32(sSumm), true, Recipient);
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (List.SelectedItem != null)
            {
                StreamWriter StreamW = new StreamWriter(Application.StartupPath + "//ReList//" + List.SelectedItem.ToString(), true, Encoding.UTF8);
                StreamW.WriteLine(NameTextBox.Text);

                StreamW.Flush();
                StreamW.Close();
                General.DebtManager(0, false, NameTextBox.Text);
            }

            if (File.Exists(Application.StartupPath + "//ReList//" + List.SelectedItem.ToString()))
            {
                string[] ClientsContent = File.ReadAllLines(Application.StartupPath + "//ReList//" + List.SelectedItem.ToString());
                ClientList.Items.Clear();
                if (ClientsContent != null)
                {
                    ClientList.Items.AddRange(ClientsContent);
                }
            }
        }
コード例 #3
0
        public void InsertRecords()
        {
            if (InsertRecordsBoolean)
            {
                //int RowsCountID = 0;
                //RowsCountID = General.GetRowsCount(LoadString);
                //RowsCountID += 1;
                General.Command = new SqlCommand(String.Format("insert into {0}(Продукт, Цена, Количество, Сумма, Дата) values(@name, @price, @count, @summ, @date)", LoadString), General.Connection);
                General.Connection.Open();
                //General.Command.Parameters.AddWithValue("@id", RowsCountID);
                General.Command.Parameters.AddWithValue("@name", ProductName);
                General.Command.Parameters.AddWithValue("@price", PriceString);
                General.Command.Parameters.AddWithValue("@count", CountString);
                General.Command.Parameters.AddWithValue("@summ", SumString);
                General.Command.Parameters.AddWithValue("@date", Date);
                General.Command.ExecuteNonQuery();
                General.Connection.Close();
                General.LoadSQLData(LoadString, AccountTable);
                RowID = null;

                General.DebtManager(Convert.ToInt32(SumString), true, LoadString);
            }
        }
コード例 #4
0
        private void UpdateData()
        {
            string SelectedDate = DateTimePicker.Text;

            switch (tname)
            {
            case "CashData":
            {
                float val = float.Parse(textBox3.Text.Replace(".", ","));
                General.UpdateCellData(tname, "Поставщик", textBox1.Text, id);
                General.UpdateCellData(tname, "Должен", textBox2.Text, id);
                General.UpdateCellData(tname, "Оплаченно", textBox3.Text, id);
                General.UpdateCellData(tname, "Осталось", textBox4.Text, id);
                General.UpdateCellData(tname, "Бонус", textBox5.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
                if (val != 0)
                {
                    if (val > 0)
                    {
                        General.DebtManager(val, true, textBox1.Text);
                    }
                    else if (val < 0)
                    {
                        General.DebtManager(val, false, textBox1.Text);
                    }
                }
            }
            break;

            case "CounterpartyData":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Цена", textBox2.Text, id);
                General.UpdateCellData(tname, "Количество", textBox3.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox4.Text, id);
                General.UpdateCellData(tname, "Контрагент", textBox5.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "ConculationData":
            {
                General.UpdateCellData(tname, "Название", textBox1.Text, id);
            }
            break;

            case "ExpenseFirm":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Покупка", textBox2.Text, id);
                General.UpdateCellData(tname, "Сумма", textBox3.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "ExpenseFood":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Сумма", textBox2.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "ExpenseFuel":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Сумма", textBox2.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "ExpenseWorker":
            {
                General.UpdateCellData(tname, "ФИО", textBox1.Text, id);
                General.UpdateCellData(tname, "Зарплата", textBox2.Text, id);
                General.UpdateCellData(tname, "Аванс", textBox3.Text, id);
                General.UpdateCellData(tname, "Остаток", textBox4.Text, id);
                General.UpdateCellData(tname, "Общий", textBox5.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "RawMaterials":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Масса", textBox2.Text, id);
                General.UpdateCellData(tname, "Цена", textBox3.Text, id);
                General.UpdateCellData(tname, "Количество", textBox4.Text, id);
                General.UpdateCellData(tname, "КоличествоКаробок", textBox5.Text, id);
                General.UpdateCellData(tname, "Сумма", textBox6.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox7.Text, id);
                General.UpdateCellData(tname, "Получатель", textBox8.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "RawMaterialsResidue":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Масса", textBox2.Text, id);
                General.UpdateCellData(tname, "Цена", textBox3.Text, id);
                General.UpdateCellData(tname, "Количество", textBox4.Text, id);
                General.UpdateCellData(tname, "КоличествоКаробок", textBox5.Text, id);
                General.UpdateCellData(tname, "Сумма", textBox6.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox7.Text, id);
                General.UpdateCellData(tname, "Получатель", textBox8.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "RemovedRawMaterials":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Масса", textBox2.Text, id);
                General.UpdateCellData(tname, "Цена", textBox3.Text, id);
                General.UpdateCellData(tname, "Количество", textBox4.Text, id);
                General.UpdateCellData(tname, "КоличествоКаробок", textBox5.Text, id);
                General.UpdateCellData(tname, "Сумма", textBox6.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox7.Text, id);
                General.UpdateCellData(tname, "Получатель", textBox8.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "ResidueShopMaterials":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Масса", textBox2.Text, id);
                General.UpdateCellData(tname, "Цена", textBox3.Text, id);
                General.UpdateCellData(tname, "Количество", textBox4.Text, id);
                General.UpdateCellData(tname, "КоличествоКаробок", textBox5.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox6.Text, id);
                General.UpdateCellData(tname, "Получатель", textBox7.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "SaledShopMaterials":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Масса", textBox2.Text, id);
                General.UpdateCellData(tname, "Цена", textBox3.Text, id);
                General.UpdateCellData(tname, "Количество", textBox4.Text, id);
                General.UpdateCellData(tname, "КоличествоКаробок", textBox5.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox6.Text, id);
                General.UpdateCellData(tname, "Получатель", textBox7.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "ShopMaterials":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Масса", textBox2.Text, id);
                General.UpdateCellData(tname, "Цена", textBox3.Text, id);
                General.UpdateCellData(tname, "Количество", textBox4.Text, id);
                General.UpdateCellData(tname, "КоличествоКаробок", textBox5.Text, id);
                General.UpdateCellData(tname, "Поставщик", textBox6.Text, id);
                General.UpdateCellData(tname, "Получатель", textBox7.Text, id);
                General.UpdateCellData(tname, "Дата", SelectedDate, id);
            }
            break;

            case "WorkersTable":
            {
                General.UpdateCellData(tname, "Имя", textBox1.Text, id);
                General.UpdateCellData(tname, "Фамилия", textBox2.Text, id);
                General.UpdateCellData(tname, "Отчество", textBox3.Text, id);
                General.UpdateCellData(tname, "Возраст", textBox4.Text, id);
                General.UpdateCellData(tname, "Должность", textBox5.Text, id);
            }
            break;

            default:
                General.ShowErrorBox("WRONG TABLE NAME!!!");
                this.Close();
                break;
            }
        }