-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmCustomerRecord1.cs
121 lines (84 loc) · 3.8 KB
/
frmCustomerRecord1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Loop_Inventory
{
public partial class frmCustomerRecord1 : Form
{
public frmCustomerRecord1()
{
InitializeComponent();
}
private void bunifuImageButton6_Click(object sender, EventArgs e)
{
this.Close();
}
private void bunifuImageButton5_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
private void frmCustomerRecord1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'inventory_DBDataSet.Customer' table. You can move, or remove it, as needed.
this.customerTableAdapter.Fill(this.inventory_DBDataSet.Customer);
Cmb_field.SelectedIndex = 0;
this.ActiveControl = txt_search;
txt_search.Focus();
}
private void dgw_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
try
{
DataGridViewRow dr = dgw.SelectedRows[0];
this.Hide();
Cash_Transaction frmtrans = new Cash_Transaction();
if (lblSet.Text == "Sale")
frmtrans.Show();
frmtrans.cmbAccountType.Text = ModCS.Accounttype;
frmtrans.txtID.Text = dr.Cells[0].Value.ToString();
frmtrans.txtAccountID.Text = dr.Cells[1].Value.ToString();
frmtrans.txtAccountName.Text = dr.Cells[3].Value.ToString();
frmtrans.txtContactNo.Text = dr.Cells[8].Value.ToString();
frmtrans.GetSupplierBalance1();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txt_search_TextChanged(object sender, EventArgs e)
{
if (Cmb_field.Text == "ID")
{
ModCommonClasses.con = new SqlConnection(ModCS.cs);
SqlDataAdapter sda = new SqlDataAdapter("SELECT ID,CustomerID,Date,Name,OpeningBalance,OpeningBalanceType,Address,EmailID,Phoneno,Mobileno,Creditperiod,AccountName,Branch,AccountNumber,Remarks,Pricinglevel FROM Customer where CustomerID like '" + txt_search.Text + "%'", ModCommonClasses.con);
DataTable dt = new DataTable();
sda.Fill(dt);
dgw.DataSource = dt;
}
if (Cmb_field.Text == "CustomerName")
{
ModCommonClasses.con = new SqlConnection(ModCS.cs);
SqlDataAdapter sda = new SqlDataAdapter("SELECT ID,CustomerID,Date,Name,OpeningBalance,OpeningBalanceType,Address,EmailID,Phoneno,Mobileno,Creditperiod,AccountName,Branch,AccountNumber,Remarks,Pricinglevel FROM Customer where Name like '" + txt_search.Text + "%'", ModCommonClasses.con);
DataTable dt = new DataTable();
sda.Fill(dt);
dgw.DataSource = dt;
}
if (Cmb_field.Text == "Mobile")
{
ModCommonClasses.con = new SqlConnection(ModCS.cs);
SqlDataAdapter sda = new SqlDataAdapter("SELECT ID,CustomerID,Date,Name,OpeningBalance,OpeningBalanceType,Address,EmailID,Phoneno,Mobileno,Creditperiod,AccountName,Branch,AccountNumber,Remarks,Pricinglevel FROM Customer where Mobileno like '" + txt_search.Text + "%'", ModCommonClasses.con);
DataTable dt = new DataTable();
sda.Fill(dt);
dgw.DataSource = dt;
}
}
}
}