protected void OnCommandClick(object sender, CommandEventArgs e) { //Event handler for command button clicked try { switch (e.CommandName) { case "Cancel": Response.Redirect("~/Default.aspx?issueID=" + this.mIssueID.ToString()); break; case "OK": if (this.fuAttachment.HasFile) { Argix.Customers.Attachment attachment = new Argix.Customers.Attachment(); attachment.Filename = this.fuAttachment.FileName; attachment.File = this.fuAttachment.FileBytes; attachment.ActionID = this.mActionID; bool ret = new CustomersGateway().AddAttachment(attachment); Response.Redirect("~/Default.aspx?issueID=" + this.mIssueID.ToString()); } else { Master.ShowMsgBox("Please select a file."); } break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnCompanyChanged(object sender, EventArgs e) { //Event handler for change in selected company try { //Validate if (this.cboCompany.SelectedItem == null) { return; } //Set applicable scopes for companies (i.e. client, pre-paid vendor) string number = this.cboCompany.SelectedValue; CompanyDataset companies = new CustomersGateway().GetCompanies(); CompanyDataset.CompanyTableRow[] rows = (CompanyDataset.CompanyTableRow[])companies.CompanyTable.Select("Number='" + number + "'"); this.cboScope.Items.Clear(); this.cboScope.Items.AddRange(new ListItem[] { new ListItem(SCOPE_AGENTS) }); this.cboScope.SelectedValue = SCOPE_AGENTS; if (rows.Length > 0 && rows[0].CompanyType == "20") { this.cboScope.Items.AddRange(new ListItem[] { new ListItem(SCOPE_STORES), new ListItem(SCOPE_SUBSTORES) }); this.cboScope.SelectedValue = SCOPE_STORES; } //Update locations since company changed this.cboScope.Enabled = true; OnScopeChanged(null, EventArgs.Empty); } catch (Exception ex) { Master.ReportError(ex); } }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for page load event if (!Page.IsPostBack) { //Get query params CRMDataset issues = new CustomersGateway().ViewIssues(null); for (int i = 0; i < issues.IssueTable.Rows.Count; i++) { CRMDataset.IssueTableRow issue = issues.IssueTable[i]; TableCell zone = new TableCell(); zone.BorderStyle = BorderStyle.Solid; zone.BorderWidth = 1; zone.BorderColor = System.Drawing.Color.LightGray; zone.Text = !issue.IsZoneNull()?issue.Zone:""; TableCell store = new TableCell(); store.BorderStyle = BorderStyle.Solid; store.BorderWidth = 1; store.BorderColor = System.Drawing.Color.LightGray; store.Text = !issue.IsStoreNumberNull()?issue.StoreNumber.ToString():""; TableCell agent = new TableCell(); agent.BorderStyle = BorderStyle.Solid; agent.BorderWidth = 1; agent.BorderColor = System.Drawing.Color.LightGray; agent.Text = !issue.IsAgentNumberNull()?issue.AgentNumber:""; TableCell company = new TableCell(); company.BorderStyle = BorderStyle.Solid; company.BorderWidth = 1; company.BorderColor = System.Drawing.Color.LightGray; company.Text = !issue.IsCompanyNameNull()?issue.CompanyName:""; TableCell type = new TableCell(); type.BorderStyle = BorderStyle.Solid; type.BorderWidth = 1; type.BorderColor = System.Drawing.Color.LightGray; type.Text = issue.Type; TableCell action = new TableCell(); action.BorderStyle = BorderStyle.Solid; action.BorderWidth = 1; action.BorderColor = System.Drawing.Color.LightGray; action.Text = issue.LastActionDescription; TableCell received = new TableCell(); received.BorderStyle = BorderStyle.Solid; received.BorderWidth = 1; received.BorderColor = System.Drawing.Color.LightGray; received.Text = issue.LastActionCreated.ToString("MM/dd/yyyy"); TableCell subject = new TableCell(); subject.BorderStyle = BorderStyle.Solid; subject.BorderWidth = 1; subject.BorderColor = System.Drawing.Color.LightGray; subject.Text = !issue.IsSubjectNull()?issue.Subject:""; TableCell contact = new TableCell(); contact.BorderStyle = BorderStyle.Solid; contact.BorderWidth = 1; contact.BorderColor = System.Drawing.Color.LightGray; contact.Text = !issue.IsContactNull()?issue.Contact:""; TableCell lastuser = new TableCell(); lastuser.BorderStyle = BorderStyle.Solid; lastuser.BorderWidth = 1; lastuser.BorderColor = System.Drawing.Color.LightGray; lastuser.Text = issue.LastActionUserID; TableCell coordinator = new TableCell(); coordinator.BorderStyle = BorderStyle.Solid; coordinator.BorderWidth = 1; coordinator.BorderColor = System.Drawing.Color.LightGray; coordinator.Text = issue.Coordinator; TableRow tr = new TableRow(); tr.Cells.AddRange(new TableCell[] { zone, store, agent, company, type, action, received, subject, contact, lastuser, coordinator }); this.tblPage.Rows.Add(tr); } } }
private void showStoreDetail() { // try { this.txtStoreDetail.Text = ""; if (this.cboCompany.SelectedValue.Length > 0 && this.txtStore.Text.Length > 0) { StoreDataset ds = new StoreDataset(); CompanyDataset companies = new CustomersGateway().GetCompanies(); CompanyDataset.CompanyTableRow[] rows = (CompanyDataset.CompanyTableRow[])companies.CompanyTable.Select("Number='" + this.cboCompany.SelectedValue + "'"); if (rows.Length > 0) { int companyID = rows[0].CompanyID; switch (this.cboScope.SelectedItem.ToString()) { case SCOPE_STORES: ds.Merge(new CustomersGateway().GetStoreDetail(companyID, Convert.ToInt32(this.txtStore.Text))); break; case SCOPE_SUBSTORES: ds.Merge(new CustomersGateway().GetStoreDetail(companyID, this.txtStore.Text)); break; } if (ds.StoreTable.Rows.Count > 0) { this.txtStoreDetail.Text = getStoreDetailString(ds); } } } } catch (Exception ex) { Master.ReportError(ex); } }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for page load event try { //Get attachment id and filename from query int id = Convert.ToInt32(Request.QueryString["id"]); string filename = Request.QueryString["name"]; //Return attachment as byte array from database (BLOB) CustomersGateway crgService = new CustomersGateway(); byte[] bytes = crgService.GetAttachment(id); //Render to browser HttpResponse response = this.Context.Response; response.BufferOutput = true; response.AddHeader("Content-Disposition", "attachment;filename=" + filename); response.ContentType = "application/octet-stream"; try { string ext = filename.Substring(filename.IndexOf(".") + 1, 3).ToLower(); switch (ext) { case "doc": response.ContentType = "application/msword"; break; case "jpeg": response.ContentType = "image/jpeg"; break; case "msg": response.ContentType = "application/vnd.ms-outlook"; break; case "ppt": response.ContentType = "application/ppt"; break; case "pdf": response.ContentType = "application/pdf"; break; case "tif": response.ContentType = "image/tiff"; break; case "txt": response.ContentType = "text/plain"; break; case "xls": response.ContentType = "application/vnd.ms-excel"; break; case "xlsx": response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; default: response.ContentType = "application/octet-stream"; break; } } catch { } response.BinaryWrite(bytes); } catch (Exception ex) { this.Context.Response.Write(ex.ToString()); } }
protected void OnCommandClick(object sender, CommandEventArgs e) { //Event handler for command button clicked try { switch (e.CommandName) { case "Cancel": Response.Redirect("~/Default.aspx"); break; case "OK": Issue issue = new Issue(); if (this.cboCompany.SelectedValue.Length > 0) { CompanyDataset companies = new CustomersGateway().GetCompanies(); CompanyDataset.CompanyTableRow[] rows = (CompanyDataset.CompanyTableRow[])companies.CompanyTable.Select("Number='" + this.cboCompany.SelectedValue + "'"); issue.CompanyID = rows[0].CompanyID; } switch (this.cboScope.SelectedValue) { case SCOPE_AGENTS: issue.AgentNumber = (this.cboLocation.SelectedValue != "All" ? this.cboLocation.SelectedValue : ""); break; case SCOPE_STORES: issue.StoreNumber = Convert.ToInt32(this.txtStore.Text); break; case SCOPE_SUBSTORES: issue.StoreNumber = Convert.ToInt32(this.txtStore.Text); break; } issue.Contact = this.txtContact.Text; issue.TypeID = Convert.ToInt32(this.cboIssueType.SelectedValue); issue.Subject = this.txtSubject.Text; issue.FirstActionUserID = HttpContext.Current.User.Identity.Name; Argix.Customers.Action action = new Argix.Customers.Action(); action.TypeID = Convert.ToByte(this.cboActionType.SelectedValue); action.IssueID = issue.ID; action.UserID = HttpContext.Current.User.Identity.Name; action.Comment = this.txtComments.Text; action.Created = DateTime.Now; issue.Actions = new Actions(); issue.Actions.Add(action); long id = new CustomersGateway().CreateIssue(issue); Response.Redirect("~/Default.aspx?issueID=" + id.ToString()); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnCommandClick(object sender, CommandEventArgs e) { //Event handler for command button clicked try { switch (e.CommandName) { case "Cancel": Response.Redirect("~/Default.aspx?issueID=" + this.mIssueID.ToString()); break; case "OK": Argix.Customers.Action action = new Argix.Customers.Action(); action.TypeID = Convert.ToByte(this.cboActionType.SelectedValue); action.IssueID = this.mIssueID; action.UserID = HttpContext.Current.User.Identity.Name; action.Comment = this.txtComments.Text; bool ret = new CustomersGateway().AddAction(action); Response.Redirect("~/Default.aspx?issueID=" + this.mIssueID.ToString()); break; } } catch (Exception ex) { Master.ReportError(ex); } }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for page load event if (!Page.IsPostBack) { //Get query params long issueID = Convert.ToInt64(Request.QueryString["issueID"]); CustomersGateway client = new CustomersGateway(); Issue issue = client.GetIssue(issueID); this.lblType.Text = issue.Type; this.lblSubject.Text = issue.Subject; this.lblContact.Text = issue.Contact; this.lblCompany.Text = issue.CompanyName; this.lblStore.Text = issue.StoreNumber.ToString(); this.lblAgent.Text = issue.AgentNumber; this.lblZone.Text = issue.Zone; CustomersGateway cp = new CustomersGateway(); Actions actions = cp.GetIssueActions(issueID); for (int i = 0; i < actions.Count; i++) { string cell = actions[i].Created.ToString("f") + " " + actions[i].UserID + ", " + actions[i].TypeName; cell += "<br /><br />"; cell += actions[i].Comment; cell += "<br />"; cell += "<hr />"; cell += "<br />"; TableCell tc = new TableCell(); tc.Text = cell; TableRow tr = new TableRow(); tr.Cells.Add(tc); this.tblPage.Rows.Add(tr); } } }
protected void OnIssueSelected(object sender, EventArgs e) { //Event handler for change in selected issue try { this.lblSubject.Text = ""; if (this.grdIssues.Rows.Count > 0 && this.grdIssues.SelectedRow != null) { //Unbold viewed issues/actions this.grdIssues.SelectedRow.Font.Bold = false; long id = Convert.ToInt64(this.grdIssues.SelectedDataKey[0]); DateTime dt1; if (DateTime.TryParse(this.grdIssues.SelectedRow.Cells[CELL_LASTACTIONCREATED].Text, out dt1)) { Hashtable oldItems = (Hashtable)ViewState["OldItems"]; if (oldItems.ContainsKey(id)) { oldItems[id] = dt1; } else { oldItems.Add(id, dt1); } ViewState["OldItems"] = oldItems; } //Toolbar print buttons this.btnIssuesPrint.OnClientClick = "javascript:window.open('Issues.aspx','_blank','width=700px,height=440px,toolbar=yes,scrollbars=yes,resizable=yes');return false;"; this.btnActionsPrint.OnClientClick = "javascript:window.open('IssueDetail.aspx?issueID=" + this.grdIssues.SelectedDataKey[0].ToString() + "','_blank','width=700px,height=440px,toolbar=yes,scrollbars=yes,resizable=yes');return false;"; //Update subject Issue issue = new CustomersGateway().GetIssue(id); if (issue != null) { this.lblSubject.Text = issue.Type.Trim(); if (issue.CompanyName.Trim() != "All") { this.lblSubject.Text += ": " + issue.CompanyName.Trim(); if (issue.StoreNumber > 0) { this.lblSubject.Text += " #" + issue.StoreNumber.ToString(); } } else { if (issue.AgentNumber.Trim() != "All") { this.lblSubject.Text += ": Agent#" + issue.AgentNumber.Trim(); } else { this.lblSubject.Text += ": All Agents"; } } if (issue.Subject.Trim().Length > 0) { this.lblSubject.Text += " - " + issue.Subject.Trim(); } } } this.odsActions.SelectParameters["issueID"].DefaultValue = this.grdIssues.SelectedDataKey != null ? this.grdIssues.SelectedDataKey[0].ToString() : ""; this.lsvActions.DataBind(); if (this.lsvActions.Items.Count > 0) { this.lsvActions.SelectedIndex = 0; } OnActonSelected(null, EventArgs.Empty); this.upnlIssues.Update(); } catch (Exception ex) { Master.ReportError(ex); } }