private void btnAdd_Click(object sender, EventArgs e) { dc.c_name = txtcname.Text; dc.c_email = txtcemail.Text; dc.c_mobile = txtcmobile.Text; dc.c_location = txtclocation.Text; dc.c_category = txtccatogary.Text; dc.subend_date = txtcsubend.Text; dc.substart_date = "vaibhav"; pDAL.Insert(dc); bool success = pDAL.Insert(dc); if (success == true) { MessageBox.Show("company added sucessfully"); clear(); } else { MessageBox.Show("company can not be added"); } }
private void import_Click(object sender, EventArgs e) { queryBLL q = new queryBLL(); companysBLL b = new companysBLL(); companysDAL dc = new companysDAL(); int i = dataGridView1.Rows.Count; i--; string add = ""; string name; string mobile; string sub; string email; string subend = "12/12/2009"; string cat = "na"; for (int j = 1; j < i; j++) { name = dataGridView1.Rows[j].Cells[11].Value.ToString(); bool sucess = dc.chkcompanybyname(name); if (sucess == false) { add = dataGridView1.Rows[j].Cells[6].Value.ToString(); add = add + dataGridView1.Rows[j].Cells[7].Value.ToString(); add = add + dataGridView1.Rows[j].Cells[3].Value.ToString(); add = add + dataGridView1.Rows[j].Cells[8].Value.ToString(); b.c_location = add; name = dataGridView1.Rows[j].Cells[11].Value.ToString(); mobile = dataGridView1.Rows[j].Cells[1].Value.ToString(); sub = dataGridView1.Rows[j].Cells[2].Value.ToString(); email = dataGridView1.Rows[j].Cells[0].Value.ToString(); sub = dataGridView1.Rows[j].Cells[2].Value.ToString(); b.c_name = name; b.c_mobile = mobile; b.c_email = email; b.subend_date = sub; b.substart_date = subend; b.c_category = cat; bool suck = dc.Insert(b); add = " "; if (suck != true) { MessageBox.Show("nhi add hui"); } } } }