public virtual void Clone(billdetails sourceObject) { if (sourceObject == null) { throw new ArgumentNullException("sourceObject"); } // Clone attributes from source object this._id = sourceObject.id; this._billamount = sourceObject.billamount; this._billdate = sourceObject.billdate; this._notificationmail = sourceObject.notificationmail; this._billtype = sourceObject.billtype; }
public int Insert(billdetails billdetails) { int __rowsAffected = 0; // Create command using (SqlCommand sqlCommand = new SqlCommand("billdetailsInsert")) { // Set command type sqlCommand.CommandType = CommandType.StoredProcedure; // Add command parameters SqlParameter vid = new SqlParameter("@id", SqlDbType.Int); vid.Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.Add(vid); SqlParameter vbillamount = new SqlParameter("@billamount", SqlDbType.NVarChar, 50); vbillamount.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vbillamount); SqlParameter vbilldate = new SqlParameter("@billdate", SqlDbType.NVarChar, 50); vbilldate.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vbilldate); SqlParameter vnotificationmail = new SqlParameter("@notificationmail", SqlDbType.NVarChar, 50); vnotificationmail.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vnotificationmail); SqlParameter vbilltype = new SqlParameter("@billtype", SqlDbType.NVarChar, 50); vbilltype.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vbilltype); // Set input parameter values SqlServerHelper.SetParameterValue( vid, billdetails.id, 0); SqlServerHelper.SetParameterValue(vbillamount, billdetails.billamount); SqlServerHelper.SetParameterValue(vbilldate, billdetails.billdate); SqlServerHelper.SetParameterValue(vnotificationmail, billdetails.notificationmail); SqlServerHelper.SetParameterValue(vbilltype, billdetails.billtype); try { // Attach command AttachCommand(sqlCommand); // Execute command __rowsAffected = sqlCommand.ExecuteNonQuery(); if (__rowsAffected == 0) { return(__rowsAffected); } // Get output parameter values billdetails.id = SqlServerHelper.ToInt32(vid); } finally { // Detach command DetachCommand(sqlCommand); } } return(__rowsAffected); }