private void btnNew_Click(object sender, EventArgs e) { if (tbCustomer.Text != "") { InvoiceNumber = Invoice_DbCommunication.GetInvoiceNumber(); InvoiceCounter++; Invoice_DbCommunication.AddInvoice(Customer_DbCommunication.GetCustomerDBID(CustomerPick.selectecCustomerInfo.Name), InvoiceCounter, mtbDate.Text, tbValuta.Text, cbDocType.SelectedItem.ToString(), tbDescription.Text); dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery); ResetBoxes(); SetInvoiceNumberTextBox(); } else { MessageBox.Show ( "Одберете купувач (F1).", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
private void dgvCustomers_CellClick(object sender, DataGridViewCellEventArgs e) { // If a valid row is selected If the last row is not selected (because it's empty) if (e.RowIndex != -1 && e.RowIndex != dgvCustomers.Rows.Count - 1) { string TaxNum = dgvCustomers.Rows[e.RowIndex].Cells[1].Value.ToString(); string query = $"SELECT * FROM Customers WHERE Даночен_број='{TaxNum}'"; DataTable dt = DbCommunication.DisplayData(query); tbName.Text = dt.Rows[0].ItemArray[1].ToString(); tbTaxNum.Text = dt.Rows[0].ItemArray[2].ToString(); tbEMBS.Text = dt.Rows[0].ItemArray[3].ToString(); tbBankNum1.Text = dt.Rows[0].ItemArray[4].ToString(); tbBankNum2.Text = dt.Rows[0].ItemArray[5].ToString(); cbBank.SelectedIndex = cbBank.FindString(dt.Rows[0].ItemArray[6].ToString()); tbAddress.Text = dt.Rows[0].ItemArray[7].ToString(); tbContactPerson1.Text = dt.Rows[0].ItemArray[8].ToString(); tbContactPerson2.Text = dt.Rows[0].ItemArray[9].ToString(); tbPhone1.Text = dt.Rows[0].ItemArray[10].ToString(); tbPhone2.Text = dt.Rows[0].ItemArray[11].ToString(); tbEmail.Text = dt.Rows[0].ItemArray[12].ToString(); tbCity.Text = dt.Rows[0].ItemArray[13].ToString(); tbZipCode.Text = dt.Rows[0].ItemArray[14].ToString(); tbDescription.Text = dt.Rows[0].ItemArray[15].ToString(); Customer.SetCustomer(tbName.Text, tbTaxNum.Text, tbEMBS.Text, tbBankNum1.Text, tbBankNum2.Text, cbBank.SelectedItem.ToString(), tbAddress.Text, tbCity.Text, tbZipCode.Text, tbContactPerson1.Text, tbContactPerson2.Text, tbPhone1.Text, tbPhone2.Text, tbEmail.Text, tbDescription.Text); } else { ClearTextBoxes(); } }
private void btnDelete_Click(object sender, EventArgs e) { if (DbCommunication.Exists("Products", "Шифра", mtbCode.Text) == 1) { DbCommunication.Delete("Products", "Шифра", mtbCode.Text); UpdateTable(); MessageBox.Show ( "Артиклот е успешно избришан!", "Избриши", MessageBoxButtons.OK, MessageBoxIcon.Information ); } else { MessageBox.Show ( "Тој артикл не постои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
private void dgvProducts_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { string Code = dgvProducts.Rows[e.RowIndex].Cells[0].Value.ToString(); //SQLiteCommand cmd = new SQLiteCommand($"SELECT * FROM Products WHERE Шифра='{Code}'", connection); DataTable dt = DbCommunication.DisplayData($"SELECT * FROM Products WHERE Шифра='{Code}'"); /* connection.Open(); * * DataTable dt = new DataTable(); * SQLiteDataAdapter adapter = new SQLiteDataAdapter(cmd); * adapter.Fill(dt);*/ item.Code = dt.Rows[0].ItemArray[1].ToString(); item.Name = dt.Rows[0].ItemArray[2].ToString(); item.Unit = dt.Rows[0].ItemArray[3].ToString(); item.Tax = decimal.Parse(dt.Rows[0].ItemArray[4].ToString()); if (dt.Rows[0].ItemArray[7].ToString() != "") // Цената на артиклот земена од база { item.Price = decimal.Parse(dt.Rows[0].ItemArray[7].ToString()); } if (dt.Rows[0].ItemArray[11].ToString() != "") // Залихата на артиклот земена од база { item.Quantity = 1; } //connection.Close(); this.Close(); } }
private void btnDelete_Click(object sender, EventArgs e) { if (DbCommunication.Exists("Customers", "Даночен_број", tbTaxNum.Text) == 1) { DbCommunication.Delete("Customers", "Даночен_број", tbTaxNum.Text); UpdateTable(); MessageBox.Show ( "Коминтентот е успешно избришан!", "Избриши", MessageBoxButtons.OK, MessageBoxIcon.Information ); } else { MessageBox.Show ( "Тој коминтент не постои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
private void btnDelete_Click(object sender, EventArgs e) { if (DbCommunication.Exists("Employees", "ЕМБГ", mtbEMBG.Text) == 1) { DbCommunication.Delete("Employees", "ЕМБГ", mtbEMBG.Text); UpdateTable(); MessageBox.Show ( "Вработениот е успешно избришан!", "Избриши", MessageBoxButtons.OK, MessageBoxIcon.Information ); } else { MessageBox.Show ( "Toj вработен не постои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
private void btnDelete_Click(object sender, EventArgs e) { if ((DbCommunication.Exists("Invoices", "InvNumber", InvoiceNumber.ToString()) == 1) && (InvoiceNumber == InvoiceCounter)) { DbCommunication.Delete("Invoices", "InvNumber", InvoiceNumber.ToString()); DbCommunication.Delete("InvoiceItems", "Invoice_ID", InvoiceNumber.ToString()); dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery); InvoiceNumber = Invoice_DbCommunication.GetInvoiceNumber(); InvoiceCounter = InvoiceNumber; MessageBox.Show ( "Фактурата е успешно избришана!", "Избриши", MessageBoxButtons.OK, MessageBoxIcon.Information ); } else { MessageBox.Show ( "Таа фактура не може да се избрише!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
private void btnSave_Click(object sender, EventArgs e) { if (tbTaxNum.Text == "" || tbAddress.Text == "" || tbCity.Text == "" || tbName.Text == "") { errorProviderTaxNum.SetError(tbTaxNum, "Задолжително внесете даночен број"); errorProviderAddress.SetError(tbAddress, "Задолжително внесете адреса и град"); errorProviderName.SetError(tbName, "Задолжително внесете назив на коминтент"); } else { errorProviderTaxNum.SetError(tbTaxNum, null); if (DbCommunication.Exists("Customers", "Даночен_број", tbTaxNum.Text) < 1) { Customer_DbCommunication.AddCustomer ( tbName.Text, tbTaxNum.Text, tbEMBS.Text, tbBankNum1.Text, tbBankNum2.Text, cbBank.GetItemText(cbBank.SelectedItem), tbAddress.Text, tbCity.Text, tbZipCode.Text, tbContactPerson1.Text, tbContactPerson2.Text, tbPhone1.Text, tbPhone2.Text, tbEmail.Text, tbDescription.Text ); UpdateTable(); MessageBox.Show ( "Коминтентот е успешно додаден!", "Сними", MessageBoxButtons.OK, MessageBoxIcon.Information ); } else { MessageBox.Show ( "Тој коминтент веќе постои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } }
private void OutgoingInvoices_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; selectedCustomer = new CustomerInfo(); InitDefaultSettings(); InvoiceNumber = Invoice_DbCommunication.GetInvoiceNumber(); InvoiceCounter = InvoiceNumber; SetInvoiceNumberTextBox(); dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery); }
private void btnDelete_Click(object sender, EventArgs e) { if (dgvInvoiceItems.SelectedCells.Count == 1) { if (InvoiceItems_DbCommunication.Exists("Invoice_ID", selectedItemID, "Item_ID", tbCode.Text) == 1) { InvoiceItems_DbCommunication.Delete("Invoice_ID", selectedItemID, "Item_ID", tbCode.Text); dgvInvoiceItems.DataSource = DbCommunication.DisplayData(SearchQuery); ClearTextBoxes(); } } }
private void btnInvoiceItems_Click(object sender, EventArgs e) { if (dgvInvoices.SelectedCells.Count == 1) { Form invoiceItems = new InvoiceItems(); if (invoiceItems.ShowDialog() == DialogResult.Cancel) { SetPriceSumTextBoxes(); Invoice_DbCommunication.SetPricesForInvoice(decimal.Parse(tbPriceWithoutTax.Text), decimal.Parse(tbTax.Text), decimal.Parse(tbTotalPrice.Text), InvoiceNumber); dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery); } } else { MessageBox.Show("Одберете фактура.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dgvInvoiceItems.SelectedCells.Count == 1) { InvoiceItems_DbCommunication.EditInvoiceItem(OutgoingInvoices.InvoiceNumber, tbCode.Text, decimal.Parse(tbQuantity.Text), decimal.Parse(tbPrice.Text)); MessageBox.Show ( "Артиклот е успешно променет!", "Промени", MessageBoxButtons.OK, MessageBoxIcon.Information ); dgvInvoiceItems.DataSource = DbCommunication.DisplayData(SearchQuery); } }
private void btnSave_Click(object sender, EventArgs e) { if (tbName.Text == "" || tbLastname.Text == "" || mtbEMBG.Text.Length < 13 || mtbPhone.Text.Length < 11 || tbIdNumber.Text.Length < 8) { errorProviderEMBG.SetError(mtbEMBG, "Полето за ЕМБГ е задолжително"); errorProviderName.SetError(tbName, "Полето за Име е задолжително"); errorProviderLastname.SetError(tbLastname, "Полето за Презиме е задолжително"); errorProviderPhone.SetError(mtbPhone, "Полето за Телефон е задолжително"); errorProviderIdNumber.SetError(tbIdNumber, "Полето за Број на Лична Карта е задолжително"); } else { if (DbCommunication.Exists("Employees", "ЕМБГ", mtbEMBG.Text) < 1) { string Start = dtpStart.Value.ToString("HH:mm:ss - dd MMM, yyyy"); Employee_DbCommunication.AddEmployee(tbName.Text, tbLastname.Text, mtbEMBG.Text, tbSalary.Text, Start, tbAddress.Text, tbPosition.Text, tbIdNumber.Text, mtbPhone.Text, tbBank.Text, mtbBankNumber.Text, rtbNote.Text); UpdateTable(); MessageBox.Show ( "Вработениот е успешно додаден!", "Сними", MessageBoxButtons.OK, MessageBoxIcon.Information ); errorProviderEMBG.Clear(); errorProviderName.Clear(); errorProviderLastname.Clear(); errorProviderPhone.Clear(); errorProviderIdNumber.Clear(); } else { MessageBox.Show ( "Тој вработен веќе постои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } }
private void dgvInvoices_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != dgvInvoices.Rows.Count - 1 && e.RowIndex != -1) { InvoiceNumber = int.Parse(dgvInvoices.Rows[e.RowIndex].Cells[2].Value.ToString().Substring(0, 5)); string customerName = dgvInvoices.Rows[e.RowIndex].Cells[0].Value.ToString(); DataTable dt = Invoice_DbCommunication.DisplayCustomerData(customerName); selectedCustomer.Name = dt.Rows[0].ItemArray[0].ToString(); selectedCustomer.Address = dt.Rows[0].ItemArray[1].ToString(); selectedCustomer.City = dt.Rows[0].ItemArray[2].ToString(); tbCustomer.Text = selectedCustomer.Name; SetInvoiceNumberTextBox(); SetPriceSumTextBoxes(); dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery); } }
private void btnSave_Click(object sender, EventArgs e) { if (mtbCode.Text == "" || tbProductName.Text == "" || cbUnit.SelectedIndex == -1 || cbTaxGroup.SelectedIndex == -1) { errorProviderCode.SetError(mtbCode, "Полето за шифра е задолжително"); errorProviderProduct.SetError(tbProductName, "Полето за назив на артиклот е задолжително"); errorProviderUnit.SetError(cbUnit, "Одберете единица мерка"); errorProviderTaxGroup.SetError(cbTaxGroup, "Одберете даночна група"); } else { if (DbCommunication.Exists("Products", "Шифра", mtbCode.Text) < 1) { Product_DbCommunication.AddProduct(mtbCode.Text, tbProductName.Text, cbUnit.GetItemText(cbUnit.SelectedItem), cbTaxGroup.GetItemText(cbTaxGroup.SelectedItem), mtbGroupCode.Text, mtbHelpCode.Text, tbPrice.Text, tbOrigin.Text, tbDescription.Text, cbDDV.Checked == true ? 1 : 0, tbQuantity.Text); UpdateTable(); MessageBox.Show ( "Артиклот е успешно додаден!", "Сними", MessageBoxButtons.OK, MessageBoxIcon.Information ); errorProviderCode.Clear(); errorProviderProduct.Clear(); errorProviderUnit.Clear(); errorProviderTaxGroup.Clear(); } else { MessageBox.Show ( "Тој артикл веќе постои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } }
private void btnSave_Click(object sender, EventArgs e) { decimal ItemTrueQuantity = Product_DbCommunication.GetProductQuantity(item.Code); if (item.Quantity <= ItemTrueQuantity) { if (!DuplicateItem(item.Code)) { InvoiceItems_DbCommunication.AddInvoiceItem(OutgoingInvoices.InvoiceNumber, item.Code, item.Quantity, item.Price); dgvInvoiceItems.DataSource = DbCommunication.DisplayData(SearchQuery); ClearTextBoxes(); Product_DbCommunication.DecreaseQuantity(ItemTrueQuantity - item.Quantity, item.Code); } else { MessageBox.Show ( "Ставката веќе постои.", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Information ); } } else { MessageBox.Show ( "Нема доволно залиха.", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
// Start is called before the first frame update void Start() { dbCommunication = GameObject.FindGameObjectWithTag("dbHandler").GetComponent <DbCommunication>(); }
private void UpdateTable() { dgvEmployees.DataSource = DbCommunication.DisplayData(SearchQuery); }
protected void GoPayment(string strBankName, string strKey, string strSalt) { try { string strTxnId; DateTime dtNow = DateTime.Now; strTxnId = dtNow.ToString("yyyyMMdd") + "_" + dtNow.ToString("HHmmssfff") + "_" + Session["ReferenceNo"]; string[] hashVarsSeq = ConfigurationManager.AppSettings["PAYU_HASH"].Split('|'); string hash_string = string.Empty; hash_string = ""; string strAmount = "1"; string strProductInfo = "Testing"; string strFirstName = "firstname"; string strLastName = "lastName"; string strEmail = "*****@*****.**"; string strPhone = "9999999999"; string strAddress1 = "address1"; string strAddress2 = "address2"; string strUdf1 = "udf1"; string strUdf2 = "udf2"; string strUdf3 = "udf3"; string strUdf4 = "udf4"; string strUdf5 = "udf5"; foreach (string hash_var in hashVarsSeq) { if (hash_var == "key") { hash_string = hash_string + strKey; hash_string = hash_string + '|'; } else if (hash_var == "txnid") { hash_string = hash_string + strTxnId; hash_string = hash_string + '|'; } else if (hash_var == "amount") { hash_string = hash_string + strAmount; hash_string = hash_string + '|'; } else if (hash_var == "productinfo") { hash_string = hash_string + strProductInfo; hash_string = hash_string + '|'; } else if (hash_var == "firstname") { hash_string = hash_string + strFirstName; hash_string = hash_string + '|'; } else if (hash_var == "email") { hash_string = hash_string + strEmail;//"*****@*****.**";// hash_string = hash_string + '|'; } else if (hash_var == "phone") { hash_string = hash_string + strPhone; hash_string = hash_string + '|'; } else if (hash_var == "udf2") { hash_string = hash_string + strUdf2; hash_string = hash_string + '|'; } else if (hash_var == "udf3") { hash_string = hash_string + strUdf3; hash_string = hash_string + '|'; } else if (hash_var == "udf4") { hash_string = hash_string + strUdf4; hash_string = hash_string + '|'; } else if (hash_var == "udf5") { hash_string = hash_string + strUdf5; hash_string = hash_string + '|'; } else { hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else hash_string = hash_string + '|'; } } hash_string += strSalt;// appending SALT string hash = new PayuCommunication().Generatehash512(hash_string).ToLower(); string strFullUrl = HttpContext.Current.Request.Url.AbsoluteUri; string strAction = ConfigurationManager.AppSettings["PAYU_BASE_URL"]; System.Collections.Hashtable data = new System.Collections.Hashtable(); // adding values in hash table for data post data.Add("hash", hash); data.Add("key", strKey); data.Add("txnid", strTxnId); data.Add("amount", strAmount); data.Add("productinfo", strProductInfo); data.Add("firstname", strFirstName); data.Add("lastname", strLastName); data.Add("email", strEmail); data.Add("phone", strPhone); data.Add("address1", strAddress1); data.Add("address2", strAddress2); data.Add("city", strFullUrl); data.Add("udf2", strUdf2); data.Add("udf3", strUdf3); data.Add("udf4", strUdf4); data.Add("udf5", strUdf5); data.Add("surl", "http://localhost:49253/PayuResponse.aspx"); data.Add("furl", "http://localhost:49253/PayuResponse.aspx"); data.Add("curl", "http://localhost:49253/PayuResponse.aspx"); string query = "INSERT INTO PayuRequestLog(TxnId,InstituteId,PayuId,BankRefNo, RequestTime, Status) VALUES('" + strTxnId + "','" + strFirstName + "','','', 'getdate()', 'IN_PROGESS')"; int iResult = new DbCommunication().ExecuteQuery(query); string strForm = new PayuCommunication().PostFormSeamless(strAction, data); Page.Controls.Add(new LiteralControl(strForm)); } catch (Exception ex) { } }
private void DisplayData() { dgvProducts.DataSource = DbCommunication.DisplayData("SELECT Шифра, Артикл, Мерка, Даночна_група, Групна_шифра, Помошна_шифра, Цена, Потекло, Забелешка, Залиха FROM Products"); }
private void InvoiceItems_Load(object sender, EventArgs e) { dgvInvoiceItems.DataSource = DbCommunication.DisplayData(SearchQuery); tbQuantity.Text = "1"; }