Example #1
0
 public static void dtpInspectionDate_OnChangeStep(IVisitReportDetails form, EventArgs args)
 {
     // TODO: Complete business rule implementation
     if (form.dtpInspectionCall.DateTimeValue > form.dtpInspectionDate.DateTimeValue)
     {
         throw new ApplicationException("Inspection date can not be less than call date");
     }
 }
 public static void dtpInspectionDate_OnChangeStep( IVisitReportDetails form,  EventArgs args)
 {
     // TODO: Complete business rule implementation
     if(form.dtpInspectionCall.DateTimeValue>form.dtpInspectionDate.DateTimeValue)
     {
         throw new ApplicationException("Inspection date can not be less than call date");
     }
 }
Example #3
0
        public static void btnPrint_OnClickStep(IVisitReportDetails form, EventArgs args)
        {
            // TODO: Complete business rule implementation
            IAttachment attachment = null;
            string      pluginid   = string.Empty;


            Sage.Entity.Interfaces.IVisitReport parentEntity = form.CurrentEntity as Sage.Entity.Interfaces.IVisitReport;


            if (ReportsHelper.GetPluginId("VisitReport:Visitreport", out pluginid))
            {
                WebReportingClass reporting = new WebReportingClass();

                Sage.Platform.Data.IDataService datasvc = MySlx.Data.CurrentConnection;
                Sage.Entity.Interfaces.IUser    user    = MySlx.Security.CurrentSalesLogixUser;

                string tempPath         = Rules.GetTempAttachmentPath();
                string ConnectionString = datasvc.GetConnectionString();


                string report = reporting.GenerateReport(ConnectionString, datasvc.Server, DatabaseServer.dsMSSQL, tempPath, false, false, "VISITREPORT.VISITREPORTID", "", pluginid, "", "", "", "SELECT VISITREPORT.VISITREPORTID FROM VISITREPORT", string.Format("(VISITREPORT.VISITREPORTID = '{0}')", parentEntity.Id), user.Id.ToString(), user.UserName.ToString());

                ReportDocument doc = new ReportDocument();

                report = string.Format("{0}run\\{1}", tempPath, report);

                doc.Load(report);

                string filename = string.Format("{0}\\{1}_v{2}.pdf", Rules.GetAttachmentPath(), parentEntity.ProjectName.Replace(" ", "_"), 1);

                doc.ExportToDisk(ExportFormatType.PortableDocFormat, filename);

                doc.Close();

                attachment             = Sage.Platform.EntityFactory.Create <IAttachment>();
                attachment.Description = string.Format("{0} v{1}", parentEntity.ProjectName, 1);
                attachment.InsertFileAttachment(filename);
                attachment.VISITREPORTID = Convert.ToString(parentEntity.Id);

                attachment.Save();

                System.IO.File.Delete(report);
            }
        }
        public static void btnPrint_OnClickStep( IVisitReportDetails form,  EventArgs args)
        {
            // TODO: Complete business rule implementation
            IAttachment attachment = null;
              		string pluginid = string.Empty;

               Sage.Entity.Interfaces.IVisitReport parentEntity = form.CurrentEntity as Sage.Entity.Interfaces.IVisitReport;

              if (ReportsHelper.GetPluginId("VisitReport:Visitreport", out pluginid))
              {
              WebReportingClass reporting = new WebReportingClass();

            Sage.Platform.Data.IDataService datasvc = MySlx.Data.CurrentConnection;
              Sage.Entity.Interfaces.IUser user = MySlx.Security.CurrentSalesLogixUser;

              string tempPath = Rules.GetTempAttachmentPath();
            string ConnectionString = datasvc.GetConnectionString();

              string report = reporting.GenerateReport(ConnectionString,datasvc.Server,DatabaseServer.dsMSSQL,tempPath,false,false,"VISITREPORT.VISITREPORTID", "", pluginid, "", "",  "", "SELECT VISITREPORT.VISITREPORTID FROM VISITREPORT", string.Format("(VISITREPORT.VISITREPORTID = '{0}')", parentEntity.Id), user.Id.ToString(),  user.UserName.ToString());

                ReportDocument doc = new ReportDocument();

                report = string.Format("{0}run\\{1}", tempPath, report);

                doc.Load(report);

                string filename = string.Format("{0}\\{1}_v{2}.pdf", Rules.GetAttachmentPath(), parentEntity.ProjectName.Replace(" ", "_"), 1);

                doc.ExportToDisk(ExportFormatType.PortableDocFormat,filename);

              		doc.Close();

              attachment = Sage.Platform.EntityFactory.Create<IAttachment>();
              attachment.Description = string.Format("{0} v{1}", parentEntity.ProjectName, 1);
              attachment.InsertFileAttachment(filename);
            attachment.VISITREPORTID =Convert.ToString(parentEntity.Id);

              attachment.Save();

             System.IO.File.Delete(report);

              }
        }