protected void saveAppointment_Click(object sender, EventArgs e) { AppointmentE appointment = new AppointmentE(); appointment.UserID = (Session["user"] as Entity.UserE).UserID; appointment.AppointmentContent = appointment_textbox.Text; appointment.AppointmentDate = DateTime.Parse(appointmentBox.Text); if (Convert.ToInt32(ddlDietitians.Text) != 0) { appointment.DietitianID = Convert.ToInt32(ddlDietitians.Text); BusinessLayers.Business.insertAppointment(appointment); error.Text = "Success Appointment"; error.Visible = true; } else { error.Text = "Please select dietitian"; error.Visible = true; } PaymentE pay = new PaymentE(); pay.DietitianID = Convert.ToInt32(ddlDietitians.Text); pay.UserID = (Session["user"] as Entity.UserE).UserID; pay.Fee = "50"; BusinessLayers.Business.insertPayment(pay); }
public static PaymentE getPaymentByID(int id) { PaymentE temp = null; SqlCommand com = new SqlCommand("getPaymentByID", Connection.Con); // Prodecure com.CommandType = CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@id", id)); if (com.Connection.State == ConnectionState.Closed) { com.Connection.Open(); } SqlDataReader rd = com.ExecuteReader(); if (rd.HasRows) { if (rd.Read()) { temp = new PaymentE { UserID = Convert.ToInt32(rd["UserID"]), PayID = Convert.ToInt32(rd["PayID"]), DietitianID = Convert.ToInt32(rd["DietitianID"]), PayDate = rd["PayDate"] == DBNull.Value ? DateTime.MinValue : DateTime.Parse(rd["PayDate"].ToString()), BankCard = Convert.ToBoolean(rd["BankCard"]), Fee = rd["Fee"] == DBNull.Value ? "" : rd["Fee"].ToString() }; } } com.Dispose(); com.Connection.Close(); return(temp); }
internal PaymentE getPayment() { PaymentE objPaymentE = new PaymentE(); objPaymentE.PaymentType = comboBox1.Text == "One_Off_Payment" ? PaymentTypeE.One_Off_Payment : PaymentTypeE.Recurring_Payment; objPaymentE.PaymentAmount = Convert.ToInt32(textBox1.Text); objPaymentE.PaymentDate = new DateTime( Convert.ToInt32(cboYear.Text), Convert.ToInt32(cboMonth.Text), Convert.ToInt32(cboDate.Text) ); return(objPaymentE); }
protected void sendDiet_Click(object sender, EventArgs e) { DietE diet = new DietE(); diet.DietitianID = currentDietView.DietitianID; diet.DietID = currentDietView.DietID; diet.DietRequestID = currentDietView.RequestID; diet.UserID = currentDietView.UserID; diet.DietContent = dietContent_textbox.Text; BusinessLayers.Business.updateDiet(diet); Logging.logDietFollowUp(diet.DietitianID.ToString(), diet.UserID.ToString()); PaymentE pay = new PaymentE(); pay.DietitianID = currentDietView.DietitianID; pay.UserID = currentDietView.UserID; pay.Fee = "30"; BusinessLayers.Business.insertPayment(pay); }
public static void UpdatePayment(PaymentE obj) { SqlCommand com = new SqlCommand("UpdatePayment", Connection.Con); // Prodecure com.CommandType = CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@userID", obj.UserID)); com.Parameters.Add(new SqlParameter("@bankCard", obj.BankCard)); com.Parameters.Add(new SqlParameter("@dietitianID", obj.DietitianID)); com.Parameters.Add(new SqlParameter("@fee", obj.Fee)); com.Parameters.Add(new SqlParameter("@payDate", obj.PayDate)); com.Parameters.Add(new SqlParameter("@id", obj.PayID)); if (com.Connection.State == ConnectionState.Closed) { com.Connection.Open(); } SqlDataReader rd = com.ExecuteReader(); com.Dispose(); com.Connection.Close(); }
public static int InsertPayment(PaymentE pay) { SqlCommand com = new SqlCommand("InsertPayment", Connection.Con); // Prodecure com.CommandType = CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@dietitianID", pay.DietitianID)); com.Parameters.Add(new SqlParameter("@userID", pay.UserID)); if (pay.PayDate == DateTime.MinValue) { com.Parameters.Add(new SqlParameter("@payDate", DBNull.Value)); } else { com.Parameters.Add(new SqlParameter("@payDate", pay.PayDate)); } com.Parameters.Add(new SqlParameter("@fee", pay.Fee)); com.Parameters.Add(new SqlParameter("@bankCart", pay.BankCard)); if (com.Connection.State == ConnectionState.Closed) { com.Connection.Open(); } SqlDataReader rd = com.ExecuteReader(); int insertId = 0; if (rd.HasRows) { rd.Read(); insertId = Convert.ToInt32(rd[0]); } com.Dispose(); com.Connection.Close(); return(insertId); }
public static void updatePayment(PaymentE obj) { PaymentC.UpdatePayment(obj); }
public static int insertPayment(PaymentE obj) { return(PaymentC.InsertPayment(obj)); }