private void button2_Click(object sender, EventArgs e) { try { if (name.Text.Trim() == String.Empty || occupation.Text.Trim() == String.Empty || joinDate.Text.Trim() == String.Empty || address.Text.Trim() == String.Empty || guardian.Text.Trim() == String.Empty || dob.Text.Trim() == String.Empty || bgroup.Text.Trim() == String.Empty || fathername.Text.Trim() == String.Empty || foccupation.Text.Trim() == String.Empty || oaddress.Text.Trim() == String.Empty || otelno.Text.Trim() == String.Empty || mobile.Text.Trim() == String.Empty || pictureBox1.Image == null) { MessageBox.Show("All Fields are Required"); } else { Byte[] img = null; FileStream fs = new FileStream(imgloc, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); img = br.ReadBytes((int)fs.Length); viewClass u = new viewClass(); u.insertData(name.Text, occupation.Text, joinDate.Value.ToString("MM-dd-yyyy"), address.Text, guardian.Text, dob.Value.ToString("MM-dd-yyyy"), fathername.Text, foccupation.Text, bgroup.Text, oaddress.Text, otelno.Text, mobile.Text, img); MessageBox.Show("record inserted"); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { if (amount.Text == "" || validity.Text == "") { MessageBox.Show("All fields are required!"); } else { try { viewClass v = new viewClass(); int i = Int32.Parse(validity.Text.ToString()); DateTime expire = dateTimePicker1.Value.AddMonths(i); v.feesInsert((int)user_id.SelectedValue, Int32.Parse(amount.Text.ToString()), Int32.Parse(validity.Text.ToString()), dateTimePicker1.Value.ToString("MM-dd-yyyy"), expire.ToString("MM-dd-yyyy")); amount.Clear(); validity.Clear(); v.check(); MessageBox.Show("Record Inserted"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public SplashScreen() { InitializeComponent(); timer1.Start(); viewClass v = new viewClass(); v.check(); }
private void manageFees_Load(object sender, EventArgs e) { viewClass v = new viewClass(); DataSet ds = v.load_data("SELECT Id,name from [dbo].[user]"); if (ds.Tables[0].Rows.Count > 0) { user_id.DataSource = ds.Tables[0]; user_id.DisplayMember = "name"; user_id.ValueMember = "Id"; } }
public void Load_data(string select) { try { viewClass v = new viewClass(); DataSet ds = v.load_data(select); dataGridView1.ReadOnly = true; dataGridView1.DataSource = ds.Tables[0]; dataGridView1.Columns["amount"].HeaderText = "Amount"; dataGridView1.Columns["fees_date"].HeaderText = "Paid Date"; dataGridView1.Columns["expire_date"].HeaderText = "Expires Date"; dataGridView1.Columns["validity"].HeaderText = "Validity"; dataGridView1.Columns["mobile"].HeaderText = "Mobile"; dataGridView1.Columns["name"].HeaderText = "Name"; } catch { } }