protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // store linkedlist items during the session //if (Session["mediitemlist"] == null && Session["mediitemqtylist"] == null && Session["mediitemidlist"] == null && Session["medarr"] == null && Session["medqtyarr"] == null && Session["medidarr"] == null) //{ Session["mediitemlist"] = new LinkedList <string>(); Session["mediitemqtylist"] = new LinkedList <string>(); Session["mediitemidlist"] = new LinkedList <string>(); Session["medarr"] = new string[] { }; Session["medqtyarr"] = new string[] { }; Session["medidarr"] = new string[] { }; //} // Display dropdownlist with Pet ID PetID Ids = new PetID(ids); MedList Meds = new MedList(mitems); try { ConnectionClass.PetIDList(Ids); PetIDList.DataSource = Ids.PetIDs; PetIDList.DataTextField = Ids.PetIDs.Columns["NNAME"].ToString(); PetIDList.DataValueField = Ids.PetIDs.Columns["ID"].ToString(); PetIDList.DataBind(); ConnectionClass.MedicationList(Meds); MedList.DataSource = Meds.MedItems; MedList.DataTextField = Meds.MedItems.Columns["NAME"].ToString(); MedList.DataValueField = Meds.MedItems.Columns["ID"].ToString(); MedList.DataBind(); } finally { } // Display Quantity Number for (int i = 1; i <= 100; i++) { InputQtyNum.Items.Add(new ListItem(i.ToString(), i.ToString())); } } }
protected void check_Click(object sender, EventArgs e) { customerName = cusName.Text; InquiryPet pets = new InquiryPet(customerName, ownerID, petName, petBirthday, petList); try { ConnectionClass.PetLists(pets); petlisttable.DataSource = pets.petList; petlisttable.DataBind(); } finally { } }
//string apptEmail { get; set; } //string test = "1234"; public void Confirm(object sender, EventArgs e) { Oid = cusIDList.SelectedValue.ToString(); Customer thisCustomer = new Customer(Oid, firstname, lastname, Thisemail, phonenum); try { ConnectionClass.GetApptDetail(thisCustomer); apptPetName = petIDList.SelectedItem.ToString(); apptDate = day.SelectedItem.ToString() + " / " + month.SelectedItem.ToString() + " / " + year.SelectedItem.ToString(); apptTime = time.SelectedItem.ToString(); //test = "3456"; fname.Text = thisCustomer.firstName; details.Text = "Appointment for customer: " + cusIDList.SelectedItem.ToString() + "<br>" + "PetName: " + apptPetName + "<br>" + "Appointment Date: " + apptDate + "<br>" + "Appointment Time: " + apptTime + "<br>"; email.Text = thisCustomer.emailAddress; vetIDList.Enabled = false; cusIDList.Enabled = false; petIDList.Enabled = false; year.Enabled = false; month.Enabled = false; day.Enabled = false; time.Enabled = false; note.Enabled = false; price.Enabled = false; } catch { Response.Write("<script type='text/javascript'>"); Response.Write("alert('Failed ');"); Response.Write("</script>"); } finally { } }
protected void ViewPescription(object sender, EventArgs e) { try { Button btn = (Button)(sender); PrescNum = btn.CommandArgument; PrescID.Text = PrescNum; ViewPresc prescex = new ViewPresc(PrescNum, Prescription); ConnectionClass.ViewPrescription(prescex); SeePresc.DataSource = prescex.Prescription; SeePresc.DataBind(); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Error! ');</script>"); } }
protected void CancelAppt(object sender, EventArgs e) { try { Button btn = (Button)(sender); ApptID = btn.CommandArgument; // test CommandArgument ApptList appt = new ApptList(ApptID, PetID, PetName, CusName, ApptDateTime, ApptTable); ConnectionClass.CancelAppointment(appt); ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Cancelled Successfully! ');</script>"); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Failed! ');</script>"); } }
protected void RegisterNewMed_Click(object sender, EventArgs e) { ManuID = NewManuID.Text; ManuRF = NewManuRF.Text; MedName = NewMedName.Text; MedPrice = NewMedPrice.Text; Medication NewMedItem = new Medication(ManuID, ManuRF, MedName, MedPrice); try { ConnectionClass.RegisterNewMed(NewMedItem); ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('Registered successfully!');</script>"); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('Failed');</script>"); } }
public void ApptListView() { CusName = cusNameInput.Text; ApptList appt = new ApptList(ApptID, PetID, PetName, CusName, ApptDateTime, ApptTable); try { ConnectionClass.GetApptList(appt); ApptListTable.DataSource = appt.ApptTable; ApptListTable.DataBind(); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Can't find any appointment for the customer! ');</script>"); } finally { } }
} // 쓸수 있을까?? protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { VetID Vids = new VetID(vids); OwnerID Oids = new OwnerID(oids); try { // Display dropdownlist with Vet ID ConnectionClass.VetIDList(Vids); vetIDList.DataSource = Vids.VetIDs; vetIDList.DataTextField = Vids.VetIDs.Columns["NAME"].ToString(); vetIDList.DataValueField = Vids.VetIDs.Columns["ID"].ToString(); vetIDList.DataBind(); // Display dropdownlist with Customer(Pet Owner) ID ConnectionClass.OnwerIDList(Oids); cusIDList.DataSource = Oids.OwnerIDs; cusIDList.DataTextField = Oids.OwnerIDs.Columns["NAME"].ToString(); cusIDList.DataValueField = Oids.OwnerIDs.Columns["ID"].ToString(); cusIDList.DataBind(); } finally { } // Display Calendar with month, year and date for (int i = 1; i <= 12; i++) { System.Globalization.DateTimeFormatInfo monthnum = new System.Globalization.DateTimeFormatInfo(); month.Items.Add(new ListItem(monthnum.GetAbbreviatedMonthName(i).ToString(), i.ToString())); } for (int i = 2015; i <= System.DateTime.Now.Year + 1; i++) { year.Items.Add(new ListItem(i.ToString(), i.ToString())); } } }
public void PrescListView() { cname = cusNameInput.Text; SearchPresc presc = new SearchPresc(cname, plisttable); try { ConnectionClass.SearchPrescList(presc); PrescListTable.DataSource = presc.PrescTable; PrescListTable.DataBind(); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Error! ');</script>"); } finally { } }
protected void ConfirmChange_Click(object sender, EventArgs e) { ApptID = ApptNo.Text; ApptDateTime = year.SelectedItem.ToString() + month.SelectedItem.ToString() + day.SelectedItem.ToString() + time.SelectedItem.ToString(); ApptList cappt = new ApptList(ApptID, PetID, PetName, CusName, ApptDateTime, ApptTable); try { ConnectionClass.ChangeAppointment(cappt); ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Appointment Changed Successfully! ');</script>"); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Please check required fields again.');</script>"); } finally { check.Text = year.SelectedItem.ToString() + month.SelectedItem.ToString() + day.SelectedItem.ToString() + time.SelectedItem.ToString(); } }
protected void StartIssue_Click(object sender, EventArgs e) { PetID = PetIDList.SelectedValue.ToString(); PrescList newPresc = new PrescList(PrescID, PetID, PrescOrderDate); try { ConnectionClass.PrescriptionList(newPresc); ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Success! ');</script>"); displayPetID.Text = PetID; displayPrescID.Text = newPresc.PrescID; // This goes to prescriptionID and array } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('failed');</script>"); } finally { } }
protected void save(object sender, EventArgs e) { // Populating array of Prescription ID, same length of Medication IDs and Medication Quantities string TPrescID = displayPrescID.Text; string[] PrescID = new string[MediArray.Length]; for (int i = 0; i < MediArray.Length; i++) { PrescID[i] = TPrescID; } PrescDetail newPrescDetails = new PrescDetail(PrescID, MediIDArray, MediQtyArray); try { ConnectionClass.SaveNewPresc(newPrescDetails); ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Prescription saved successfully! ');</script>"); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert(' Cancelled ');</script>"); } }
// getting petID by selecting customerID protected void selectcustomer(object sender, EventArgs e) { petIDList.Items.Clear(); Oid = cusIDList.SelectedValue.ToString(); CustomerPets CPets = new CustomerPets(Oid, pids, pnames); try { ConnectionClass.GetPetIDList(CPets); petIDList.DataSource = CPets.PetIDs; petIDList.DataTextField = CPets.PetIDs.Columns["NAME"].ToString(); petIDList.DataValueField = CPets.PetIDs.Columns["ID"].ToString(); // IDs 지만 ID랑 NAME 둘다 있음 (첫번째 칼럼 : ID, 두번째칼럼: NAME) // 첫번째 칼럼 (ID) 는 DataValueField에, 두번째 칼럼 (NAME) 은 DataTextField에 넣어준다 petIDList.DataBind(); } finally { } }
//string cs = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; protected void checkPnumEmail_Click(object sender, EventArgs e) { emailaddress = eMail.Text; phonenum = pNumber.Text; // checking phone number & email (1) validate phone number & email format with regex if (Regex.IsMatch(emailaddress, "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$") && Regex.IsMatch(phonenum, "^[0][1-9]\\d{9}$|^[1-9]\\d{9}$")) { emailCheck.Text = " * Valid email address :)"; emailCheck.ForeColor = System.Drawing.Color.Blue; emailCheck.Visible = true; pnumCheck.Text = " * Valid phone number :)"; pnumCheck.ForeColor = System.Drawing.Color.Blue; pnumCheck.Visible = true; // checking email (2) avoid duplicate email in DB // Initialize Customer Class & connect to Oracle DB via ConnectionClass Customer newCustomer = new Customer(ownerID, firstname, lastname, emailaddress, phonenum); ConnectionClass.AvoidDuplicateEmail(newCustomer); // if email is existing one,prompt user to use other email address if (newCustomer.emailAddress == "EXIST") { // prompt user to use other email emailCheck.Text = " * Already in use"; emailCheck.ForeColor = System.Drawing.Color.Red; emailCheck.Visible = true; Response.Write("<script type='text/javascript'>"); Response.Write("alert('This email address is already registered, Please use another email');"); Response.Write("</script>"); } else { emailCheck.Text = " * You can use this email address"; emailCheck.Visible = true; Response.Write("<script type='text/javascript'>"); Response.Write("alert('Information check finished, Ready to register :) ');"); Response.Write("</script>"); fName.Enabled = false; lName.Enabled = false; pNumber.Enabled = false; eMail.Enabled = false; register.Visible = true; } } else if (Regex.IsMatch(emailaddress, "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$")) { pnumCheck.Text = " * Please enter a valid phone number."; pnumCheck.ForeColor = System.Drawing.Color.Red; pnumCheck.Visible = true; emailCheck.Text = " * Valid email address :)"; emailCheck.ForeColor = System.Drawing.Color.Blue; emailCheck.Visible = true; } else if (Regex.IsMatch(phonenum, "^[0][1-9]\\d{9}$|^[1-9]\\d{9}$")) { emailCheck.Text = " * Please enter a valid email address."; emailCheck.ForeColor = System.Drawing.Color.Red; emailCheck.Visible = true; pnumCheck.Text = " * Valid phone number :)"; pnumCheck.ForeColor = System.Drawing.Color.Blue; pnumCheck.Visible = true; } else { pnumCheck.Text = " * Please enter a valid phone number."; pnumCheck.ForeColor = System.Drawing.Color.Red; pnumCheck.Visible = true; emailCheck.Text = " * Please enter a valid email address."; emailCheck.ForeColor = System.Drawing.Color.Red; emailCheck.Visible = true; } }