Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 54 additions & 37 deletions Code/DBProject/Doctor/Bill.aspx.cs
Original file line number Diff line number Diff line change
@@ -1,59 +1,76 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using DBProject.DAL;
using System.Data;

namespace doctor
{
public partial class bill : System.Web.UI.Page
public partial class bill : Page
{
protected void Page_Load(object sender, EventArgs e)
{

myDAL objmyDAL = new myDAL();
DataTable dt = new DataTable();
int found;

int did = (int)Session["idoriginal"];

found = objmyDAL.generate_bill_DAL(did, ref dt);

if (found != 1)
{ Response.Write("<script>alert('There was some error');</script>"); }
else
if (!IsPostBack)
{
Label1.Text = dt.Rows[0][0].ToString();
try
{
int did = (int)Session["idoriginal"];
myDAL objmyDAL = new myDAL();
DataTable dt = new DataTable();
int found = objmyDAL.generate_bill_DAL(did, ref dt);

if (found != 1 || dt.Rows.Count == 0)
{
Label1.Text = "Error generating bill";
Response.Write("<script>alert('There was some error generating the bill.');</script>");
}
else
{
Label1.Text = dt.Rows[0][0].ToString();
}
}
catch (Exception ex)
{
Response.Write($"<script>alert('Error: {ex.Message}');</script>");
}
}
}


public void bill_paid(object sender, EventArgs e)
{
myDAL objmyDAL = new myDAL();

int did = (int)Session["idoriginal"];
int appoint = (int)Session["appointid"];
objmyDAL.paid_bill_DAL(did,appoint);

Response.BufferOutput = false;
Response.Redirect("patienthistory.aspx");
}
try
{
int did = (int)Session["idoriginal"];
int appoint = (int)Session["appointid"];

myDAL objmyDAL = new myDAL();
objmyDAL.paid_bill_DAL(did, appoint);

Response.BufferOutput = false;
Response.Redirect("patienthistory.aspx");
}
catch (Exception ex)
{
Response.Write($"<script>alert('Error: {ex.Message}');</script>");
}
}

public void bill_Unpaid(object sender, EventArgs e)
{
myDAL objmyDAL = new myDAL();
try
{
int did = (int)Session["idoriginal"];
int appoint = (int)Session["appointid"];

int did = (int)Session["idoriginal"];
int appoint = (int)Session["appointid"];
objmyDAL.Unpaid_bill_DAL(did, appoint);
myDAL objmyDAL = new myDAL();
objmyDAL.Unpaid_bill_DAL(did, appoint);

Response.BufferOutput = false;
Response.Redirect("patienthistory.aspx");
Response.BufferOutput = false;
Response.Redirect("patienthistory.aspx");
}
catch (Exception ex)
{
Response.Write($"<script>alert('Error: {ex.Message}');</script>");
}
}
}
}
}