protected void Page_Load(object sender, EventArgs e) { if (Roles.IsUserInRole(ERoles.Manager.ToString())) { if (!Page.IsPostBack) { List <int> years = new List <int>(); for (int i = 2010; i < 2051; i++) { years.Add(i); } ddlYear.DataSource = years; ddlYear.DataBind(); ddlYear.SelectedValue = DateTime.Now.Year.ToString(); dllMonth.SelectedValue = DateTime.Now.Month.ToString(); // dep using (ClubDBEntities club = new ClubDBEntities()) { var re = (from o in club.Departments select o).ToList(); ddlDep.DataSource = re; ddlDep.DataTextField = "Name"; ddlDep.DataValueField = "DepID"; ddlDep.DataBind(); } } } else { Response.Redirect("Error"); } }
private void Save() { DateTime date = Convert.ToDateTime(tbDate.Text, cul); int id = Convert.ToInt32(tbID.Text); using (ClubDBEntities club = new ClubDBEntities()) { // get employee string name = User.Identity.Name; int empID = (from o in club.Employees where o.UserName == name select o.EmpID).First(); TReaquest re = new TReaquest(); re.ClientID = id; re.EmployeeID = empID; re.Diagnosis = tbDia.Text; re.Goals = tbGoals.Text; re.Precautions = tbPrecaution.Text; re.Date = date; club.TReaquests.AddObject(re); club.SaveChanges(); EID = re.ID; saved = true; } }
protected void tbID_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbID.Text)) { using (ClubDBEntities club = new ClubDBEntities()) { int id = Convert.ToInt32(tbID.Text); var result = (from o in club.Clients where o.ClientID == id select o).FirstOrDefault(); if (result != null) { tbDOB.Text = result.DOB.ToString(); tbName.Text = result.FullName(); tbNation.Text = result.Nationality; tbPhone.Text = result.Phone.ToString(); lblError.Visible = false; pnlClient.Visible = true; if (!show) { pnlInfo.Visible = true; } } else { lblError.Visible = true; lblError.Text = "File ID does not exist"; pnlClient.Visible = false; pnlInfo.Visible = false; } } } }
protected void btnEAdd_Click(object sender, EventArgs e) { string name = tbEName.Text; long phone = Convert.ToInt64(tbPhone.Text); int dep = Convert.ToInt32(ddlType.SelectedValue); using (ClubDBEntities club = new ClubDBEntities()) { var emp = club.Employees.Where(a => a.EmpID == EditEmp).First(); emp.Name = name; emp.PhoneNum = phone; if (dep == 0) { emp.Type = "Manager"; } else { emp.Type = "Trainer"; var t = (from o in club.Departments where o.DepID == dep select o).First(); emp.Departments.Clear(); emp.Departments.Add(t); } club.SaveChanges(); resetEmp(); gvEmp.DataSource = club.getEmployees(); gvEmp.DataBind(); //chagesSaved(); } }
protected void btnAdd_Click(object sender, EventArgs e) { switch (rbAdd.SelectedIndex) { case 0: pnlEmp.Visible = true; pnlDep.Visible = false; pnlService.Visible = false; pnlWith.Visible = false; using (ClubDBEntities club = new ClubDBEntities()) { var r = from o in club.Departments select o; ddlType.DataSource = r; ddlType.DataTextField = "Name"; ddlType.DataValueField = "DepID"; ddlType.DataBind(); } break; case 1: pnlEmp.Visible = false; pnlDep.Visible = false; pnlService.Visible = true; pnlWith.Visible = false; using (ClubDBEntities club = new ClubDBEntities()) { var r = from i in club.Departments select i; ddlSDep.DataSource = r; ddlSDep.DataTextField = "Name"; ddlSDep.DataValueField = "DepID"; ddlSDep.DataBind(); } break; case 2: pnlEmp.Visible = false; pnlWith.Visible = false; pnlDep.Visible = true; pnlService.Visible = false; break; case 3: pnlEmp.Visible = false; pnlDep.Visible = false; pnlService.Visible = false; pnlWith.Visible = true; using (ClubDBEntities club = new ClubDBEntities()) { var r = from i in club.Departments select i; ddlWDep.DataSource = r; ddlWDep.DataTextField = "Name"; ddlWDep.DataValueField = "DepID"; ddlWDep.DataBind(); } break; } }
private void getPrices() { ids = new List <int>(); foreach (ListItem item in cbServices.Items) { if (item.Selected) { ids.Add(Convert.ToInt32(item.Value)); } } if (ids.Count != 0) { using (ClubDBEntities club = new ClubDBEntities()) { var result = (from o in club.Services where ids.Contains(o.ServiceID) select o.Price).Sum(); tbTotal.Text = result.ToString("0.00"); getDis(); } } else { tbTotal.Text = ""; tbFinal.Text = ""; } }
protected void gvSer_RowCommand(object sender, GridViewCommandEventArgs e) { int row = Convert.ToInt32(e.CommandArgument); int id = Convert.ToInt32(gvSer.Rows[row].Cells[7].Text); if (e.CommandName == "Select") { // get data using (ClubDBEntities club = new ClubDBEntities()) { var o = from i in club.Departments select i; ddlSDep.DataSource = o; ddlSDep.DataTextField = "Name"; ddlSDep.DataValueField = "DepID"; ddlSDep.DataBind(); var r = club.Services.Where(a => a.ServiceID == id).First(); tbSName.Text = r.Name; tbPrice.Text = r.Price.ToString("0,00"); ddlSDep.SelectedValue = r.DepID.ToString(); rbSType.SelectedIndex = r.Sub? 1:0; tbDays.Text = r.TotalDays.ToString(); } // show table serTable.Visible = true; EditSer = id; } }
protected void btnSearch0_Click(object sender, EventArgs e) { if (rbSelect.SelectedIndex == 0) { using (ClubDBEntities club = new ClubDBEntities()) { DateTime date = Convert.ToDateTime(tbDate.Text, cul); result = club.getInvoice(date); GridView1.DataSource = result; GridView1.DataBind(); } } else { if (rbSelect.SelectedIndex == 1) { var id = Convert.ToInt32(tbDate.Text); using (ClubDBEntities club = new ClubDBEntities()) { result = club.getInvoice(id); GridView1.DataSource = result; GridView1.DataBind(); } } if (rbSelect.SelectedIndex == 2) { using (ClubDBEntities club = new ClubDBEntities()) { result = club.getInvoice(tbDate.Text); GridView1.DataSource = result; GridView1.DataBind(); } } } }
protected void tbInv_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbInv.Text)) { int inv = Convert.ToInt32(tbInv.Text); using (ClubDBEntities club = new ClubDBEntities()) { var re = (from o in club.InvoiceHeaders where o.InvID == inv select o).FirstOrDefault(); if (re == null) { lblError.Text = "خطأ في رقم الفاتورة"; lblError.Visible = true; pnlDeposit.Visible = false; } else { pnlDeposit.Visible = true; lblError.Visible = false; invID = inv; } } } }
protected void gvSubs_RowDeleting(object sender, GridViewDeleteEventArgs e) { lblError.Visible = false; int id = Convert.ToInt32(gvSubs.Rows[e.RowIndex].Cells[5].Text); using (ClubDBEntities club = new ClubDBEntities()) { var intsub = club.IntSubs.Where(a => a.SubID == id).FirstOrDefault(); var nutsub = club.NutSubs.Where(a => a.SubID == id).FirstOrDefault(); var sub = club.Subscribtions.Where(a => a.SubID == id).First(); if (intsub != null) { club.IntSubs.DeleteObject(intsub); } if (nutsub != null) { club.NutSubs.DeleteObject(nutsub); } club.Subscribtions.DeleteObject(sub); try { club.SaveChanges(); string Message = " تم حذف الاشتراك "; ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", string.Format("alert('{0}');", Message), true); FillSubData(); } catch { lblError.Text = "لايمكن حذف الاشتراك لوجود زيارات متعلقة"; lblError.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (Roles.IsUserInRole(ERoles.Manager.ToString()) || Roles.IsUserInRole(ERoles.Receptionist.ToString())) { if (!Page.IsPostBack) { using (ClubDBEntities club = new ClubDBEntities()) { var result = club.getIncompleteInvoices(); if (result.Count() == 0) { lblError.Visible = true; lblError.Text = "لايوجد بيانات لعرضها"; } else { lblError.Visible = false; gvInvoices.DataSource = result; gvInvoices.DataBind(); } } } } else { Response.Redirect("Error.aspx"); } }
protected void btnPrint_Click(object sender, EventArgs e) { ReportDocument report = new ReportDocument(); report.Load(Server.MapPath("MovCR.rpt")); ClubDBEntities club = new ClubDBEntities(); if (depID == 0) { report.SetDataSource(club.getMovReport(date)); } else { report.SetDataSource(club.getMovReport(date, depID)); } ParameterValues pvDate = new ParameterValues(); ParameterDiscreteValue DisDate = new ParameterDiscreteValue(); DisDate.Value = date; pvDate.Add(DisDate); report.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pvDate); string printer = Properties.Settings.Default.DefaultPrinter; report.PrintOptions.PrinterName = printer; report.PrintToPrinter(1, false, 0, 0); }
protected void Page_Load(object sender, EventArgs e) { using (ClubDBEntities club = new ClubDBEntities()) { GridView1.DataSource = club.getServices(); GridView1.DataBind(); } //ReportDocument report = new ReportDocument(); //report.Load(Server.MapPath("DischargeCR.rpt")); //using (ClubDBEntities club = new ClubDBEntities()) //{ // DateTime date = new DateTime(2011, 12, 29); // report.SetDataSource(club.getDischargeReport(1)); // CrystalReportViewer1.ReportSource = report; //} //ReportDocument report = new ReportDocument(); //report.Load(Server.MapPath("test.rpt")); //ClubDBEntities club = new ClubDBEntities(); //report.SetDataSource(club.getInvoiceHeader(102)); //CrystalReportViewer1.ReportSource = report; //Roles.CreateRole(ERoles.InternalS.ToString()); //Roles.CreateRole(ERoles.Manager.ToString()); //Roles.CreateRole(ERoles.Nutritionist.ToString()); //Roles.CreateRole(ERoles.PhysicalS.ToString()); //Roles.CreateRole(ERoles.Receptionist.ToString()); }
protected void btnShow_Click(object sender, EventArgs e) { int month = Convert.ToInt32(dllMonth.SelectedValue); int year = Convert.ToInt32(ddlYear.SelectedValue); int dep = Convert.ToInt32(ddlDep.SelectedValue); using (ClubDBEntities club = new ClubDBEntities()) { var result = club.getEandIReport(month, year, dep); if (result.Count() > 0) { EandICR report = new EandICR(); report.Load(Server.MapPath("EandICR.rpt")); report.SetDataSource(result); CrystalReportViewer1.ReportSource = report; lblError.Visible = false; btnPrint.Visible = true; } else { lblError.Visible = true; lblError.Text = "لايوجد بيانات لعرضها"; btnPrint.Visible = false; } pnlData.Visible = true; } }
private void getName() { if (!string.IsNullOrEmpty(tbFile.Text)) { int id = Convert.ToInt32(tbFile.Text); using (ClubDBEntities club = new ClubDBEntities()) { var result = (from c in club.Clients where c.ClientID == id select c.FirstName + " " + c.SecondName + " " + c.FamilyName).FirstOrDefault(); if (string.IsNullOrEmpty(result)) { lblError.Visible = true; lblError.Text = "خطأ في رقم الملف"; lblNameValue.Text = ""; } else { lblError.Visible = false; lblNameValue.Text = result; pnlService.Visible = true; pnlTotal.Visible = true; pnlType.Visible = true; } } } }
protected void gvSer_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(gvSer.Rows[e.RowIndex].Cells[7].Text); using (ClubDBEntities club = new ClubDBEntities()) { // check that the service is not attached var att = club.InvoiceServices.Where(a => a.ServiceID == id).FirstOrDefault(); var re = club.Services.Where(a => a.ServiceID == id).First(); if (att == null) { club.Services.DeleteObject(re); club.SaveChanges(); } else { re.Deleted = true; club.SaveChanges(); } gvSer.DataSource = club.getServices(); gvSer.DataBind(); string Message = " تم الحذف "; ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", string.Format("alert('{0}');", Message), true); } }
private void getDocSerSubs() { if (ddlDep.SelectedIndex != 0) { // employees + services using (ClubDBEntities club = new ClubDBEntities()) { int depID = Convert.ToInt32(ddlDep.SelectedValue); var emp = club.Employees.Where(a => a.Departments.Any(b => b.DepID == depID)); ddlDoc.DataSource = emp; ddlDoc.DataTextField = "Name"; ddlDoc.DataValueField = "EmpID"; ddlDoc.DataBind(); // services var service = (from n in club.Services where n.DepID == depID && n.Sub == true select n).ToList(); cbServices.DataSource = service; cbServices.DataTextField = "Name"; cbServices.DataValueField = "ServiceID"; cbServices.DataBind(); } } }
protected void btnAdd_Click(object sender, EventArgs e) { switch (rbAdd.SelectedIndex) { case 0: pnlEmp.Visible = true; pnlDep.Visible = false; pnlService.Visible = false; pnlWith.Visible = false; using (ClubDBEntities club = new ClubDBEntities()) { gvEmp.DataSource = club.getEmployees(); gvEmp.DataBind(); } break; case 1: pnlEmp.Visible = false; pnlDep.Visible = false; pnlService.Visible = true; pnlWith.Visible = false; using (ClubDBEntities club = new ClubDBEntities()) { var r = club.getServices(); gvSer.DataSource = r; gvSer.DataBind(); } break; case 2: pnlEmp.Visible = false; pnlDep.Visible = true; pnlService.Visible = false; pnlWith.Visible = false; using (ClubDBEntities club = new ClubDBEntities()) { var r = from i in club.Departments orderby i.DepID select i ; gvDep.DataSource = r; gvDep.DataBind(); } break; case 3: pnlEmp.Visible = false; pnlDep.Visible = false; pnlService.Visible = false; pnlWith.Visible = true; using (ClubDBEntities club = new ClubDBEntities()) { var result = club.getWithTypes(); gvWith.DataSource = result; gvWith.DataBind(); } break; } }
protected void gvEmp_RowCommand(object sender, GridViewCommandEventArgs e) { int row = Convert.ToInt32(e.CommandArgument); int id = Convert.ToInt32(gvEmp.Rows[row].Cells[5].Text); if (e.CommandName == "Select") { using (ClubDBEntities club = new ClubDBEntities()) { var r = from o in club.Departments select o; ddlType.DataSource = r; ddlType.DataTextField = "Name"; ddlType.DataValueField = "DepID"; ddlType.DataBind(); var result = club.Employees.Where(a => a.EmpID == id).First(); tbEName.Text = result.Name; tbPhone.Text = result.PhoneNum.ToString(); if (result.Type == "Manager") { ddlType.SelectedIndex = 0; } else { ddlType.SelectedValue = result.Departments.First().DepID.ToString(); } empTable.Visible = true; EditEmp = id; } } }
protected void gvWith_RowCommand(object sender, GridViewCommandEventArgs e) { int row = Convert.ToInt32(e.CommandArgument); int id = Convert.ToInt32(gvWith.Rows[row].Cells[4].Text); if (e.CommandName == "Select") { // get departments using (ClubDBEntities club = new ClubDBEntities()) { var r = (from i in club.Departments select i).ToList(); ddlWDep.DataSource = r; ddlWDep.DataTextField = "Name"; ddlWDep.DataValueField = "DepID"; ddlWDep.DataBind(); // get the type var t = club.WithTypes.Where(a => a.ID == id).First(); tbWName.Text = t.Name; ddlWDep.SelectedValue = t.Department.ToString(); withTable.Visible = true; EditWith = id; } } }
protected void gvEmp_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int id = Convert.ToInt32(gvEmp.Rows[e.RowIndex].Cells[5].Text); using (ClubDBEntities club = new ClubDBEntities()) { var emp = club.Employees.Where(a => a.EmpID == id).First(); club.Employees.DeleteObject(emp); if (!string.IsNullOrEmpty(emp.UserName)) { Membership.DeleteUser(emp.UserName, true); } club.SaveChanges(); gvEmp.DataSource = club.getEmployees(); gvEmp.DataBind(); string Message = " تم الحذف "; ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", string.Format("alert('{0}');", Message), true); } } catch { lblError.Text = "لايمكن حذف الموظف"; lblError.Visible = true; } }
protected void tbDate_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbID.Text) && show) { DateTime date = Convert.ToDateTime(tbDate.Text, cul); int id = Convert.ToInt32(tbID.Text); using (ClubDBEntities club = new ClubDBEntities()) { var re = (from o in club.Discharges where o.ClientID == id && o.Date == date select o).FirstOrDefault(); if (re == null) { lblError.Visible = true; lblError.Text = "No Data Found. Try another Date"; pnlInfo.Visible = false; } else { lblError.Visible = false; tbGoals.Text = re.Goals; tbTreat.Text = re.Treatment; tbDia.Text = re.Diagnosis; tbPreReferrals.Text = re.PreReferral; tbInitialSession.Text = re.InitialSession.ToString("dd/MM/yyyy"); tbFinalSession.Text = re.FinalSession.ToString("dd/MM/yyyy"); tbTotalSession.Text = re.TotalNSession; tbDischarge.Text = re.Discharge1; rbGoals.SelectedValue = re.GoalsBool; tbComments.Text = re.Comments; readOnly(); } } } }
protected void btnEAdd_Click(object sender, EventArgs e) { string name = tbEName.Text; long phone = Convert.ToInt64(tbPhone.Text); int dep = Convert.ToInt32(ddlType.SelectedValue); using (ClubDBEntities club = new ClubDBEntities()) { Employee emp = new Employee(); emp.Name = name; emp.PhoneNum = phone; if (dep == 8) { emp.Type = "Manager"; } else { emp.Type = "Trainer"; var t = (from o in club.Departments where o.DepID == dep select o).First(); emp.Departments.Add(t); } club.Employees.AddObject(emp); club.SaveChanges(); chagesSaved(); } }
private void Save() { DateTime date = Convert.ToDateTime(tbDate.Text, cul).Date; int id = Convert.ToInt32(tbID.Text); using (ClubDBEntities club = new ClubDBEntities()) { // get employee string name = User.Identity.Name; int empID = (from o in club.Employees where o.UserName == name select o.EmpID).First(); Discharge eval = new Discharge(); eval.ClientID = id; eval.EmployeeID = empID; eval.Date = date; eval.Diagnosis = tbDia.Text; eval.Goals = tbGoals.Text; eval.Treatment = tbTreat.Text; eval.PreReferral = tbPreReferrals.Text; eval.InitialSession = Convert.ToDateTime(tbInitialSession.Text, cul); eval.FinalSession = Convert.ToDateTime(tbFinalSession.Text, cul); eval.TotalNSession = tbTotalSession.Text; eval.Discharge1 = tbDischarge.Text; eval.GoalsBool = rbGoals.SelectedValue; eval.Comments = tbComments.Text; club.Discharges.AddObject(eval); club.SaveChanges(); EID = eval.ID; saved = true; } }
private void Save() { DateTime date = Convert.ToDateTime(tbDate.Text, cul); int id = Convert.ToInt32(tbID.Text); using (ClubDBEntities club = new ClubDBEntities()) { // get employee string name = User.Identity.Name; int empID = (from o in club.Employees where o.UserName == name select o.EmpID).First(); Evaluation eval = new Evaluation(); eval.ClientID = id; eval.EmployeeID = empID; eval.Assessment = tbAssess.Text; eval.Date = date; eval.Diagnosis = tbDia.Text; eval.Goals = tbGoals.Text; eval.History = tbHistory.Text; eval.Objective = tbObjective.Text; eval.Treatment = tbTreat.Text; club.Evaluations.AddObject(eval); club.SaveChanges(); EID = eval.ID; saved = true; } }
protected void btnSave_Click(object sender, EventArgs e) { ClubDBEntities club = new ClubDBEntities(); long?id = null; int? i = null; Client client = new Client() { FirstName = tbFirstName.Text, SecondName = tbSecondName.Text, LastName = tbLastName.Text, FamilyName = tbFamilyName.Text, DOB = string.IsNullOrEmpty(tbDOB.Text) ? i : Convert.ToInt32(tbDOB.Text), Nationality = tbNation.Text, IDNumber = string.IsNullOrEmpty(tbID.Text) ? id : Convert.ToInt64(tbID.Text), Phone = string.IsNullOrEmpty(tbPhone.Text) ? id : Convert.ToInt64(tbPhone.Text), Marital = rbMarital.SelectedValue, RefferedFrom = tbRefferedFrom.Text, RefferedDate = DateTime.Now.Date, Status = Status.Inactive.toString() }; club.AddToClients(client); club.SaveChanges(); //string Message = " تمت اضافة العضوة "; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", string.Format("alert('{0}');", Message), true); Response.Redirect("Invoice.aspx?New=" + client.ClientID); }
protected void tbDate_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbID.Text) && show) { DateTime date = Convert.ToDateTime(tbDate.Text, cul); int id = Convert.ToInt32(tbID.Text); using (ClubDBEntities club = new ClubDBEntities()) { var re = (from o in club.TReaquests where o.ClientID == id && o.Date == date select o).FirstOrDefault(); if (re == null) { lblError.Visible = true; lblError.Text = "No Data Found. Try another Date"; pnlInfo.Visible = false; } else { lblError.Visible = false; tbGoals.Text = re.Goals; tbDia.Text = re.Diagnosis; tbPrecaution.Text = re.Precautions; EID = id; readOnly(); } } } }
protected void btnPrint_Click(object sender, EventArgs e) { string toPerson = tbTo.Text; decimal amount = Convert.ToDecimal(tbAmount.Text); string amountW = tbAmountW.Text; string note = tbNotes.Text; long? check = null; string bank = ""; if (pnlBank.Visible) { check = Convert.ToInt64(tbCheck.Text); bank = tbBank.Text; } using (ClubDBEntities club = new ClubDBEntities()) { string username = User.Identity.Name; var emp = (from o in club.Employees where o.UserName == username select o.EmpID).First(); Withdraw with = new Withdraw(); with.Amount = amount; with.AmountW = amountW; with.Bank = bank; with.CheckNum = check; with.Date = DateTime.Now.Date; with.EmpID = emp; with.Notes = note; with.ToPerson = toPerson; club.Withdraws.AddObject(with); club.SaveChanges(); } Response.Redirect("Default.aspx"); }
protected void RegisterUser_CreatedUser(object sender, EventArgs e) { string role = ddlRoles.SelectedValue; Roles.AddUserToRole(RegisterUser.UserName, role); //DropDownList ddlname = (DropDownList)RegisterUserWizardStep.ContentTemplateContainer.FindControl("ddlName"); TextBox tbU = (TextBox)RegisterUserWizardStep.ContentTemplateContainer.FindControl("UserName"); if ((tbU != null)) { string username = tbU.Text; empID = Convert.ToInt32(ddlName.SelectedValue); using (ClubDBEntities club = new ClubDBEntities()) { var emp = (from o in club.Employees where o.EmpID == empID select o).First(); emp.UserName = username; club.SaveChanges(); } } //Response.Redirect("Default.aspx"); //FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); //string continueUrl = RegisterUser.ContinueDestinationPageUrl; //if (String.IsNullOrEmpty(continueUrl)) //{ // continueUrl = "~/"; //} //Response.Redirect(continueUrl); }
protected void Page_Load(object sender, EventArgs e) { if (Session["InvoiceID"] != null) { int id = Convert.ToInt32(Session["InvoiceID"]); InvoiceCR report = new InvoiceCR(); report.Load(Server.MapPath("InvoiceCR.rpt")); ClubDBEntities club = new ClubDBEntities(); report.SetDataSource(club.getInvoiceHeader(id)); CrystalReportViewer1.ReportSource = report; } else if (Session["WithID"] != null) { int id = Convert.ToInt32(Session["WithID"]); WithdrawCR report = new WithdrawCR(); report.Load(Server.MapPath("WithdrawCR.rpt")); ClubDBEntities club = new ClubDBEntities(); report.SetDataSource(club.getWithReport(id)); CrystalReportViewer1.ReportSource = report; } else if (Session["depID"] != null) { int id = Convert.ToInt32(Session["depID"]); DepositCR report = new DepositCR(); report.Load(Server.MapPath("DepositCR.rpt")); ClubDBEntities club = new ClubDBEntities(); report.SetDataSource(club.getDepositReport(id)); CrystalReportViewer1.ReportSource = report; } }