public int Delete(Carddetails carddetails) { int __rowsAffected = 0; // Create command using (SqlCommand sqlCommand = new SqlCommand("CarddetailsDelete")) { // Set command type sqlCommand.CommandType = CommandType.StoredProcedure; try { // Attach command AttachCommand(sqlCommand); // Add command parameters SqlParameter vid = new SqlParameter("@id", SqlDbType.Int); vid.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vid); // Set input parameter values SqlServerHelper.SetParameterValue(vid, carddetails.id); // Execute command __rowsAffected = sqlCommand.ExecuteNonQuery(); } finally { // Detach command DetachCommand(sqlCommand); } } return(__rowsAffected); }
public int Update(Carddetails carddetails) { int __rowsAffected = 0; // Create command using (SqlCommand sqlCommand = new SqlCommand("CarddetailsUpdate")) { // Set command type sqlCommand.CommandType = CommandType.StoredProcedure; // Add command parameters SqlParameter vTypeofcard = new SqlParameter("@Typeofcard", SqlDbType.NVarChar, 20); vTypeofcard.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vTypeofcard); SqlParameter vCardname = new SqlParameter("@Cardname", SqlDbType.NVarChar, 50); vCardname.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vCardname); SqlParameter vDateofexpiry = new SqlParameter("@Dateofexpiry", SqlDbType.NVarChar, 50); vDateofexpiry.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vDateofexpiry); SqlParameter vNotificationmail = new SqlParameter("@Notificationmail", SqlDbType.NVarChar, 50); vNotificationmail.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vNotificationmail); SqlParameter vCountry = new SqlParameter("@Country", SqlDbType.NVarChar, 20); vCountry.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vCountry); SqlParameter vid = new SqlParameter("@id", SqlDbType.Int); vid.Direction = ParameterDirection.Input; sqlCommand.Parameters.Add(vid); // Set input parameter values SqlServerHelper.SetParameterValue(vTypeofcard, carddetails.Typeofcard); SqlServerHelper.SetParameterValue(vCardname, carddetails.Cardname); SqlServerHelper.SetParameterValue(vDateofexpiry, carddetails.Dateofexpiry); SqlServerHelper.SetParameterValue(vNotificationmail, carddetails.Notificationmail); SqlServerHelper.SetParameterValue(vCountry, carddetails.Country); SqlServerHelper.SetParameterValue(vid, carddetails.id); try { // Attach command AttachCommand(sqlCommand); // Execute command __rowsAffected = sqlCommand.ExecuteNonQuery(); if (__rowsAffected == 0) { return(__rowsAffected); } } finally { // Detach command DetachCommand(sqlCommand); } } return(__rowsAffected); }
public virtual void Clone(Carddetails sourceObject) { if (sourceObject == null) { throw new ArgumentNullException("sourceObject"); } // Clone attributes from source object this._Typeofcard = sourceObject.Typeofcard; this._Cardname = sourceObject.Cardname; this._Dateofexpiry = sourceObject.Dateofexpiry; this._Notificationmail = sourceObject.Notificationmail; this._Country = sourceObject.Country; this._id = sourceObject.id; }
public int Retrieve(Carddetails carddetails) { int __rowsAffected = 1; // Create command using (SqlCommand sqlCommand = new SqlCommand("CarddetailsGet")) { // Set command type sqlCommand.CommandType = CommandType.StoredProcedure; try { // Attach command AttachCommand(sqlCommand); // Add command parameters SqlParameter vTypeofcard = new SqlParameter("@Typeofcard", SqlDbType.NVarChar, 20); vTypeofcard.Direction = ParameterDirection.Output; sqlCommand.Parameters.Add(vTypeofcard); SqlParameter vCardname = new SqlParameter("@Cardname", SqlDbType.NVarChar, 50); vCardname.Direction = ParameterDirection.Output; sqlCommand.Parameters.Add(vCardname); SqlParameter vDateofexpiry = new SqlParameter("@Dateofexpiry", SqlDbType.NVarChar, 50); vDateofexpiry.Direction = ParameterDirection.Output; sqlCommand.Parameters.Add(vDateofexpiry); SqlParameter vNotificationmail = new SqlParameter("@Notificationmail", SqlDbType.NVarChar, 50); vNotificationmail.Direction = ParameterDirection.Output; sqlCommand.Parameters.Add(vNotificationmail); SqlParameter vCountry = new SqlParameter("@Country", SqlDbType.NVarChar, 20); vCountry.Direction = ParameterDirection.Output; sqlCommand.Parameters.Add(vCountry); SqlParameter vid = new SqlParameter("@id", SqlDbType.Int); vid.Direction = ParameterDirection.InputOutput; sqlCommand.Parameters.Add(vid); // Set input parameter values SqlServerHelper.SetParameterValue(vid, carddetails.id); // Execute command sqlCommand.ExecuteNonQuery(); try { // Get output parameter values carddetails.Typeofcard = SqlServerHelper.ToString(vTypeofcard); carddetails.Cardname = SqlServerHelper.ToString(vCardname); carddetails.Dateofexpiry = SqlServerHelper.ToString(vDateofexpiry); carddetails.Notificationmail = SqlServerHelper.ToString(vNotificationmail); carddetails.Country = SqlServerHelper.ToString(vCountry); carddetails.id = SqlServerHelper.ToInt32(vid); } catch (Exception ex) { if (ex is System.NullReferenceException) { __rowsAffected = 0; } else { throw ex; } } } finally { // Detach command DetachCommand(sqlCommand); } } return(__rowsAffected); }