public ClassLookup() { _classes = new Dictionary <string, string>(); XmlElement xmlClasses = QueryClass.GetClassList().GetContent().BaseElement; foreach (XmlElement each in xmlClasses.SelectNodes("Class")) { string className = each.SelectSingleNode("ClassName").InnerText; string classId = each.GetAttribute("ID"); _classes.Add(className, classId); } }
public PublicIPResolverOverDnsOptions( string query, QueryType type, QueryClass cls, List <IPAddress> ipv4NameServers, List <IPAddress> ipv6NameServers ) { Query = query; QueryType = type; QueryClass = cls; IPv4NameServers = ipv4NameServers; IPv6NameServers = ipv6NameServers; }
protected void Page_Load(object sender, EventArgs e) { postage = Request.QueryString["postage"]; int index = Convert.ToInt32(postage); if (postage != null && !IsPostBack) { PostageOptions o = QueryClass.GetPostageOptionByName(postage); pricePostage.Text = o.Price.ToString("F"); namePostage.Text = o.Name; descriptionPostage.Text = o.Description; etaPostage.Text = o.ETA.ToString(); hiddenID.Text = o.ID.ToString(); } }
protected void btnAddToCart_Click(object sender, EventArgs e) { //Checks to see if product which will be the number to get an item from a list is not null int productIndex = Convert.ToInt32(productID); List <Product> cart = new List <Product>(); bool isCartNew = false; //gets the cart or sets a new one if (Session["cart"] == null) { isCartNew = true; } else { cart = (List <Product>)Session["cart"]; } Product p = QueryClass.GetProduct(productIndex);; if (isCartNew) { cart.Add(p); Session.Add("cart", cart); } else { int positionIndex = -1; //find said product in the cart for (int i = 0; i < cart.Count; i++) { if (cart[i].Name.Equals(p.Name)) { positionIndex = i; } } if (positionIndex == -1) { cart.Add(p); } //if found, only adds item if there is enought stock else if (p.Stock > cart[positionIndex].Quantity) { cart[positionIndex].Quantity += 1; } Session["cart"] = cart; } }
public DataSet RunRetrieveQueryEx() { QueryClass lcQuery; if (!String.IsNullOrEmpty(ActiveRow.RetrieveQuery)) { lcQuery = new QueryClass(ActiveRow.RetrieveQuery, clConnectionMode); ReplaceQueryPlaceHolder(lcQuery); lcQuery.ReplaceDictionaryPlaceHolder(clFormParam); return(lcQuery.RunQueryEx()); } else { return(null); } }
/* * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | | / / | / NAME / | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TYPE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | CLASS | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TTL | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | RDLENGTH | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| | / RDATA / | / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ */ public BaseResourceRecordInfo ReadRecordInfo(ArraySegment <byte> data) { IDnsString domainName = _reader.ReadQuestionQueryString(data); // domain name ResourceRecordType recordType = (ResourceRecordType)_reader.ReadUInt16NetworkOrder(data); // record type QueryClass queryClass = (QueryClass)_reader.ReadUInt16NetworkOrder(data); // query class int timeToLive = (int)_reader.ReadUInt32NetworkOrder(data); // ttl - 32bit!! int rawDataLength = _reader.ReadUInt16NetworkOrder(data); // RDLength return(new BaseResourceRecordInfo( recordType, // record type queryClass, // query class timeToLive, // ttl - 32bit!! rawDataLength, // RDLength domainName // domain name )); }
public bool InsertRecord() { QueryClass lcQuery; if (clNewRecord) { lcQuery = new QueryClass(QueryClass.QueryType.InsertSessionRow); lcQuery.ReplaceRowPlaceHolder(clActiveRow.Row); return(lcQuery.ExecuteNonQuery() > 0); } else { return(false); } }
private AppManifestRow GetAppManifestRow(String paSubscriptionID) { DataTable lcDataTable; QueryClass lcQuery; lcQuery = new QueryClass(QueryClass.QueryType.GetAppManifestRow); lcQuery.ReplacePlaceHolder("$SUBSCRIPTIONID", paSubscriptionID, true); if (((lcDataTable = lcQuery.RunQuery()) != null) && (lcDataTable.Rows.Count > 0)) { return(new AppManifestRow(lcDataTable.Rows[0])); } else { return(null); } }
static private FormInfoRow GetFormInfoRow(String paFormName) { QueryClass lcQuery; DataTable lcDataTable; lcQuery = new QueryClass(QueryClass.QueryType.GetFormInfoRow); lcQuery.ReplacePlaceHolder("$FORMNAME", paFormName, true); if (((lcDataTable = lcQuery.RunQuery()) != null) && (lcDataTable.Rows.Count > 0)) { return(new FormInfoRow(lcDataTable.Rows[0])); } else { return(null); } }
private void ChooseQuery(QueryType paQueryType) { switch (paQueryType) { case QueryType.GetPOSReceiptRow: clQueryClass = new QueryClass(ctGetPOSReceiptRow, clConnectionMode); break; case QueryType.GetPOSLastReceiptNo: clQueryClass = new QueryClass(ctGetPOSLastReceiptNo, clConnectionMode); break; case QueryType.GetPOSStakeHolderRowByStakeHolderID: clQueryClass = new QueryClass(ctGetPOSStakeHolderRowByStakeHolderID, clConnectionMode); break; case QueryType.GetPOSStakeHolderRowByCodeNo: clQueryClass = new QueryClass(ctGetPOSStakeHolderRowByCodeNo, clConnectionMode); break; case QueryType.POSUpdateReceipt: clQueryClass = new QueryClass(ctPOSUpdateReceipt, clConnectionMode); break; } clQueryClass.ReplacePlaceHolder("$SUBSCRIPTIONID", ApplicationFrame.GetInstance().ActiveSubscription.ActiveRow.SubscriptionID, true); }
protected static SessionRow GetSessionRow(String paSessionKey) { QueryClass lcQuery; DataTable lcDataTable; lcQuery = new QueryClass(QueryClass.QueryType.GetSessionRowBySessionKey); lcQuery.ReplacePlaceHolder("$SESSIONKEY", paSessionKey, true); if (((lcDataTable = lcQuery.RunQuery()) != null) && (lcDataTable.Rows.Count > 0)) { return(new SessionRow(lcDataTable.Rows[0])); } else { return(null); } }
protected void btnLogin_Click(object sender, System.EventArgs e) { string email = ((TextBox)FindControl("logEmail")).Text; string pword = ((TextBox)FindControl("logPassword")).Text; User u = QueryClass.GetUser(email, pword); if (u.ID != 0) { //User logged in Session.Add("user", u); Response.Redirect("Main"); } else { ((Label)FindControl("errorMessage")).Visible = true; } }
private String[] RetrieveData(String paQueryString) { QueryClass lcQueryClass; DataTable lcDataTable; if (!String.IsNullOrEmpty(paQueryString)) { lcQueryClass = new QueryClass(paQueryString, QueryClass.ConnectionMode.EService); ApplicationFrame.GetInstance().ActiveFormInfoManager.ReplaceQueryPlaceHolder(lcQueryClass); if (((lcDataTable = lcQueryClass.RunQuery()) != null) && (lcDataTable.Rows.Count > 0)) { return(General.SingleDimensionStringArray(lcDataTable.Select(), lcDataTable.Columns[0].ColumnName)); } } return(null); }
private int InsertOrderInfoRecord(OrderInfoRow paOrderInfoRow) { object lcResult; int lcOrderNo; QueryClass lcQuery; lcQuery = new QueryClass(QueryClass.QueryType.InsertOrderInfoRecord); lcQuery.ReplaceRowPlaceHolder(paOrderInfoRow.Row); if (((lcResult = lcQuery.GetResult()) != null) && ((lcOrderNo = Convert.ToInt32(lcResult)) > 0)) { return(lcOrderNo); } else { return(-1); } }
protected static SessionRow GetSessionRow(String paSubscriptionID, String paLoginID) { QueryClass lcQuery; DataTable lcDataTable; lcQuery = new QueryClass(QueryClass.QueryType.GetSessionRow); lcQuery.ReplacePlaceHolder("$SUBSCRIPTIONID", paSubscriptionID, true); lcQuery.ReplacePlaceHolder("$LOGINID", paLoginID, true); if (((lcDataTable = lcQuery.RunQuery()) != null) && (lcDataTable.Rows.Count > 0)) { return(new SessionRow(lcDataTable.Rows[0])); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { mode = Request.QueryString["mode"]; order = Request.QueryString["order"]; user = Request.QueryString["user"]; orders = QueryClass.GetOrders(); int orderID = 0; try { orderID = Convert.ToInt32(order); } catch { } //toggles sent if mode is toggleSent and order exists in url if (mode != null && order != null) { if (mode.Equals("toggleSent")) { //query for toggling sent QueryClass.OrderToggleSent(orderID); if (Request.QueryString["flagSingle"] != null) { orders = new List <Order>(); orders.Add(QueryClass.GetOrder(orderID)); } else { orders = QueryClass.GetOrders(); } } } //populates a single order if order exists in url if (order != null && mode == null) { orders = new List <Order>(); orders.Add(QueryClass.GetOrder(orderID)); } //populates by user if there is a user url param if (user != null) { orders = QueryClass.GetOrdersByUser(user); } }
public bool UpdateData() { String lcPlaceHolder; String lcValue; QueryClass lcMasterQuery; QueryClass lcQueryClass; lcQueryClass = null; lcMasterQuery = null; try { for (int lcCount = 0; lcCount < clDataList.Length; lcCount++) { lcQueryClass = new QueryClass(clUpdateQuery, clConnectionMode); ApplicationFrame.GetInstance().ActiveFormInfoManager.ReplaceQueryPlaceHolder(lcQueryClass); foreach (dynamic lcKey in clDataList[lcCount].Keys) { lcPlaceHolder = "$" + lcKey.ToUpper(); lcValue = Convert.ToString(clDataList[lcCount][lcKey]); lcQueryClass.ReplacePlaceHolder(lcPlaceHolder, lcValue, true); } if (lcMasterQuery == null) { lcMasterQuery = lcQueryClass; } else { lcMasterQuery.SetInnerQuery(lcQueryClass); } } lcMasterQuery.ExecuteNonQueryChain(); return(true); } catch (Exception paException) { General.WriteExceptionLog(paException, "DATALISTUPDATE : " + ApplicationFrame.GetInstance().ActiveSubscription.ActiveRow.SubscriptionID); return(false); } }
private DataTable RetrieveData() { QueryClass lcQuery; if (!String.IsNullOrEmpty(clFormInfoRow.RetrieveQuery)) { try { lcQuery = new QueryClass(clFormInfoRow.RetrieveQuery, clConnectionMode); lcQuery.ReplaceDictionaryPlaceHolder(clFormParam); return(lcQuery.RunQuery()); } catch (Exception paException) { General.WriteExceptionLog(paException, "FORMINFOMANAGER.RETRIEVEDATA"); } } return(null); }
protected void Page_Load(object sender, EventArgs e) { //Receive variable value from another page which is Products where products equals index of list products String productID = Request.QueryString["PassingValue"]; int id = 0; try { id = Convert.ToInt32(productID); } catch { } p = QueryClass.GetProduct(id); //Change the information purchase product to equal the product at a certain index using 'product' variable productViewName.Text = p.Name; productViewPrice.Text = "Price: $" + p.Price.ToString("F"); productViewDescription.Text = p.Description; productViewImage.ImageUrl = p.Image; }
private Hashtable CurrentTests() { // Set up the query. Query psQuery = new QueryClass(); psQuery.CountOnly = false; psQuery.SelectionCriteria = QUERY_ACTIVE; psQuery.DatastoreItemType = PsDatastoreItemTypeEnum.psDatastoreItemTypeTestCase; DatastoreItemList psDataList = new DatastoreItemListClass(); psDataList.Query = psQuery; psDataList.Datastore = m_psDataStore; FieldDefinitions psFields = m_psDataStore.FieldDefinitions; // Add fields with the FieldDefinitions indexer psQuery.QueryFields.Clear(); for (int fieldCount = 0; fieldCount < TEST_CASE_FIELDS.Length; fieldCount++) { psQuery.QueryFields.Add(psFields[TEST_CASE_FIELDS[fieldCount]]); } // Add fields to sort by for (int fieldCount = 0; fieldCount < TEST_CASE_SORT.Length; fieldCount++) { psQuery.QuerySortFields.Add( psFields[TEST_CASE_SORT[fieldCount]], PsSortTypeEnum.psSortTypeAscending); } Hashtable res = new Hashtable(); psDataList.Execute(); foreach (DatastoreItem psItem in psDataList.DatastoreItems) { object module = psItem.Fields["Test Module"].Value; object suite = psItem.Fields["Test Suite"].Value; object testcase = psItem.Fields["TestCase"].Value; res[TestKey(module, suite, testcase)] = psItem.Fields["ID"].Value; } return(res); }
protected void btnSubmit_Click(object sender, EventArgs e) { PostageOptions o = new PostageOptions(); o.Price = Convert.ToDouble(pricePostage.Text); o.Description = descriptionPostage.Text; o.Name = namePostage.Text; o.ETA = Convert.ToInt32(etaPostage.Text); // Add new postage option if (hiddenID.Text.Equals("")) { QueryClass.AddPostageOption(o); } else { //Update Postage QueryClass.UpdatePostageOption(o); } Response.Redirect("ManagePostage.aspx"); }
private bool UpdatDataRecord(Dictionary <String, String> paActiveDataList) { QueryClass lcQuery; try { lcQuery = new QueryClass(clUpdateQuery, clConnectionMode); lcQuery.ReplaceDictionaryPlaceHolder(paActiveDataList); lcQuery.ReplacePlaceHolder("$COLUMNLIST", "N\'(" + paActiveDataList.GetData(ctKEYDataColumnList) + ")\'", false); lcQuery.ReplacePlaceHolder("$VALUELIST", BuildSQLValueString(paActiveDataList, ctKEYDataColumnList, ctComma), false); lcQuery.ReplacePlaceHolder("$UPDATEDATASTRING", BuildSQLColumnValueString(paActiveDataList, ctKEYDataColumnList, ctComma), false); lcQuery.ReplacePlaceHolder("$CONDITIONSTRING", BuildSQLColumnValueString(paActiveDataList, ctKEYKeyColumnList, " And "), false); return(lcQuery.ExecuteNonQuery() > 0); } catch (Exception paException) { General.WriteExceptionLog(paException, "UPDATEDATA : " + ApplicationFrame.GetInstance().ActiveSubscription.ActiveRow.SubscriptionID); return(false); } }
protected void Page_Load(object sender, EventArgs e) { //Get value of mode and product from when button is clicked to determine which button is clicked mode = Request.QueryString["mode"]; product = Request.QueryString["product"]; products = QueryClass.GetProductData(); if (mode != null) { if (mode.Equals("DeleteItem")) { //Delete an item depending on product which acts as index pointer GlobalData.productList.RemoveAt(Convert.ToInt32(product)); } if (mode.Equals("UpdateItem")) { //Open up update page sending the product value so the correct product can be determined Response.Redirect("Update.aspx?PassingValue=" + Server.UrlEncode(product)); } } }
protected void Page_Load(object sender, EventArgs e) { mode = Request.QueryString["mode"]; order = Request.QueryString["order"]; user = Request.QueryString["user"]; int i = 0; try { Convert.ToInt32(order); } catch { } if (mode == null && order != null) { orders = new List <Order>(); orders.Add(QueryClass.GetOrder(i)); } //if these are true, the user shouldnt be here if (user == null && order == null) { Response.Redirect("Main"); } orders = QueryClass.GetOrdersByUser(user); if (mode != null && order != null) { if (mode.Equals("toggleSent")) { try{ Convert.ToInt32(order); } catch { } //Change status of order if admin changes the status QueryClass.OrderToggleSent(i); } if (Request.QueryString["flagSingle"] == null) { orders = QueryClass.GetOrdersByUser(user); } else { orders = new List <Order>(); orders.Add(QueryClass.GetOrder(i)); } } }
private void cboClass_SelectedIndexChanged_1(object sender, EventArgs e) { OnValueChanged("RefClassID", cboClass.GetValue()); //string seatNo = cboSeatNo.Text; //SetSeatNo(seatNo); cboSeatNo.Text = ""; //if (cboClass.GetValue() == "") // cboSeatNo.Enabled = false; //else GetClassSeatNoList(cboClass.GetValue()); try { KeyValuePair <string, string> kv = ((KeyValuePair <string, string>)cboClass.SelectedItem); DSResponse rsp = QueryClass.GetClass(kv.Key); // (string.IsNullOrEmpty(cboDept.Text)) cboDept.WatermarkText = rsp.GetContent().GetText("Class/Department"); } catch { } }
protected void Page_Load(object sender, EventArgs e) { string mode = Request.QueryString["mode"]; string email = Request.QueryString["user"]; users = QueryClass.GetUsers(); orders = QueryClass.GetOrders(); if (mode != null) { //Suspend a user if (mode.Equals("toggleSuspend") && !((User)Session["user"]).Email.Equals(email)) { QueryClass.ToggleSuspendUser(email); } //Delete a user if (mode.Equals("delete") && !((User)Session["user"]).Email.Equals(email)) { QueryClass.ToggleDeleteUser(email); } } }
protected void updateConfirmBtn_Clicked(object sender, System.EventArgs e) { //Store updated values in variables string updateCategory = productUpdateCategory.Text; string updateName = productUpdateName.Text; int updateStock = Convert.ToInt32(productUpdateStock.Text); string updateDescription = productUpdateDescription.Text; double updatePrice = Convert.ToDouble(productUpdatePrice.Text); int updateQuantity = Convert.ToInt32(productUpdateQuantity.Text); string InsertImage = "../img/" + Convert.ToString(updateFileUploadImg.FileName); //Checks to see if all the inputs are valid if (IsValid) { //Checks to see if file type is an image if (updateFileUploadImg.PostedFile.ContentType == "image/jpeg" || updateFileUploadImg.PostedFile.ContentType == "image/png" || updateFileUploadImg.PostedFile.ContentType == "image/jpg") { //Make error message invisible if file type is correct updateImageFileError.Visible = false; //Save image to project updateFileUploadImg.SaveAs(Server.MapPath("~/../img/" + updateFileUploadImg.FileName)); //Change dummy data in global data to equal to updated data p.Category = updateCategory; p.Name = updateName; p.Stock = updateStock; p.Description = updateDescription; p.Price = updatePrice; p.Quantity = updateQuantity; p.Image = InsertImage; QueryClass.UpdateProduct(p); Response.Redirect("ManageProducts.aspx"); } else { //make error message visbile updateImageFileError.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { mode = Request.QueryString["mode"]; order = Request.QueryString["order"]; user = Request.QueryString["user"]; orders = QueryClass.GetOrders(); if (mode != null && order != null) { if (mode.Equals("toggleSent")) { if (GlobalData.Orders[Convert.ToInt32(order)].Status.Equals("Processing")) { GlobalData.Orders[Convert.ToInt32(order)].Status = "Sent"; } else if (GlobalData.Orders[Convert.ToInt32(order)].Status.Equals("Sent")) { GlobalData.Orders[Convert.ToInt32(order)].Status = "Processing"; } } } }
protected void Page_Load(object sender, EventArgs e) { //Stops page from repopulating with previous data if (!IsPostBack) { //Request product value from viewProduct page depending on which product is selected string product = Request.QueryString["product"]; int productID = 0; try { productID = Convert.ToInt32(product); } catch { } p = QueryClass.GetProduct(productID); //Change textbox text to equal product values of item selected productUpdateName.Text = p.Name; productUpdateCategory.Text = p.Category; productUpdateStock.Text = p.Stock.ToString(); productUpdateDescription.Text = p.Description; productUpdatePrice.Text = p.Price.ToString("F"); productUpdateQuantity.Text = p.Quantity.ToString(); } }
protected void btnConfirm_Click(object sender, System.EventArgs e) { //Update/Change user information on submit if (IsValid) { User user = (User)Session["user"]; user.FirstName = ((TextBox)FindControl("firstName")).Text; user.LastName = ((TextBox)FindControl("lastName")).Text; user.Street = ((TextBox)FindControl("streetAddress")).Text; user.Suburb = ((TextBox)FindControl("suburb")).Text; user.Postcode = ((TextBox)FindControl("postCode")).Text; user.DOB = ((TextBox)FindControl("birthDate")).Text; user.Phone = ((TextBox)FindControl("firstName")).Text; QueryClass.UpdateUser(user); Session["user"] = user; Response.Redirect("Main.aspx"); } // Error message displayed if fields are not correctly filled else { ((Label)FindControl("errorMessage")).Visible = true; } }
public DnsQuery(string domainName, QueryType qType) { DomainName = domainName; QueryType = qType; QueryClass = QueryClass.Internet; }
public DnsQuery(string domainName, QueryType qtype, QueryClass qclass) { DomainName = domainName; QueryType = qtype; QueryClass = qclass; }