Exemple #1
0
        private static Boolean IsMember(string TeamName, string Type)
        {
            Boolean blnReturn = false; // Intialize False

            //Get Current user
            Sage.SalesLogix.Security.SLXUserService usersvc     = (Sage.SalesLogix.Security.SLXUserService)Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>();
            Sage.Entity.Interfaces.IUser            currentuser = usersvc.GetUser();
            // get the DataService to get a connection string to the database
            string SQL = "";

            SQL  = "select accessid from secrights where seccodeid = ";
            SQL += " (select seccodeid from seccode where (seccodedesc = '" + TeamName + "') ";
            SQL += " and (seccodetype = '" + Type + "')) and (accessid = '" + currentuser.Id.ToString() + "')";

            Sage.Platform.Data.IDataService datasvc = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Data.IDataService>();
            using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(datasvc.GetConnectionString()))
            {
                conn.Open();
                using (System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(SQL, conn))
                {
                    OleDbDataReader reader = cmd.ExecuteReader();
                    //loop through the reader
                    while (reader.Read())
                    {
                        if (reader["accessid"].ToString() != string.Empty)
                        {
                            blnReturn = true;
                        }
                    }
                    reader.Close();
                }
            }
            return(blnReturn);
        }
    public string GetSLXConnectionString()
    {
        string result = string.Empty;

        Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Data.IDataService>();
        return(service.GetConnectionString());
    }
Exemple #3
0
        public static T GetField <T>(string Field, string Table, string Where)
        {
            string sql = string.Format("select {0} from {1} where {2}", Field, Table, (Where.Equals(string.Empty) ? "1=1" : Where));

            //get the DataService to get a connection string to the database
            Sage.Platform.Data.IDataService datasvc = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Data.IDataService>();
            using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(datasvc.GetConnectionString()))
            {
                conn.Open();
                using (OleDbCommand cmd = new OleDbCommand(sql, conn))
                {
                    object fieldval = cmd.ExecuteScalar();
                    return(fieldval == DBNull.Value ? default(T) : (T)fieldval);
                }
            }
        }
Exemple #4
0
        public static void btnPrint_OnClickStep(IRNReportDetails form, EventArgs args)
        {
            // TODO: Complete business rule implementation
            IAttachment attachment = null;
            string      pluginid   = string.Empty;


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


            if (ReportsHelper.GetPluginId("RNReport:Irnreport", 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, "RNREPORT.RNREPORTID", "", pluginid, "", "", "", "SELECT RNREPORT.RNREPORTID FROM RNREPORT", string.Format("(RNREPORT.RNREPORTID = '{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.ReferenceNumber.Replace(" ", "_"), 1);

                doc.ExportToDisk(ExportFormatType.PortableDocFormat, filename);

                doc.Close();

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

                attachment.Save();

                System.IO.File.Delete(report);
            }
        }
 private static WebUserConfiguration GetConfiguration()
 {
     if (_Config == null)
     {
         Sage.Platform.Data.IDataService data = ApplicationContext.Current.Services.Get <Sage.Platform.Data.IDataService>();
         if (data != null)
         {
             Sage.Platform.VirtualFileSystem.VFSQuery.ConnectToVFS(data.GetConnectionString());
         }
         Sage.Platform.Configuration.ConfigurationManager manager = ApplicationContext.Current.Services.Get <Sage.Platform.Configuration.ConfigurationManager>(true);
         if (!manager.IsConfigurationTypeRegistered(typeof(WebUserConfiguration)))
         {
             manager.RegisterConfigurationType(typeof(WebUserConfiguration));
         }
         _Config = (WebUserConfiguration)manager.GetConfiguration(typeof(WebUserConfiguration));
     }
     return(_Config);
 }