Exemple #1
0
        public ActionResult FromLoadFileReport()
        {
            var       formValues = StiMvcViewer.GetFormValues(this.HttpContext);
            CarModels cm         = new CarModels();

            if (formValues.Count != 0)
            {
                cm.Vin = formValues.GetValues("vin").GetValue(0).ToString();
            }
            else
            {
                cm.Vin = "NAS0";
            }
            try
            {
                Qccastt qccastt = new Qccastt();
                qccastt.Vin = cm.GetVin();
                DataSet dsCardInfo = new DataSet();
                if (!string.IsNullOrEmpty(cm.Vin))
                {
                    Object[] obj = null;
                    dsCardInfo = QccasttUtility.GetCarDefect(qccastt, out obj);
                    dsCardInfo.Tables[0].TableName = "CarDefects";
                }

                StiReport report = new StiReport();
                report.Load(Server.MapPath("/Content/ReportsFile/QCCard2.mrt"));
                StiText stitxtVin = (StiText)report.GetComponentByName("txtVin");
                stitxtVin.Text = cm.GetVin();
                // BCVin
                StiBarCode stiBCVin = (StiBarCode)report.GetComponentByName("BCVin");
                stiBCVin.Code = new StiBarCodeExpression(cm.GetVin());

                //report.RegBusinessObject("driverReport", dsCardInfo.Tables[0]);
                //int i = dsCardInfo.Tables[0].Rows.Count;
                //report.Compile();

                report.RegData(dsCardInfo);
                return(StiMvcViewer.GetReportSnapshotResult(HttpContext, report));
            }
            catch (Exception ex)
            {
                // lblVinMessage.Text = "خطا در دریافت اطلاعات";
                return(View());
            }
        }