public static T_Installment GetT_InstallmentByID(int id) { T_Installment t_Installment = new T_Installment(); SqlT_InstallmentProvider sqlT_InstallmentProvider = new SqlT_InstallmentProvider(); t_Installment = sqlT_InstallmentProvider.GetT_InstallmentByID(id); return t_Installment; }
public static bool UpdateT_Installment(T_Installment t_Installment) { SqlT_InstallmentProvider sqlT_InstallmentProvider = new SqlT_InstallmentProvider(); return sqlT_InstallmentProvider.UpdateT_Installment(t_Installment); }
public static int InsertT_Installment(T_Installment t_Installment) { SqlT_InstallmentProvider sqlT_InstallmentProvider = new SqlT_InstallmentProvider(); return sqlT_InstallmentProvider.InsertT_Installment(t_Installment); }
public T_Installment GetT_InstallmentFromReader(IDataReader reader) { try { T_Installment t_Installment = new T_Installment ( (int)reader["T_InstallmentID"], reader["ID"].ToString(), (DateTime)reader["Date"], (decimal)reader["Amount"] ); try { t_Installment.TotalAmount = (decimal)reader["TotalAmount"]; t_Installment.PaidAmount = (decimal)reader["PaidAmount"]; } catch (Exception ex) { } return t_Installment; } catch(Exception ex) { return null; } }
public bool UpdateT_Installment(T_Installment t_Installment) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("CUC__UpdateT_Installment", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@T_InstallmentID", SqlDbType.Int).Value = t_Installment.T_InstallmentID; cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = t_Installment.ID; cmd.Parameters.Add("@Date", SqlDbType.DateTime).Value = t_Installment.Date; cmd.Parameters.Add("@Amount", SqlDbType.Decimal).Value = t_Installment.Amount; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }