-
Notifications
You must be signed in to change notification settings - Fork 0
/
createInteraction.aspx.cs
88 lines (82 loc) · 2.97 KB
/
createInteraction.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PhamacyDB
{
public partial class createInteraction : System.Web.UI.Page
{
String InterChemicalName =null;
String InterChemicalName2 = null;
String InterSubCategoryName = null;
protected void Page_Load(object sender, EventArgs e)
{
parseArguments();
if (!IsPostBack)
{
loadMenus();
}
}
private void parseArguments()
{
InterChemicalName = Request["chemicalName"];
if (InterChemicalName == null)
{
InterChemicalName = "";
}
InterChemicalName2 = Request["chemicalName2"];
if (InterChemicalName2 == null)
{
InterChemicalName2 = "";
}
InterSubCategoryName = Request["subCategory"];
if (InterSubCategoryName == null)
{
InterSubCategoryName = "";
}
txtInterP1.Text = InterChemicalName;
if (InterSubCategoryName != "")
{
txtInterP2.Text = InterSubCategoryName;
txtInterP2Name.Text = "Sub Category: ";
}
else if (InterChemicalName2 != null)
{
txtInterP2.Text = InterChemicalName2;
}
else
{
Response.Redirect("Error.aspx");
}
}
private void loadMenus()
{
menu.InnerHtml += Util.Menu.createAdminMenu(Request.Url.LocalPath);
footerMenu.InnerHtml += Util.Menu.createFooterMenu();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
DatabaseDataContext db = new DatabaseDataContext();
if (InterChemicalName2 != "")
{
InteractionPharmacyPharmacy tmpItem = new InteractionPharmacyPharmacy();
tmpItem.pharmacyname1 = InterChemicalName;
tmpItem.pharmacyname2 = InterChemicalName2;
tmpItem.comment = txtInterComment.Text;
db.InteractionPharmacyPharmacies.InsertOnSubmit(tmpItem);
}
else if (InterSubCategoryName != null)
{
InteractionPharmacySubCategory tmpItem = new InteractionPharmacySubCategory();
tmpItem.chemicalName = InterChemicalName;
tmpItem.subCategoryName = InterSubCategoryName;
tmpItem.comment = txtInterComment.Text;
db.InteractionPharmacySubCategories.InsertOnSubmit(tmpItem);
}
db.SubmitChanges();
Response.Redirect(Util.UrlRewriting.encodeUrl("updateInteraction.aspx?chemicalName="+InterChemicalName));
}
}
}