示例#1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null))
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["orderid"]);
                    EquipId = Convert.ToInt32(Request.QueryString["equipid"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                NextBackControl.BackText = "<< Back";
                NextBackControl.BackPage = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                NextBackControl.NextText = "  Finish  ";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if(!IsPostBack)
                {
                    lblFirstName.Text = op.FirstName;
                    equip = new clsEquipment();
                    equip.iOrgId = OrgId;
                    equip.iId = EquipId;
                    if(equip.GetEquipInfo() != -1)
                    {
                        lblEquipId.Text = equip.sEquipId.Value;
                        lblEquipType.Text = equip.sType.Value;
                    }
                    else
                    {
                        Session["lastpage"] = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                        Session["error"] = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                    order = new clsWorkOrders();
                    order.iOrgId = OrgId;
                    order.iId = OrderId;
                    repInstructions.DataSource = new DataView(order.GetInstructionByCheckIn());
                    repInstructions.DataBind();

                    if(order.bPrint.Value)
                    {
                        hlPrint.Visible = true;
                        string Url = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/")).Replace("/", "%2f");
                        Url = Url.Replace(":", "%3a");
                        hlPrint.Attributes.Add("onclick", "javascript:window.open('ReportViewer.aspx?Report=" + _functions.GetValueFromConfig("SQLRS.Folder") + "%2fCheckInReceipt&OrderId=" + OrderId.ToString() + "&OrgId=" + OrgId.ToString() + "&URL=" + Url + "', 'popupcal', 'toolbars=0');");
                    }
                    else
                        hlPrint.Visible = false;
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(equip != null)
                    equip.Dispose();
                if(order != null)
                    order.Dispose();
            }
        }
示例#2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //try
            //{
            ReportViewerControl.LocalReport.ReportPath = _functions.GetValueFromConfig("SQLRS.DefaultPath") + ".rdlc";
            if (Request["Report"] != null)
                ReportViewerControl.LocalReport.ReportPath = Request["Report"] + ".rdlc";

            ReportViewerControl.LocalReport.EnableExternalImages = true;

            clsWorkOrders wo = new clsWorkOrders();

            if (!string.IsNullOrEmpty(Request["OrgId"]))
                wo.iOrgId = Convert.ToInt32(Request["OrgId"]);

            if (!string.IsNullOrEmpty(Request["OrderId"]))
                wo.iId = Convert.ToInt32(Request["OrderId"]);

            if (!string.IsNullOrEmpty(Request["InspectId"]))
                wo.iInspectionId = Convert.ToInt32(Request["InspectId"]);

            string url = string.Empty;
            if (!string.IsNullOrEmpty(Request["URL"]))
                url = Request["URL"];

            foreach (string dataSource in ReportViewerControl.LocalReport.GetDataSourceNames())
            {
                switch (dataSource)
                {
                    case "ReportedIssueList":
                        DataSet ds = wo.GetReportedIssueLists();
                        if (ds != null && ds.Tables.Count > 0)
                            ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, ds.Tables[0]));
                        break;
                    case "PMItemList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetPMServicesListForWorkOrder()));
                        break;
                    case "InspectionsList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetInspectionsListForWorkOrder()));
                        break;
                    case "WorkOrderDetail":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetDetailsForWorkOrder()));
                        break;
                    case "CreationNotesList":
                        wo.iNoteTypeId = 1;
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetNotesList()));
                        break;
                    case "OperatorNotesList":
                        wo.iNoteTypeId = 2;
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetNotesList()));
                        break;
                    case "PartsList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetPartsUsedListForReport()));
                        break;
                    case "ReportedIssuesList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetReportedIssues()));
                        break;
                    case "PMItemsList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetPMItemsList()));
                        break;
                    case "RepairsList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetRepairsListForReport()));
                        break;
                    case "TechNotesList":
                        wo.iNoteTypeId = 3;
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetNotesList()));
                        break;
                    case "CheckOutNotesList":
                        wo.iNoteTypeId = 4;
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetNotesList()));
                        break;
                    case "CheckInDetails":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.CheckInDetailsForReport(url)));
                        break;
                    case "InstructionList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetInstructionByCheckIn()));
                        break;
                    case "InspectionDetail":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetInspectionDetailForReport()));
                        break;
                    case "InspectionItemsList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetInspectionItemsListForReport()));
                        break;
                    case "InspectionList":
                        ReportViewerControl.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSource, wo.GetInspectionListForReport()));
                        break;
                }
            }
        }