#region InsertData public int Insert(NCBAL ObjInsert) { con = new SqlConnection(constr); con.Open(); cmd = new SqlCommand("InsertNewComp_SP", con); cmd.CommandType = CommandType.StoredProcedure; try { cmd.Parameters.AddWithValue("@compliantID",ObjInsert.compid).ToString(); cmd.Parameters.AddWithValue("@customerid", ObjInsert.cusid).ToString(); cmd.Parameters.AddWithValue("@customername", ObjInsert.cusname).ToString(); cmd.Parameters.AddWithValue("@branchid", ObjInsert.ddlbranch).ToString(); cmd.Parameters.AddWithValue("@servicetype",ObjInsert.servicetype); return cmd.ExecuteNonQuery(); } catch { throw; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } } #endregion
#region Insert Data public int Insert(NCBAL ObjInsert) { try { return ncd.Insert(ObjInsert); } catch { throw; } finally { ncd = null; } } #endregion
ncb.compid = txtcompid.Text; ncb.cusid = txtcusid.Text; ncb.cusname = txtcusname.Text; ncb.cusnum = txtcusnumber.Text; ncb.compname = txtcompname.Text; ncb.ddlproduct = DDlProductname.Text; ncb.compliant = txtCompliant.Text; ncb.compdate = Convert.ToDateTime(txtcompdate.Text); ncb.solution = txtsolution.Text; ncb.ddlassign = DDlAssign.Text; ncb.datetocomp = Convert.ToDateTime(txtdatetocom.Text); ncb.ddlpriorty = DDlPriorty.Text; ncb.ddlstatus = DDlStatus.Text; ncb.complianttime = txtcomplianttime.Text; ncb.datetocomp = txtdatecomptime.Text; ncb.ddlbranch = DDLbranch.Text; String str = ""; for (int i = 0; i <= CBLservicetype.Items.Count - 1; i++) { if (CBLservicetype.Items[i].Selected) { if (str == "") { str = CBLservicetype.Items[i].Text; } else { str += "," + CBLservicetype.Items[i].Text; } } } ncb.servicetype = str; }
BAL bal = new BAL(); int returnVal = bal.Insert(ncb); if( returnVal > 0) //Insert Success else //Insert Failed
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)