/// <summary> /// /// </summary> protected void BindProfiles() { ProfileAdmin profileAdmin = new ProfileAdmin(); TList<Profile> profileList = profileAdmin.GetAll(); foreach (Profile entity in profileList) { Literal ltrl = new Literal(); ltrl.Text = "<div class=\"FieldStyle\">" + entity.Name + "</div><div class=\"ValueStyle\">"; TextBox textBox = new TextBox(); textBox.ID = "txtProfile" + entity.ProfileID.ToString(); XmlNode node = QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ProfileID" + entity.ProfileID.ToString() + "']"); if (node != null) { textBox.Text = node.Attributes["MsgValue"].Value; } Literal newLine = new Literal(); newLine.Text = "</div>"; ControlPlaceHolder.Controls.Add(ltrl); ControlPlaceHolder.Controls.Add(textBox); ControlPlaceHolder.Controls.Add(newLine); } }
/// <summary> /// Bind List controls /// </summary> public void BindData() { // Bind DiscountTypes ZNode.Libraries.Admin.PromotionAdmin Discountname = new ZNode.Libraries.Admin.PromotionAdmin(); DiscountType.DataSource = Discountname.GetAllDiscountTypes(); DiscountType.DataTextField = "Name"; DiscountType.DataValueField = "ClassName"; DiscountType.DataBind(); ProfileAdmin profileAdmin = new ProfileAdmin(); ddlProfileTypes.DataSource = profileAdmin.GetAll(); ddlProfileTypes.DataTextField = "Name"; ddlProfileTypes.DataValueField = "ProfileID"; ddlProfileTypes.DataBind(); ListItem li = new ListItem("All Profiles", "0"); ddlProfileTypes.Items.Insert(0, li); ddlProfileTypes.SelectedValue = "0"; }
/// <summary> /// Binds Profile dropdown list /// </summary> private void Bind() { ProfileAdmin profileAdmin = new ProfileAdmin(); ddlProfiles.DataSource = profileAdmin.GetAll(); ddlProfiles.DataTextField = "Name"; ddlProfiles.DataValueField = "ProfileId"; ddlProfiles.DataBind(); ListItem li = new ListItem("Apply to All Profiles", "0"); ddlProfiles.Items.Insert(0,li); }
/// <summary> /// Binds Account Type drop-down list /// </summary> private void BindProfile() { ZNode.Libraries.Admin.ProfileAdmin _Profileadmin = new ProfileAdmin(); ListProfileType.DataSource = _Profileadmin.GetAll(); ListProfileType.DataTextField = "name"; ListProfileType.DataValueField = "profileID"; ListProfileType.DataBind(); }
/// <summary> /// Submit Button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='SalesTaxItem']").Attributes["MsgValue"].Value = txtTaxItem.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='DiscountItemName']").Attributes["MsgValue"].Value = txtDiscountItem.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ShippingItemName']").Attributes["MsgValue"].Value = txtShippingItem.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='SalesIncomeAccount']").Attributes["MsgValue"].Value = txtIncomeAccount.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='CostofGoodsSoldAccount']").Attributes["MsgValue"].Value = txtCOGSAccount.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='InventoryAssetAccount']").Attributes["MsgValue"].Value = txtAssetAccount.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='SalesReceiptMessage']").Attributes["MsgValue"].Value = txtSalesCustomerMessage.Text; QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='CompanyFilePath']").Attributes["MsgValue"].Value = txtCompanyFile.Text.Trim(); QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='OrdersDownloadType']").Attributes["MsgValue"].Value = lstorderDownloadType.SelectedValue; ProfileAdmin profileAdmin = new ProfileAdmin(); TList<Profile> profileList = profileAdmin.GetAll(); foreach (Profile entity in profileList) { TextBox txt = (TextBox)ControlPlaceHolder.FindControl("txtProfile" + entity.ProfileID.ToString()); XmlNode node = QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ProfileID" + entity.ProfileID.ToString() + "']"); if (node != null) { node.Attributes["MsgValue"].Value = txt.Text.Trim(); } else { XmlElement element = QBXmlDataSource.GetXmlDocument().CreateElement("Message"); element.SetAttribute("MsgKey", "ProfileID" + entity.ProfileID.ToString()); element.SetAttribute("MsgDescription", ""); element.SetAttribute("MsgValue", txt.Text.Trim()); QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages").AppendChild(element); } } try { QBXmlDataSource.Save(); } catch { //display error message lblMsg.Text = "An error occurred while updating. Please try again."; } Response.Redirect("~/admin/secure/settings/default.aspx?mode=quickbooks"); }
/// <summary> /// Bind Grid /// </summary> protected void Bind() { ProfileAdmin profileAdmin = new ProfileAdmin(); uxGrid.DataSource = profileAdmin.GetAll(); uxGrid.DataBind(); }
/// <summary> /// Binds Account Type drop-down list /// </summary> private void BindProfile() { ZNode.Libraries.Admin.ProfileAdmin _Profileadmin = new ProfileAdmin(); ListProfileType.DataSource = _Profileadmin.GetAll(); ListProfileType.DataTextField = "name"; ListProfileType.DataValueField = "profileID"; ListProfileType.DataBind(); if (AccountID == 0) { ProfileAdmin AdminAccess = new ProfileAdmin(); Profile entity = AdminAccess.GetByProfileID(int.Parse(ListProfileType.SelectedValue)); if (entity != null) { txtExternalAccNumber.Text = entity.DefaultExternalAccountNo; } } }
/// <summary> /// Page Load Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Request.Params["filter"] != null) { Mode = Request.Params["filter"]; } if (!Page.IsPostBack) { // Load Order State Item OrderAdmin _OrderAdminAccess = new OrderAdmin(); ddlOrderStatus.DataSource = _OrderAdminAccess.GetAllOrderStates(); ddlOrderStatus.DataTextField = "orderstatename"; ddlOrderStatus.DataValueField = "Orderstateid"; ddlOrderStatus.DataBind(); ListItem item1 = new ListItem("ALL", "0"); ddlOrderStatus.Items.Insert(0, item1); ddlOrderStatus.SelectedIndex = 0; // Load Profile Types ProfileAdmin profileAdmin = new ProfileAdmin(); ddlProfilename.DataSource = profileAdmin.GetAll(); ddlProfilename.DataTextField = "Name"; ddlProfilename.DataValueField = "ProfileID"; ddlProfilename.DataBind(); ListItem item2 = new ListItem("ALL", "0"); ddlProfilename.Items.Insert(0, item2); ddlProfilename.SelectedIndex = 0; // Get Filetered Orders in DataSet OrderAdmin _OrderAdmin = new OrderAdmin(); dsOrders = _OrderAdmin.ReportList(Mode, Year, ""); dsOrdersLineItems = _OrderAdmin.GetAllOrderLineItems().ToDataSet(false); DataView dv = new DataView(dsOrders.Tables[0]); if (Request.Params["filter"] != null) { if (Mode.Equals("12")) { this.objReportViewer.LocalReport.ReportPath = "Admin/Secure/Reports/Orders.rdlc"; pnlOrderStatus.Visible = true; lblOrderStatus.Visible = true; lblOrderStatus.Text = "Order Status"; btnOrderFilter.Text = "Get Orders"; } if (Mode.Equals("21")) { this.objReportViewer.LocalReport.ReportPath = "Admin/Secure/Reports/Accounts.rdlc"; pnlprofile.Visible = true; lblProfileName.Visible = true; lblProfileName.Text = "Profiles"; btnOrderFilter.Text = "Get Details"; } } if (dv.ToTable().Rows.Count == 0) { lblErrorMsg.Text = "No records found"; objReportViewer.Visible = false; pnlCustom.Visible = false; return; } objReportViewer.LocalReport.DataSources.Clear(); ReportParameter param1 = new ReportParameter("CurrentLanguage", System.Globalization.CultureInfo.CurrentCulture.Name); objReportViewer.LocalReport.SetParameters(new ReportParameter[] { param1 }); this.objReportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); if (Mode.Equals("12")) objReportViewer.LocalReport.DataSources.Add(new ReportDataSource("ZNodeOrderDataSet_ZNodeOrder", dv)); else if(Mode.Equals("21")) objReportViewer.LocalReport.DataSources.Add(new ReportDataSource("ZNodeAccountDataSet_ZNodeAccount", dv)); objReportViewer.LocalReport.Refresh(); } }