Ejemplo n.º 1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     report = new Reports();
     bool isDeleted;
     bool isDeletedReport;
     bool hasDataReport;
     bool hasDataPopulation;
     hasDataReport = report.HasDataForTheYear(Convert.ToInt32(ddlYear0.Text), ddlMonth0.Text, Convert.ToInt32(ddlBarangay0.Text));
     hasDataPopulation = report.HasPopulationData(Convert.ToInt32(ddlYear0.Text), ddlMonth0.Text, Convert.ToInt32(ddlBarangay0.Text));
     if (hasDataReport)
     {
         isDeleted = report.DeleteRecord(ddlMonth0.Text, Convert.ToInt32(ddlYear.Text), Convert.ToInt32(ddlBarangay0.Text));
         isDeletedReport = report.DeleteReportsRecord(ddlMonth0.Text, Convert.ToInt32(ddlYear0.Text), Convert.ToInt32(ddlBarangay0.Text));
         if (isDeleted && isDeletedReport)
             Response.Write("<script> window.alert('Deleted Record Successfully.')</script>");
         else
             Response.Write("<script> window.alert('Deleted Record Failed! Please Try Again!')</script>");
     }
     else
     {
         if (hasDataPopulation)
         {
             isDeleted = report.DeleteRecord(ddlMonth0.Text, Convert.ToInt32(ddlYear.Text), Convert.ToInt32(ddlBarangay0.Text));
             if (isDeleted)
                 Response.Write("<script> window.alert('Deleted Record Successfully.')</script>");
             else
                 Response.Write("<script> window.alert('Deleted Record Failed! Please Try Again!')</script>");
         }
         else
             Response.Write("<script> window.alert('There is no data or report to delete!')</script>");
     }
 }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Master.IsInMembership("Administrator"))
            Response.Redirect("~/views/dashboard/dash.aspx?access=denied");

        Reports reports = new Reports();

        gvLastFiveUsers.DataSource = reports.LastUsers();
        gvLastFiveUsers.DataBind();

        gvLastFiveUnicasts.DataSource = reports.LastUnicasts();
        gvLastFiveUnicasts.DataBind();

        gvLastFiveMulticasts.DataSource = reports.LastMulticasts();
        gvLastFiveMulticasts.DataBind();

        gvTopFiveUnicasts.DataSource = reports.TopFiveUnicast();
        gvTopFiveUnicasts.DataBind();

        gvTopFiveMulticasts.DataSource = reports.TopFiveMulticast();
        gvTopFiveMulticasts.DataBind();

        gvUserStats.DataSource = reports.UserStats();
        gvUserStats.DataBind();
    }
        public BarChartDetailCourse(Reports.XmlRpc.XmlRpcRequest client, string url, bool showusername, string style, string minor_group_header, string category_group, string template_group)
            : base(client, url, showusername)
        {
            majorgroup.Add("Group Name", "gname");
            minisection = new Dictionary<string, string>();

            if (minor_group_header.Equals("Username") && category_group.Equals("Course") && template_group.Equals("Three Group"))
            {
                SetParams(0);
                minorgroup.Add("Full Name", "userdata");
                section.Add("Course Title", "ctitle");
                minisection.Add("Course Title", "ctitle");
                minisection.Add("Current Grade", "caverage");
                minisection.Add("Lesson Title", "ltitle");
                minisection.Add("Lesson Grade", "laverage");
                minisection.Add("Status", "status");
            }
            else if (minor_group_header.Equals("Course") && category_group.Equals("Username") && template_group.Equals("Three Group"))
            {
                SetParams(1);
                minorgroup.Add("Course Title", "ctitle");
                section.Add("Lesson Title", "ltitle");
                minisection.Add("Full Name", "userdata");
                minisection.Add("Course Title", "ctitle");
                minisection.Add("Current Grade", "caverage");
                minisection.Add("Lesson Title", "ltitle");
                minisection.Add("Lesson Grade", "laverage");
            }
        }
Ejemplo n.º 4
0
        public DependencyListOptions(Reports reports, CommandArgument path, CommandOption framework)
        {
            bool isInputValid = true;

            // reports
            Reports = reports;

            // project
            var projectPath = path.Value ?? Directory.GetCurrentDirectory();
            Runtime.Project projectOption;

            isInputValid &= Runtime.Project.TryGetProject(projectPath, out projectOption);
            Path = projectPath;
            Project = projectOption;

            // framework
            if (framework.HasValue())
            {
                try
                {
                    Framework = VersionUtility.ParseFrameworkName(framework.Value());
                }
                catch (ArgumentException ex)
                {
                    Reports.Error.WriteLine("Invalid framework name: {0}. [{1}]", framework.Value(), ex.Message);
                    isInputValid = false;
                }
            }
            else
            {
                Framework = null;
            }

            Valid = isInputValid;
        }
Ejemplo n.º 5
0
        public HttpSource(
            string baseUri,
            string userName,
            string password,
            Reports reports)
        {
            _baseUri = baseUri + (baseUri.EndsWith("/") ? "" : "/");
            _userName = userName;
            _password = password;
            _reports = reports;

            var proxy = Environment.GetEnvironmentVariable("http_proxy");
            if (string.IsNullOrEmpty(proxy))
            {
#if ASPNET50
                _client = new HttpClient();
#else
                _client = new HttpClient(new Microsoft.Net.Http.Client.ManagedHandler());
#endif
            }
            else
            {
                // To use an authenticated proxy, the proxy address should be in the form of
                // "http://*****:*****@proxyaddress.com:8888"
                var proxyUriBuilder = new UriBuilder(proxy);
#if ASPNET50
                var webProxy = new WebProxy(proxy);
                if (string.IsNullOrEmpty(proxyUriBuilder.UserName))
                {
                    // If no credentials were specified we use default credentials
                    webProxy.Credentials = CredentialCache.DefaultCredentials;
                }
                else
                {
                    ICredentials credentials = new NetworkCredential(proxyUriBuilder.UserName,
                        proxyUriBuilder.Password);
                    webProxy.Credentials = credentials;
                }

                var handler = new HttpClientHandler
                {
                    Proxy = webProxy,
                    UseProxy = true
                };
                _client = new HttpClient(handler);
#else
                if (!string.IsNullOrEmpty(proxyUriBuilder.UserName))
                {
                    _proxyUserName = proxyUriBuilder.UserName;
                    _proxyPassword = proxyUriBuilder.Password;
                }

                _client = new HttpClient(new Microsoft.Net.Http.Client.ManagedHandler()
                {
                    ProxyAddress = new Uri(proxy)
                });
#endif
            }
        }
Ejemplo n.º 6
0
 public NuGetPackageFolder(
     string physicalPath,
     Reports reports)
 {
     _repository = new LocalPackageRepository(physicalPath, reports.Quiet);
     _reports = reports;
     Source = physicalPath;
 }
Ejemplo n.º 7
0
        public GitSourceControlProvider(Reports buildReports)
        {
            if (buildReports == null)
            {
                throw new ArgumentNullException(nameof(buildReports));
            }

            _buildReports = buildReports;
        }
Ejemplo n.º 8
0
 public static IRepositoryPublisher Create(
     string path,
     Reports reports)
 {
     return new FileSystemRepositoryPublisher(path)
     {
         Reports = reports
     };
 }
Ejemplo n.º 9
0
 public ReportForm()
 {
     InitializeComponent();
     DataCollection = new List<List<Object>>();
     DataCollection2 = new List<List<Object>>();
     Reports = new Reports();
     SimpleXmlParser = null;
     HtmlRenderer = new HtmlRenderer(Reports, "Css", "JsLib");
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of <see cref="Workspace"/> for a given <see cref="Token"/> with a given <see cref="ICommunication"/>
        /// </summary>
        /// <param name="token"><see cref="Token">Access token to use</see></param>
        /// <param name="communication"><see cref="ICommunication"/> to use</param>
        public Workspace(Token token, ICommunication communication)
        {
            _communication = communication;

            Groups = new Groups(token, communication);
            Datasets = new Datasets(token, communication);
            Tables = new Tables(token, communication);
            Rows = new Rows(token, communication);
            Dashboards = new Dashboards(token, communication);
            Reports = new Reports(token, communication);
            Tiles = new Tiles(token, communication);
        }
Ejemplo n.º 11
0
        public ActionResult Create(Reports reports)
        {
            if (ModelState.IsValid)
            {
                ViewData["WorkFor"] = GetWorkFor();

                int finishedLength = int.Parse(Request.Form["hideFinished"]);
                int wIPLength = int.Parse(Request.Form["hideWIP"]);
                int planningLength = int.Parse(Request.Form["hidePlanning"]);
                int blockingLength = int.Parse(Request.Form["hideBlocking"]);

                ReportItems reportItems = new ReportItems();

                reportItems.Finished = GetReportItems(finishedLength, "Finished");
                reportItems.WIP = GetReportItems(wIPLength, "WIP");
                reportItems.Planning = GetReportItems(planningLength, "Planning");
                reportItems.Blocking = GetReportItems(blockingLength, "Blocking");

                if (reportItems.Finished.Count != 0 || reportItems.WIP.Count != 0 || reportItems.Planning.Count != 0 || reportItems.Blocking.Count != 0)
                {
                    reports.DailyReport.Report = reportItems.ToXML();
                    reports.DailyReport.DailyReportID = Guid.NewGuid();
                    reports.DailyReport.AddDate = DateTime.Now;
                    reports.DailyReport.UserID = User.Identity.Name.Split(',')[0];

                    db.DailyReports.Add(reports.DailyReport);
                    db.SaveChanges();

                    return RedirectToAction("Edit", new { id = reports.DailyReport.DailyReportID });
                }

                ReportFiles reportFiles = new ReportFiles();
                reportFiles.Files = GetFiles();

                if (reportFiles.Files.Count != 0)
                {
                    reportFiles.Status = Request.Form["ProjectStatus_TB"];
                    reportFiles.Project = Request.Form["Project_DDL"];

                    reports.DailyProjectReort.Report = reportFiles.ToXML();

                    reports.DailyProjectReort.DailyProjectReportID = Guid.NewGuid();
                    reports.DailyProjectReort.AddDate = DateTime.Now;
                    reports.DailyProjectReort.UserID = User.Identity.Name.Split(',')[0];
                    reports.DailyProjectReort.Project = Request.Form["Project_DDL"];

                    db.DailyProjectReports.Add(reports.DailyProjectReort);
                    db.SaveChanges();
                }
            }
            return View();
        }
Ejemplo n.º 12
0
 public AssemblyWalker(
     FrameworkName framework,
     ApplicationHostContext hostContext,
     string runtimeFolder,
     bool showDetails,
     Reports reports)
 {
     _framework = framework;
     _hostContext = hostContext;
     _runtimeFolder = runtimeFolder;
     _showDetails = showDetails;
     _reports = reports;
 }
Ejemplo n.º 13
0
 public PublishRoot(Runtime.Project project, string outputPath, IServiceProvider hostServices, Reports reports)
 {
     _project = project;
     Reports = reports;
     Projects = new List<PublishProject>();
     Packages = new List<PublishPackage>();
     Runtimes = new List<PublishRuntime>();
     OutputPath = outputPath;
     HostServices = hostServices;
     TargetPackagesPath = Path.Combine(outputPath, AppRootName, "packages");
     Operations = new PublishOperations();
     LibraryDependencyContexts = new Dictionary<Library, IList<DependencyContext>>();
 }
Ejemplo n.º 14
0
 public AssemblyWalker(
     FrameworkName framework,
     Dictionary<AssemblyName, string> paths,
     string runtimeFolder,
     bool showDetails,
     Reports reports)
 {
     _framework = framework;
     _runtimeFolder = runtimeFolder;
     _showDetails = showDetails;
     _reports = reports;
     _paths = paths;
 }
Ejemplo n.º 15
0
        public SourceCommand(string packageId, Reports reports)
        {
            if (string.IsNullOrEmpty(packageId))
            {
                throw new ArgumentNullException(nameof(packageId));
            }
            if (reports == null)
            {
                throw new ArgumentNullException(nameof(reports));
            }

            _packageId = packageId;
            _reports = reports;
        }
Ejemplo n.º 16
0
 public SimpleXmlParser(String xmlFilePath, String xsdFilePath, Reports reports)
 {
     XmlFilePath = xmlFilePath;
     XsdFilePath = xsdFilePath;
     XmlReaderSettings = new XmlReaderSettings();
     XmlReaderSettings.Schemas.Add(null, XmlReader.Create(XsdFilePath));
     XmlReaderSettings.ValidationType = ValidationType.Schema;
     XmlReaderSettings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;
     XmlReaderSettings.ValidationEventHandler += settings_ValidationEventHandler;
     XmlReaderSettings.IgnoreWhitespace = true;
     XmlReaderSettings.IgnoreComments = true;
     XmlReader = XmlReader.Create(XmlFilePath, XmlReaderSettings);
     Reports = reports;
 }
Ejemplo n.º 17
0
        // TODO: When we have a second source control provider extract the common API in a base class/interface
        // and return it from this method
        public static GitSourceControlProvider ResolveProvider(string sourceControlType, Reports buildReports)
        {
            if (string.IsNullOrEmpty(sourceControlType))
            {
                throw new ArgumentNullException(nameof(sourceControlType));
            }

            if (sourceControlType.Equals("git", StringComparison.OrdinalIgnoreCase))
            {
                return new GitSourceControlProvider(buildReports);
            }

            return null;
        }
Ejemplo n.º 18
0
 public PublishRoot(Runtime.Project project, string outputPath, IServiceProvider hostServices, Reports reports)
 {
     _project = project;
     Reports = reports;
     Projects = new List<PublishProject>();
     Packages = new List<PublishPackage>();
     Runtimes = new List<PublishRuntime>();
     Frameworks = new Dictionary<FrameworkName, string>();
     OutputPath = outputPath;
     HostServices = hostServices;
     TargetPackagesPath = Path.Combine(outputPath, AppRootName, "packages");
     TargetRuntimesPath = Path.Combine(outputPath, AppRootName, "runtimes");
     Operations = new PublishOperations();
 }
Ejemplo n.º 19
0
 public PublishRoot(Runtime.Project project, string outputPath, Reports reports)
 {
     _project = project;
     MainProjectName = project.Name;
     Reports = reports;
     Projects = new List<PublishProject>();
     Packages = new List<PublishPackage>();
     Runtimes = new List<PublishRuntime>();
     RuntimeIdentifiers = new HashSet<string>();
     Frameworks = new Dictionary<FrameworkName, string>();
     OutputPath = outputPath;
     TargetPackagesPath = Path.Combine(outputPath, AppRootName, "packages");
     TargetRuntimesPath = Path.Combine(outputPath, AppRootName, "runtimes");
     Operations = new PublishOperations();
 }
Ejemplo n.º 20
0
 public PackageFolder(
     string physicalPath,
     bool ignoreFailure,
     Reports reports)
 {
     // We need to help restore operation to ensure case-sensitivity here
     // Turn on the flag to get package ids in accurate casing
     _repository = new PackageRepository(physicalPath, caseSensitivePackagesName: true);
     _fileSystem = new PhysicalFileSystem(physicalPath);
     _pathResolver = new DefaultPackagePathResolver(_fileSystem);
     _reports = reports;
     Source = physicalPath;
     _ignored = false;
     _ignoreFailure = ignoreFailure;
 }
Ejemplo n.º 21
0
        public DependencyListOptions(Reports reports, CommandArgument path)
        {
            bool isInputValid = true;

            // reports
            Reports = reports;

            // project
            var projectPath = path.Value ?? Directory.GetCurrentDirectory();
            Runtime.Project projectOption;

            isInputValid &= Runtime.Project.TryGetProject(projectPath, out projectOption);
            Path = projectPath;
            Project = projectOption;

            Valid = isInputValid;
        }
Ejemplo n.º 22
0
        public HttpSource(
            string baseUri,
            string userName,
            string password,
            Reports reports)
        {
            _baseUri = baseUri + ((baseUri.EndsWith("/") || baseUri.EndsWith("index.json")) ? "" : "/");
            _userName = userName;
            _password = password;
            _reports = reports;

            var proxy = Environment.GetEnvironmentVariable("http_proxy");
            if (string.IsNullOrEmpty(proxy))
            {
                _client = new HttpClient();
            }
            else
            {
                // To use an authenticated proxy, the proxy address should be in the form of
                // "http://*****:*****@proxyaddress.com:8888"
                var proxyUriBuilder = new UriBuilder(proxy);
                var webProxy = new WebProxy(proxy);
                if (string.IsNullOrEmpty(proxyUriBuilder.UserName))
                {
                    // If no credentials were specified we use default credentials
                    webProxy.Credentials = CredentialCache.DefaultCredentials;
                }
                else
                {
                    ICredentials credentials = new NetworkCredential(proxyUriBuilder.UserName,
                        proxyUriBuilder.Password);
                    webProxy.Credentials = credentials;
                }

                var handler = new HttpClientHandler
                {
                    Proxy = webProxy,
                    UseProxy = true
                };
                _client = new HttpClient(handler);
            }

            var env = RuntimeEnvironmentHelper.RuntimeEnvironment;
            var userAgentHeader = $"{UserAgentName}/{env.RuntimeVersion}({env.OperatingSystem}{env.OperatingSystemVersion})";
            _client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", userAgentHeader);
        }
Ejemplo n.º 23
0
        public static async Task<NupkgEntry> OpenNupkgStreamAsync(
            HttpSource httpSource,
            PackageInfo package,
            TimeSpan cacheAgeLimit,
            Reports reports)
        {
            for (int retry = 0; retry != 3; ++retry)
            {
                try
                {
                    using (var data = await httpSource.GetAsync(
                        package.ContentUri,
                        cacheKey: $"nupkg_{package.Id}.{package.Version}",
                        cacheAgeLimit: retry == 0 ? cacheAgeLimit : TimeSpan.Zero,
                        ensureValidContents: stream => EnsureValidPackageContents(stream, package)))
                    {
                        return new NupkgEntry
                        {
                            TempFileName = data.CacheFileName
                        };
                    }
                }
                catch (Exception ex)
                {
                    var isFinalAttempt = (retry == 2);
                    var message = ex.Message;
                    if (ex is TaskCanceledException)
                    {
                        message = ErrorMessageUtils.GetFriendlyTimeoutErrorMessage(ex as TaskCanceledException, isFinalAttempt, ignoreFailure: false);
                    }

                    if (isFinalAttempt)
                    {
                        reports.Error.WriteLine(
                            $"Error: DownloadPackageAsync: {package.ContentUri}{Environment.NewLine}  {message}".Red().Bold());
                        throw;
                    }
                    else
                    {
                        reports.Information.WriteLine(
                            $"Warning: DownloadPackageAsync: {package.ContentUri}{Environment.NewLine}  {message}".Yellow().Bold());
                    }
                }
            }
            return null;
        }
Ejemplo n.º 24
0
        public SourceBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport)
        {
            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }
            if (buildReport == null)
            {
                throw new ArgumentNullException(nameof(buildReport));
            }
            if (packageBuilder == null)
            {
                throw new ArgumentNullException(nameof(packageBuilder));
            }

            _project = project;
            _packageBuilder = packageBuilder;
            _reports = buildReport;
        }
 public bool GetEmployeesOnLeaveByDate(DateTime date, out List<Reports> objEmployees)
 {
     DataTable dt, dt1, dt2, dt3, dt4;
     List<Reports> objEmployees1 = new List<Reports>();
     DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
     List<SqlParameter> list_params = new List<SqlParameter>() { new SqlParameter("@date", date) };
     try
     {
         using (DBDataHelper helper = new DBDataHelper())
         {
             dt = helper.GetDataTable("spGetEmployeesOnLeaveByDate", SQLTextType.Stored_Proc, list_params);
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 int EmployeeId = Convert.ToInt32(dt.Rows[i]["EmployeeId"]);
                 List<SqlParameter> list_params2 = new List<SqlParameter>() { new SqlParameter("@employeeId", EmployeeId) };
                 dt1 = helper.GetDataTable("select FirstName,MiddleName,LastName from tblEmployeesMaster where Id=@employeeId", SQLTextType.Query, list_params2);
                 Reports objReports = new Reports();
                 objReports.FirstName = Convert.ToString(dt1.Rows[0]["FirstName"]);
                 objReports.MiddleName = Convert.ToString(dt1.Rows[0]["MiddleName"]);
                 objReports.LastName = Convert.ToString(dt1.Rows[0]["LastName"]);
                 List<SqlParameter> list_params3 = new List<SqlParameter>() { new SqlParameter("@employeeId", EmployeeId) };
                 dt2 = helper.GetDataTable("Select RoleId,DepartmentId from tblEmployees where EmployeeId=@employeeId", SQLTextType.Query, list_params3);
                 objReports.RoleId = Convert.ToInt32(dt2.Rows[0]["RoleId"]);
                 objReports.DepartmentId = Convert.ToInt32(dt2.Rows[0]["DepartmentId"]);
                 List<SqlParameter> list_params4 = new List<SqlParameter>() { new SqlParameter("@roleId", objReports.RoleId) };
                 dt3 = helper.GetDataTable("spGetRoleById", SQLTextType.Stored_Proc, list_params4);
                 objReports.RoleName = dt3.Rows[0][0].ToString();
                 List<SqlParameter> list_params5 = new List<SqlParameter>() { new SqlParameter("@departmentId", objReports.DepartmentId) };
                 dt4 = helper.GetDataTable("spGetDepartmentById", SQLTextType.Stored_Proc, list_params5);
                 objReports.DepartmentName = dt4.Rows[0][0].ToString();
                 objEmployees1.Add(objReports);
             }
         }
         objEmployees = objEmployees1;
         return true;
     }
     catch (Exception)
     {
         objEmployees = null;
         return false;
     }
 }
Ejemplo n.º 26
0
    protected void btnNext_Click(object sender, EventArgs e)
    {
        rep = new Reports();
        bar = new Barangay();
        mc = new MonthConverter();
        bool inserted = false;

        if (txtPopulation.Text != "")
        {
            if (Int32.Parse(txtPopulation.Text) > 0)
            {
                if (rep.HasDataForTheYear(Int32.Parse(ddlYear.Text), ddlMonth.Text,bar.GetBarangayID(ddlBarangay.Text)))
                {
                    Response.Write("<script> window.alert('Barangay: "+ddlBarangay.Text+" of the Year: "+
                        ddlYear.Text+" has data in the database. Please Try Other Year for the Barangay')</script>");
                }
                else
                {
                    inserted = rep.InsertPopulation(bar.GetBarangayID(ddlBarangay.Text), Int32.Parse(txtPopulation.Text),
                        Int32.Parse("0"), mc.MonthNameToIndex(ddlMonth.Text), Int32.Parse(ddlYear.Text));

                    if (inserted)
                    {
                        Response.Redirect("~/Reports/Templates/xAllProgram.aspx?&month=" + Server.UrlEncode(ddlMonth.Text) +
                            "&year=" + Server.UrlEncode(ddlYear.Text) +
                            "&barangay=" + Server.UrlEncode(ddlBarangay.Text) +
                            "&population=" + Server.UrlEncode(txtPopulation.Text));
                    }
                    else
                    {
                        Response.Write("<script> window.alert('Population Insertion has failed, Please try Again.')</script>");
                    }
                }

            }
            else
                Response.Write("<script> window.alert('Population should be greater than zero.')</script>");
        }
        else
            Response.Write("<script> window.alert('Please Fill the Population Field.')</script>");
    }
Ejemplo n.º 27
0
    public Reports GetReportByOID(int ReportOID)
    {
        Reports report = null;
        using (OdbcConnection connection = new OdbcConnection(connectionString))
        {
            using (OdbcCommand command = new OdbcCommand())
            {
                command.Connection = connection;
                command.CommandText = "{CALL Reports_GetByOID(?)}";
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@ReportOID", ReportOID);

                connection.Open();
                using (OdbcDataReader dataReader = command.ExecuteReader())
                {
                    if (dataReader.Read())
                    {
                        report = new Reports();
                        report.ReportOID = (int)dataReader["ReportOID"];
                        report.ReportName = (string)dataReader["ReportName"];
                        report.SPName = (string)dataReader["SPName"];
                        report.SPParams = (string)dataReader["SPParams"];
                        report.GridColumns = (string)dataReader["GridColumns"];
                        report.CreatedDate = (DateTime)dataReader["CreatedDate"];

                        if (dataReader["CreatedDate"] != null)
                        {
                            report.CreatedDate = Convert.ToDateTime(dataReader["CreatedDate"]);
                        }
                        else
                        {
                            report.CreatedDate = System.DateTime.Now;
                        }
                    }
                }

            }
        }
        return report;
    }
Ejemplo n.º 28
0
 internal NuGetv3Feed(
     HttpSource httpSource,
     bool noCache,
     Reports reports,
     bool ignoreFailure)
 {
     _baseUri = httpSource.BaseUri;
     _reports = reports;
     _httpSource = httpSource;
     _ignoreFailure = ignoreFailure;
     if (noCache)
     {
         _cacheAgeLimitList = TimeSpan.Zero;
         _cacheAgeLimitNupkg = TimeSpan.Zero;
     }
     else
     {
         _cacheAgeLimitList = TimeSpan.FromMinutes(30);
         _cacheAgeLimitNupkg = TimeSpan.FromHours(24);
     }
 }
Ejemplo n.º 29
0
 public static async Task<NupkgEntry> OpenNupkgStreamAsync(
     HttpSource httpSource,
     PackageInfo package,
     TimeSpan cacheAgeLimit,
     Reports reports)
 {
     for (int retry = 0; retry != 3; ++retry)
     {
         try
         {
             using (var data = await httpSource.GetAsync(
                 package.ContentUri,
                 cacheKey: $"nupkg_{package.Id}.{package.Version}",
                 cacheAgeLimit: retry == 0 ? cacheAgeLimit : TimeSpan.Zero,
                 ensureValidContents: stream => EnsureValidPackageContents(stream, package)))
             {
                 return new NupkgEntry
                 {
                     TempFileName = data.CacheFileName
                 };
             }
         }
         catch (Exception ex)
         {
             if (retry == 2)
             {
                 reports.Error.WriteLine(
                     $"Error: DownloadPackageAsync: {package.ContentUri}{Environment.NewLine}  {ex.Message}".Red().Bold());
                 throw;
             }
             else
             {
                 reports.Information.WriteLine(
                     $"Warning: DownloadPackageAsync: {package.ContentUri}{Environment.NewLine}  {ex.Message}".Yellow().Bold());
             }
         }
     }
     return null;
 }
Ejemplo n.º 30
0
 public void AddNews(Reports.Core.Dto.NewsDto post)
 {
     News result = null;
     var dao = Ioc.Resolve<INewsDao>();
     if (post.id <= 0)
     {
         result = new News
         {
             PostDate = DateTime.Now,
             Header = post.Header,
             Text = post.Text,
             IsVisible = true,
             Author = Ioc.Resolve<IUserDao>().Load(AuthenticationService.CurrentUser.Id)
         };
     }
     else
     {
         result = dao.Load(post.id);
         result.Text = post.Text;
         result.Header = post.Header;
     }
     dao.SaveAndFlush(result);
 }
Ejemplo n.º 31
0
 public bool SendData(Reports reports, string reportId, ref string errorInfo)
 {
     return(_service.ReceiveData(reports, reportId, ref errorInfo));
 }
Ejemplo n.º 32
0
 public void SetFavorite(int reportID, bool value)
 {
     Reports.SetIsFavorite(TSAuthentication.GetLoginUser(), TSAuthentication.UserID, reportID, value);
 }
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            // Obtengo los datos seleccionados
            int    sede          = Clases.Paciente.PacienteSede;
            string documento     = cmboxDocumento.SelectedItem.ToString();
            string datosAIncluir = cmboxTipoDocumento.SelectedItem.ToString();
            int    piso;

            if (datosAIncluir.Equals("Un piso específico"))
            {
                SISTMEDEntities E          = new SISTMEDEntities();
                string          piso_texto = cmboxPiso.SelectedItem.ToString();
                piso = (from p in E.Piso where p.descripcion == piso_texto select p.piso_id).Single();
            }
            else
            {
                piso = -1;
            }

            // Configuro los datos del Crystal Reports
            try
            {
                Reports        _Reporte  = new Reports();
                ReportDocument objReport = new ReportDocument();

                if (documento.Equals("Hoja de camarera"))
                {
                    String reportPath = ConfigurationManager.AppSettings["Reports"] + "\\Reporting\\" + "HojaDeCamarera.rpt";
                    objReport.Load(reportPath);
                    objReport.Refresh();
                    objReport.ReportOptions.EnableSaveDataWithReport = false;
                }
                else
                {
                    if (documento.Equals("Hoja de cocina"))
                    {
                        String reportPath = ConfigurationManager.AppSettings["Reports"] + "\\Reporting\\" + "HojaDeCocina.rpt";
                        objReport.Load(reportPath);
                        objReport.Refresh();
                        objReport.ReportOptions.EnableSaveDataWithReport = false;
                    }
                }


                // PARAMETROS DE CONEXION
                TableLogOnInfo logoninfo = new TableLogOnInfo();
                logoninfo.ConnectionInfo.ServerName         = ConfigurationManager.AppSettings["Source"];
                logoninfo.ConnectionInfo.DatabaseName       = ConfigurationManager.AppSettings["CatalogSISTMED"];
                logoninfo.ConnectionInfo.UserID             = ConfigurationManager.AppSettings["User ID"];
                logoninfo.ConnectionInfo.Password           = ConfigurationManager.AppSettings["Password"];
                logoninfo.ConnectionInfo.IntegratedSecurity = false;
                Tables tables = objReport.Database.Tables;
                foreach (Table table in tables)
                {
                    table.ApplyLogOnInfo(logoninfo);
                }
                // FIN PARAMETROS DE CONEXION

                ParameterFields        Parametros     = new ParameterFields();
                ParameterField         ParametroField = new ParameterField();
                ParameterDiscreteValue ParametroValue = new ParameterDiscreteValue();
                Parametros.Clear();

                ////1° PARAMETRO
                ParametroField       = new ParameterField();
                ParametroValue       = new ParameterDiscreteValue();
                ParametroField.Name  = "@sede";
                ParametroValue.Value = sede;
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);

                if (piso != -1)
                {
                    ////2° PARAMETRO
                    ParametroField       = new ParameterField();
                    ParametroValue       = new ParameterDiscreteValue();
                    ParametroField.Name  = "@piso";
                    ParametroValue.Value = piso;
                    ParametroField.CurrentValues.Add(ParametroValue);
                    Parametros.Add(ParametroField);
                }
                else
                {
                    ////2° PARAMETRO
                    ParametroField       = new ParameterField();
                    ParametroValue       = new ParameterDiscreteValue();
                    ParametroField.Name  = "@piso";
                    ParametroValue.Value = null;
                    ParametroField.CurrentValues.Add(ParametroValue);
                    Parametros.Add(ParametroField);
                }

                _Reporte.Parameters = Parametros;
                _Reporte.Reporte    = objReport;
                _Reporte.Show();

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error55", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 34
0
 public DashboardReport()
 {
     this.tiles   = new Tiles();
     this.reports = new Reports();
     this.name    = "New Dashboard";
 }
Ejemplo n.º 35
0
        /*
         * ///<summary>This is typically used when we want to define the columns before we run the query.  If the query has already been run, then this method is not necessary.</summary>
         * public void InitializeColumns(int colcount) {
         *      colWidth=new int[colcount];
         *      colPos=new int[colcount+1];
         *      colPos[0]=0;
         *      colCaption=new string[colcount];
         *      colAlign=new HorizontalAlignment[colcount];
         *      ColTotal=new double[colcount];
         * }*/

        ///<summary>Runs the query and returns the result.  An improvement would be to pass in the query, but no time to rewrite.</summary>
        public DataTable GetTempTable()
        {
            return(Reports.GetTable(Query));
        }
Ejemplo n.º 36
0
 public PublishRoot(Runtime.Project project, string outputPath, IServiceProvider hostServices, Reports reports)
 {
     _project                  = project;
     Reports                   = reports;
     Projects                  = new List <PublishProject>();
     Packages                  = new List <PublishPackage>();
     Runtimes                  = new List <PublishRuntime>();
     OutputPath                = outputPath;
     HostServices              = hostServices;
     TargetPackagesPath        = Path.Combine(outputPath, AppRootName, "packages");
     Operations                = new PublishOperations();
     LibraryDependencyContexts = new Dictionary <Library, IList <DependencyContext> >();
 }
Ejemplo n.º 37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage      = new Pages(intProfile, dsn);
            oReport    = new Reports(intProfile, dsn);
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.QueryString["calc"] != null && Request.QueryString["calc"] != "")
            {
                strCalc = Request.QueryString["calc"];
            }
            if (Request.QueryString["repid"] != null && Request.QueryString["repid"] != "")
            {
                intRepId = Int32.Parse(Request.QueryString["repid"]);
            }

            if (!IsPostBack)
            {
                if (strCalc.ToLower() == "y")
                {
                    panFormula.Visible     = true;
                    drpName.DataSource     = oReport.GetOrderReportDataFields(intRepId);
                    drpName.DataTextField  = "name";
                    drpName.DataValueField = "id";
                    drpName.DataBind();
                    drpName.Items.Insert(0, "-- SELECT --");
                    rptFormula.DataSource = oReport.GetOrderReportCalculations(intRepId);
                    rptFormula.DataBind();
                    foreach (RepeaterItem item in rptFormula.Items)
                    {
                        Panel panEdit = item.FindControl("panEdit") as Panel;
                        panEdit.Visible = true;
                        LinkButton oDelete = (LinkButton)item.FindControl("btnDelete");
                        oDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this field?');");
                    }
                }
                else
                {
                    panField.Visible   = true;
                    rptPlot.DataSource = oReport.GetOrderReportDataFields(intRepId);
                    rptPlot.DataBind();
                    foreach (RepeaterItem item in rptPlot.Items)
                    {
                        Panel panEdit = item.FindControl("panEdit") as Panel;
                        panEdit.Visible = true;
                        LinkButton oDelete = (LinkButton)item.FindControl("btnDelete");
                        oDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this field?');");
                    }
                }
            }
            lblNoFields.Visible  = rptPlot.Items.Count == 0;
            lblNoFormula.Visible = rptFormula.Items.Count == 0;

            if (panField.Visible == true)
            {
                btnAdd.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a field name') " +
                                      "&& ValidateDropDown('" + drpType.ClientID + "','Please select a field type') " +
                                      ";");
            }
            else
            {
                btnAddFormula.Attributes.Add("onclick", "return ValidateDropDown('" + drpName.ClientID + "','Please select a field name') " +
                                             ";");
            }
        }
Ejemplo n.º 38
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        try
        {
            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SAMWAIT", "myApp.hidePleaseWait();", true);
            System.Threading.Thread.Sleep(500);

            string Region        = ddlSearchRegion.SelectedItem.ToString();
            string AgentName     = ddlAgentName.SelectedValue;
            string SPName        = ddl_SPName.SelectedValue;
            string CustomerType  = DDLCustomerType.SelectedValue;
            string CustomerName  = txbCustomerName.Text;
            string ResidenceType = ddlResidenceType.SelectedValue;
            string Status        = ddl_Status.SelectedValue;

            if (Region == "เลือกทั้งหมด")
            {
                Region = string.Empty;
            }

            if (AgentName == "เลือกทั้งหมด")
            {
                AgentName = string.Empty;
            }

            if (SPName == "เลือกทั้งหมด")
            {
                SPName = string.Empty;
            }

            if (CustomerType == "เลือกทั้งหมด")
            {
                CustomerType = string.Empty;
            }
            else if (CustomerType == "สมาชิก")
            {
                CustomerType = "1";
            }
            else if (CustomerType == "ทั่วไป")
            {
                CustomerType = "0";
            }

            if (ResidenceType == "เลือกทั้งหมด")
            {
                ResidenceType = string.Empty;
            }

            if (Status == "เลือกทั้งหมด")
            {
                Status = string.Empty;
            }
            else if (Status == "ยังติดต่ออยู่")
            {
                Status = "1";
            }
            else if (Status == "ระงับการส่งชั่วคราว")
            {
                Status = "2";
            }
            else if (Status == "ขาดการติดต่อ")
            {
                Status = "3";
            }

            List <RPT_Customer_INFO_41211> rt_RPT_Customer_INFO = new List <RPT_Customer_INFO_41211>();

            rt_RPT_Customer_INFO = Reports.RPT_Customer_INFO_41211(Region, AgentName, CustomerType, CustomerName
                                                                   , SPName, ResidenceType, Status, string.Empty, string.Empty, string.Empty);

            if (rt_RPT_Customer_INFO.Count > 0)
            {
                string User_ID = Request.Cookies["User_ID"].Value;
                string url     = "../Report/ReportViewer.aspx?RPT=ReportCustomerDetails&Region=" + ddlSearchRegion.SelectedItem
                                 + "&AgentName=" + ddlAgentName.SelectedValue
                                 + "&AgentFullName=" + ddlAgentName.SelectedItem.ToString()
                                 + "&CustomerType=" + DDLCustomerType.SelectedValue
                                 + "&CustomerName=" + txbCustomerName.Text
                                 + "&SPName=" + ddl_SPName.SelectedValue
                                 + "&SPFullName=" + ddl_SPName.SelectedItem.ToString()
                                 + "&ResidenceType=" + ddlResidenceType.SelectedValue
                                 + "&ResidenceTypeFullName=" + ddlResidenceType.SelectedItem.ToString()
                                 + "&Status=" + ddl_Status.SelectedValue;

                string s = "window.open('" + url + "', 'popup_window', 'width=1024,height=768,left=100,top=100,resizable=yes');";


                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SAM", s, true);
            }
            else
            {
                Messages.Show("ไม่พบข้อมูล กรุณาเลือกเงื่อนไขอีกครั้ง", this.Page);
            }
        }
        catch (Exception ex)
        {
            logger.Error(ex.Message);
        }
    }
 public void ThenUserShouldLandOnTheHomePage()
 {
     Assert.AreEqual(driver.Title, "nopCommerce - ASP.NET Open-source Ecommerce Shopping Cart Solution");
     try
     {
         Assert.IsTrue(driver.PageSource.Contains("My account"), "User has not landed on Home Page");
         test.Pass("Login Successful", MediaEntityBuilder.CreateScreenCaptureFromPath(Reports.SaveScreenshot(driver)).Build());
     }
     catch (Exception)
     {
         test.Fail("Failure occurred ", MediaEntityBuilder.CreateScreenCaptureFromPath(Reports.SaveScreenshot(driver)).Build());
     }
 }
Ejemplo n.º 40
0
        public ScientistModel(Scientist scientist, bool downloadEntityDates = true)
        {
            Scientist = scientist;

            if (downloadEntityDates)
            {
                List <Conference> conferences = ScientistService.GetConferences(Scientist);
                foreach (Conference c in conferences)
                {
                    Conferences.Add(new ConferenceModel(c, false));
                }

                foreach (Report r in Scientist.Reports)
                {
                    Reports.Add(new ReportModel(r));
                }

                List <Organization> organizations = ScientistService.GetOrganizations(Scientist);
                foreach (Organization o in organizations)
                {
                    Organizations.Add(new OrganizationModel(o, false));
                }
            }

            Conferences.CollectionChanged += (o, e) =>
            {
                if (e.Action.ToString().Equals("Add"))
                {
                    ConferenceModel cm = null;
                    foreach (ConferenceModel cmo in e.NewItems)
                    {
                        cm = cmo;
                    }
                    ScientistService.AddConference(Scientist, cm.Conference);
                }
                else if (e.Action.ToString().Equals("Remove"))
                {
                    ConferenceModel cm = null;
                    foreach (ConferenceModel cmo in e.OldItems)
                    {
                        cm = cmo;
                    }
                    ScientistService.RemoveConference(Scientist, cm.Conference);
                }
                OnPropertyChanged("Conferences");
            };

            Reports.CollectionChanged += (o, e) =>
            {
                if (e.Action.ToString().Equals("Add"))
                {
                    ReportModel rm = null;
                    foreach (ReportModel rem in e.NewItems)
                    {
                        rm = rem;
                    }
                    ScientistService.AddReport(Scientist, rm.Report);
                }
                else if (e.Action.ToString().Equals("Remove"))
                {
                    ReportModel rm = null;
                    foreach (ReportModel rem in e.OldItems)
                    {
                        rm = rem;
                    }
                    ScientistService.RemoveReport(Scientist, rm.Report);
                }
                OnPropertyChanged("Reports");
                OnPropertyChanged("ReportsCount");
            };

            Organizations.CollectionChanged += (o, e) =>
            {
                if (e.Action.ToString().Equals("Add"))
                {
                    OrganizationModel om = null;
                    foreach (OrganizationModel orm in e.NewItems)
                    {
                        om = orm;
                    }
                    ScientistService.AddOrganization(Scientist, om.Organization);
                }
                else if (e.Action.ToString().Equals("Remove"))
                {
                    OrganizationModel om = null;
                    foreach (OrganizationModel orm in e.OldItems)
                    {
                        om = orm;
                    }
                    ScientistService.RemoveOrganization(Scientist, om.Organization);
                }
                OnPropertyChanged("Organizations");
            };
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Perform the server specific tasks when an event occurs
        /// </summary>
        /// <param name="E"></param>
        /// <returns></returns>
        override protected async Task <bool> ProcessEvent(GameEvent E)
        {
            if (E.Type == GameEvent.EventType.ConnectionLost)
            {
                var exception = E.Extra as Exception;
                Logger.WriteError(exception.Message);
                if (exception.Data["internal_exception"] != null)
                {
                    Logger.WriteDebug($"Internal Exception: {exception.Data["internal_exception"]}");
                }
                Logger.WriteInfo("Connection lost to server, so we are throttling the poll rate");
                Throttled = true;
            }

            if (E.Type == GameEvent.EventType.ConnectionRestored)
            {
                if (Throttled)
                {
                    Logger.WriteVerbose(loc["MANAGER_CONNECTION_REST"].FormatExt($"[{IP}:{Port}]"));
                }
                Logger.WriteInfo("Connection restored to server, so we are no longer throttling the poll rate");
                Throttled = false;
            }

            if (E.Type == GameEvent.EventType.ChangePermission)
            {
                var newPermission = (Permission)E.Extra;

                if (newPermission < Permission.Moderator)
                {
                    // remove banned or demoted privileged user
                    Manager.GetPrivilegedClients().Remove(E.Target.ClientId);
                }

                else
                {
                    if (Manager.GetPrivilegedClients().ContainsKey(E.Target.ClientId))
                    {
                        Manager.GetPrivilegedClients()[E.Target.ClientId] = E.Target;
                    }

                    else
                    {
                        Manager.GetPrivilegedClients().Add(E.Target.ClientId, E.Target);
                    }
                }

                Logger.WriteInfo($"{E.Origin} is setting {E.Target} to permission level {newPermission}");
                await Manager.GetClientService().UpdateLevel(newPermission, E.Target, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.PreConnect)
            {
                // we don't want to track bots in the database at all if ignore bots is requested
                if (E.Origin.IsBot && Manager.GetApplicationSettings().Configuration().IgnoreBots)
                {
                    return(false);
                }

                var existingClient = GetClientsAsList().FirstOrDefault(_client => _client.Equals(E.Origin));

                // they're already connected
                if (existingClient != null)
                {
                    Logger.WriteWarning($"detected preconnect for {E.Origin}, but they are already connected");
                    return(false);
                }

CONNECT:
                if (Clients[E.Origin.ClientNumber] == null)
                {
#if DEBUG == true
                    Logger.WriteDebug($"Begin PreConnect for {E.Origin}");
#endif
                    // we can go ahead and put them in so that they don't get re added
                    Clients[E.Origin.ClientNumber] = E.Origin;
                    await OnClientConnected(E.Origin);

                    ChatHistory.Add(new ChatInfo()
                    {
                        Name    = E.Origin.Name,
                        Message = "CONNECTED",
                        Time    = DateTime.UtcNow
                    });

                    if (E.Origin.Level > EFClient.Permission.Moderator)
                    {
                        E.Origin.Tell(string.Format(loc["SERVER_REPORT_COUNT"], E.Owner.Reports.Count));
                    }
                }

                // for some reason there's still a client in the spot
                else
                {
                    Logger.WriteWarning($"{E.Origin} is connecteding but {Clients[E.Origin.ClientNumber]} is currently in that client slot");
                    await OnClientDisconnected(Clients[E.Origin.ClientNumber]);

                    goto CONNECT;
                }
            }

            else if (E.Type == GameEvent.EventType.Flag)
            {
                // todo: maybe move this to a seperate function
                Penalty newPenalty = new Penalty()
                {
                    Type     = Penalty.PenaltyType.Flag,
                    Expires  = DateTime.UtcNow,
                    Offender = E.Target,
                    Offense  = E.Data,
                    Punisher = E.Origin,
                    When     = DateTime.UtcNow,
                    Link     = E.Target.AliasLink
                };

                var addedPenalty = await Manager.GetPenaltyService().Create(newPenalty);

                E.Target.SetLevel(Permission.Flagged, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.Unflag)
            {
                var unflagPenalty = new Penalty()
                {
                    Type     = Penalty.PenaltyType.Unflag,
                    Expires  = DateTime.UtcNow,
                    Offender = E.Target,
                    Offense  = E.Data,
                    Punisher = E.Origin,
                    When     = DateTime.UtcNow,
                    Link     = E.Target.AliasLink
                };

                await Manager.GetPenaltyService().Create(unflagPenalty);

                E.Target.SetLevel(Permission.User, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.Report)
            {
                Reports.Add(new Report()
                {
                    Origin = E.Origin,
                    Target = E.Target,
                    Reason = E.Data
                });
            }

            else if (E.Type == GameEvent.EventType.TempBan)
            {
                await TempBan(E.Data, (TimeSpan)E.Extra, E.Target, E.Origin);;
            }

            else if (E.Type == GameEvent.EventType.Ban)
            {
                bool isEvade = E.Extra != null ? (bool)E.Extra : false;
                await Ban(E.Data, E.Target, E.Origin, isEvade);
            }

            else if (E.Type == GameEvent.EventType.Unban)
            {
                await Unban(E.Data, E.Target, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.Kick)
            {
                await Kick(E.Data, E.Target, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.Warn)
            {
                await Warn(E.Data, E.Target, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.Disconnect)
            {
                ChatHistory.Add(new ChatInfo()
                {
                    Name    = E.Origin.Name,
                    Message = "DISCONNECTED",
                    Time    = DateTime.UtcNow
                });

                await new MetaService().AddPersistentMeta("LastMapPlayed", CurrentMap.Alias, E.Origin);
                await new MetaService().AddPersistentMeta("LastServerPlayed", E.Owner.Hostname, E.Origin);
            }

            else if (E.Type == GameEvent.EventType.PreDisconnect)
            {
                // predisconnect comes from minimal rcon polled players and minimal log players
                // so we need to disconnect the "full" version of the client
                var client = GetClientsAsList().FirstOrDefault(_client => _client.Equals(E.Origin));

                if (client != null)
                {
#if DEBUG == true
                    Logger.WriteDebug($"Begin PreDisconnect for {client}");
#endif
                    await OnClientDisconnected(client);

#if DEBUG == true
                    Logger.WriteDebug($"End PreDisconnect for {client}");
#endif
                }

                else if (client?.State != ClientState.Disconnecting)
                {
                    Logger.WriteWarning($"Client {E.Origin} detected as disconnecting, but could not find them in the player list");
                    Logger.WriteDebug($"Expected {E.Origin} but found {GetClientsAsList().FirstOrDefault(_client => _client.ClientNumber == E.Origin.ClientNumber)}");
                    return(false);
                }
            }

            else if (E.Type == GameEvent.EventType.Update)
            {
#if DEBUG == true
                Logger.WriteDebug($"Begin Update for {E.Origin}");
#endif
                await OnClientUpdate(E.Origin);
            }

            if (E.Type == GameEvent.EventType.Say)
            {
                E.Data = E.Data.StripColors();

                if (E.Data?.Length > 0)
                {
                    string message = E.Data;
                    if (E.Data.IsQuickMessage())
                    {
                        try
                        {
                            message = Manager.GetApplicationSettings().Configuration()
                                      .QuickMessages
                                      .First(_qm => _qm.Game == GameName)
                                      .Messages[E.Data.Substring(1)];
                        }
                        catch { }
                    }

                    ChatHistory.Add(new ChatInfo()
                    {
                        Name    = E.Origin.Name,
                        Message = message,
                        Time    = DateTime.UtcNow
                    });
                }
            }

            if (E.Type == GameEvent.EventType.MapChange)
            {
                Logger.WriteInfo($"New map loaded - {ClientNum} active players");

                // iw4 doesn't log the game info
                if (E.Extra == null)
                {
                    var dict = await this.GetInfoAsync();

                    if (dict == null)
                    {
                        Logger.WriteWarning("Map change event response doesn't have any data");
                    }

                    else
                    {
                        Gametype = dict["gametype"].StripColors();
                        Hostname = dict["hostname"]?.StripColors();

                        string mapname = dict["mapname"]?.StripColors() ?? CurrentMap.Name;
                        CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map()
                        {
                            Alias = mapname, Name = mapname
                        };
                    }
                }

                else
                {
                    var dict = (Dictionary <string, string>)E.Extra;
                    Gametype   = dict["g_gametype"].StripColors();
                    Hostname   = dict["sv_hostname"].StripColors();
                    MaxClients = int.Parse(dict["sv_maxclients"]);

                    string mapname = dict["mapname"].StripColors();
                    CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map()
                    {
                        Alias = mapname,
                        Name  = mapname
                    };
                }
            }

            if (E.Type == GameEvent.EventType.MapEnd)
            {
                Logger.WriteInfo("Game ending...");
                SessionStart = DateTime.UtcNow;
            }

            if (E.Type == GameEvent.EventType.Tell)
            {
                await Tell(E.Message, E.Target);
            }

            if (E.Type == GameEvent.EventType.Broadcast)
            {
#if DEBUG == false
                // this is a little ugly but I don't want to change the abstract class
                if (E.Data != null)
                {
                    await E.Owner.ExecuteCommandAsync(E.Data);
                }
#endif
            }

            lock (ChatHistory)
            {
                while (ChatHistory.Count > Math.Ceiling(ClientNum / 2.0))
                {
                    ChatHistory.RemoveAt(0);
                }
            }

            // the last client hasn't fully disconnected yet
            // so there will still be at least 1 client left
            if (ClientNum < 2)
            {
                ChatHistory.Clear();
            }

            return(true);
        }
    protected override void OnInit(EventArgs e)
    {
        CachePage = true;

        base.OnInit(e);


        gridReport.GroupingSettings.CaseSensitive = false;

        _report = null;
        try
        {
            _reportID = int.Parse(Request["ReportID"]);
            if (_reportID < 0)
            {
                throw new Exception("Invalid ReportID");
            }
            _report = (Report)Reports.GetReport(UserSession.LoginUser, _reportID);
            if (_report == null)
            {
                throw new Exception("Invalid Report");
            }
            if (_report.OrganizationID != null && UserSession.LoginUser.OrganizationID != 1 && UserSession.LoginUser.OrganizationID != 1078)
            {
                if (_report.OrganizationID != UserSession.LoginUser.OrganizationID)
                {
                    _report = null;
                    throw new Exception("Invalid Report");
                }
            }
        }
        catch (Exception ex)
        {
            ExceptionLogs.LogException(UserSession.LoginUser, ex, "ReportResults");
            Response.Write("There was an error retrieving your report.");
            Response.End();
            return;
        }
        _isCustom = _report.ReportSubcategoryID != null;

        fieldReportID.Value = _reportID.ToString();

        if (!IsPostBack)
        {
            if (_isCustom)
            {
                filterControl.ReportSubcategoryID = (int)_report.ReportSubcategoryID;
                filterControl.ReportID            = _reportID;
                int h = Settings.UserDB.ReadInt("ReportFilterHeight_" + _reportID.ToString(), 175);
                if (h > 300)
                {
                    h = 300;
                }
                paneFilters.Height = new Unit(h, UnitType.Pixel);
            }
            else
            {
                //paneFilters.Visible = false;
                paneFilters.Height = new Unit(1, UnitType.Pixel);
                barFilters.Visible = false;
            }


            try
            {
                CreateColumns(_report);
                LoadReportSettings();
            }
            catch (Exception ex)
            {
                ExceptionLogs.LogException(UserSession.LoginUser, ex, "Reports");
            }
        }
    }
Ejemplo n.º 43
0
 public void RemoveReports(DateTime beforeDate)
 {
     Reports.RemoveAll(usage => usage.Dimensions.Date.Date < beforeDate.Date);
 }
Ejemplo n.º 44
0
 public List <Usage> SelectReports(DateTime beforeDate)
 {
     return(Reports.Where(usage => usage.Dimensions.Date.Date < beforeDate.Date).ToList());
 }
Ejemplo n.º 45
0
 public void SetHidden(int reportID, bool value)
 {
     Reports.SetIsHiddenFromUser(TSAuthentication.GetLoginUser(), TSAuthentication.UserID, reportID, value);
 }
 public void ThenHeShouldSeeAnErrorMessageStatingThatTheLoginAttemptWasNotSuccessful()
 {
     Assert.IsTrue(driver.PageSource.Contains("Your login attempt was not successful. Please try again."));
     test.Pass("Login Attempt Failure", MediaEntityBuilder.CreateScreenCaptureFromPath(Reports.SaveScreenshot(driver)).Build());
 }
Ejemplo n.º 47
0
        public void ReportDateRangeTrue()
        {
            Reports reports = new Reports();

            Assert.IsTrue(SeedUser());
        }
Ejemplo n.º 48
0
    private void DisplayReportExpenditure()
    {
        logger.Info(HttpContext.Current.Request.Cookies["User_ID"].Value + " " + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " " + System.Reflection.MethodBase.GetCurrentMethod().Name);
        try
        {
            List <RPT_EXPENSE_MONTHLY_41218> rt_RPT_EXPENSE_MONTHLY = new List <RPT_EXPENSE_MONTHLY_41218>();
            string                User_ID    = HttpContext.Current.Request.Cookies["User_ID"].Value;
            dbo_UserClass         user_class = dbo_UserDataClass.Select_Record(User_ID);
            List <dbo_AgentClass> agent      = dbo_AgentDataClass.Search(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Active", string.Empty);
            if (user_class.User_Group_ID == "CP Meiji")
            {
                string region = user_class.Region;

                string[] regions = region.Split(',');

                List <dbo_AgentClass> cv_code_ = new List <dbo_AgentClass>();

                foreach (string in_region in regions)
                {
                    List <dbo_AgentClass> cv_code2 = new List <dbo_AgentClass>(agent.Where(f => f.Location_Region == in_region).Select(f => f));
                    foreach (dbo_AgentClass _cv in cv_code2)
                    {
                        //cv_code_.Add(_cv);
                        List <RPT_EXPENSE_MONTHLY_41218> _inrpt = Reports.RPT_EXPENSE_MONTHLY_41218(string.Empty, _cv.CV_Code, MonthGroup, MonthGroupTo, Year, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

                        foreach (RPT_EXPENSE_MONTHLY_41218 rpt in _inrpt)
                        {
                            rt_RPT_EXPENSE_MONTHLY.Add(rpt);
                        }
                    }
                }


                foreach (var d in rt_RPT_EXPENSE_MONTHLY)
                {
                    d.paramCV_Code = d.CV_Code;


                    dbo_AgentClass _agent = dbo_AgentDataClass.Select_Record(d.paramCV_Code);
                    d.paramCV_Name = _agent.AgentName;

                    //user_class = dbo_UserDataClass.Select_Record(d.paramCV_Code);
                    //d.paramCV_Name = user_class.AgentName;



                    d.paramYear       = Request.QueryString["Year"];
                    d.paramStartMonth = CV_Month(MonthGroup);
                    d.paramEndMonth   = CV_Month(MonthGroupTo);
                }
            }
            else
            {
                rt_RPT_EXPENSE_MONTHLY = Reports.RPT_EXPENSE_MONTHLY_41218(string.Empty, CV_CODE, MonthGroup, MonthGroupTo, Year, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

                foreach (var d in rt_RPT_EXPENSE_MONTHLY)
                {
                    d.paramCV_Code = CV_CODE;

                    dbo_AgentClass _agent = dbo_AgentDataClass.Select_Record(d.paramCV_Code);
                    d.paramCV_Name = _agent.AgentName;

                    d.paramYear       = Request.QueryString["Year"];
                    d.paramStartMonth = CV_Month(MonthGroup);
                    d.paramEndMonth   = CV_Month(MonthGroupTo);
                }
            }


            cryRpt.Load(Server.MapPath("~/Report/RT_ReportExpenditure.rpt"));
            cryRpt.SetDataSource(rt_RPT_EXPENSE_MONTHLY);

            ReportViewer1.ToolPanelView  = ToolPanelViewType.None;
            ReportViewer1.HasCrystalLogo = false;
            ReportViewer1.ReportSource   = cryRpt;
            ReportViewer1.RefreshReport();

            //BinaryReader stream = new BinaryReader(cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
            //Response.ClearContent();
            //Response.ClearHeaders();
            //Response.ContentType = "application/pdf";
            //Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)));
            //Response.Flush();
            //Response.Close();
        }
        catch (Exception ex)
        {
            logger.Error(ex.Message);
        }
    }
Ejemplo n.º 49
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        try
        {
            if (IsValidForm())
            {
                System.Threading.Thread.Sleep(500);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SAMWAIT", "myApp.hidePleaseWait();", true);

                string Region       = ddlSearchRegion.SelectedValue;
                string AgentName    = ddlAgentName.SelectedValue;
                string Month_From   = ddlMonth_From.SelectedValue;
                string Month_To     = ddlMonth_To.SelectedValue;
                string ProductGroup = ddl_ProductGroup.SelectedValue;
                string Size         = ddl_Size.SelectedValue;
                string UnitType     = ddlUnit.SelectedValue;
                if (Region == "เลือกทั้งหมด")
                {
                    Region = string.Empty;
                }
                if (AgentName == "เลือกทั้งหมด")
                {
                    AgentName = string.Empty;
                }
                if (ProductGroup == "เลือกทั้งหมด")
                {
                    ProductGroup = string.Empty;
                }
                if (Size == "เลือกทั้งหมด")
                {
                    Size = string.Empty;
                }
                List <RPT_AnnualReport_4121> rt_RPT_Order = new List <RPT_AnnualReport_4121>();
                string                User_ID             = Request.Cookies["User_ID"].Value;
                dbo_UserClass         user_class          = dbo_UserDataClass.Select_Record(User_ID);
                List <dbo_AgentClass> agent = dbo_AgentDataClass.Search(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Active", string.Empty);

                if (user_class.User_Group_ID == "CP Meiji")
                {
                    string   region  = user_class.Region;
                    string[] regions = region.Split(',');

                    List <dbo_AgentClass> cv_code2 = new List <dbo_AgentClass>(agent.Where(f => regions.Contains(f.Location_Region)).Select(f => f));
                    List <dbo_AgentClass> cv_code1 = new List <dbo_AgentClass>(agent.Where(f => f.DM_ID == User_ID || f.GM_ID == User_ID.Trim() || f.SD_ID == User_ID.Trim() || f.SM_ID == User_ID.Trim() || f.APV_ID == User_ID.Trim()).Select(f => f));

                    if (cv_code1.Count > 0)
                    {
                        if (AgentName == string.Empty)
                        {
                            foreach (dbo_AgentClass _cv in cv_code1)
                            {
                                List <RPT_AnnualReport_4121> _inrpt = Reports.RPT_AnnualReport_4121(string.Empty, _cv.CV_Code, Month_From, Month_To, txt_Year.Text, ProductGroup, Size, UnitType, string.Empty);

                                foreach (RPT_AnnualReport_4121 rpt in _inrpt)
                                {
                                    rt_RPT_Order.Add(rpt);
                                }
                            }
                        }
                        else
                        {
                            foreach (dbo_AgentClass _cv in cv_code1)
                            {
                                List <RPT_AnnualReport_4121> _inrpt = Reports.RPT_AnnualReport_4121(string.Empty, AgentName, Month_From, Month_To, txt_Year.Text, ProductGroup, Size, UnitType, string.Empty);

                                foreach (RPT_AnnualReport_4121 rpt in _inrpt)
                                {
                                    rt_RPT_Order.Add(rpt);
                                }
                            }
                        }
                    }
                    else //เงื่อนไข CV ใน Region
                    {
                        if (Region == string.Empty)
                        {
                            foreach (dbo_AgentClass _cv in cv_code2)
                            {
                                List <RPT_AnnualReport_4121> _inrpt = Reports.RPT_AnnualReport_4121(_cv.Location_ID, AgentName, Month_From, Month_To, txt_Year.Text, ProductGroup, Size, UnitType, string.Empty);

                                foreach (RPT_AnnualReport_4121 rpt in _inrpt)
                                {
                                    rt_RPT_Order.Add(rpt);
                                }
                            }
                        }
                        else
                        {
                            foreach (dbo_AgentClass _cv in cv_code2)
                            {
                                List <RPT_AnnualReport_4121> _inrpt = Reports.RPT_AnnualReport_4121(Region, AgentName, Month_From, Month_To, txt_Year.Text, ProductGroup, Size, UnitType, string.Empty);

                                foreach (RPT_AnnualReport_4121 rpt in _inrpt)
                                {
                                    rt_RPT_Order.Add(rpt);
                                }
                            }
                        }
                    }
                }
                else
                {
                    rt_RPT_Order = Reports.RPT_AnnualReport_4121(Region, AgentName, Month_From, Month_To, txt_Year.Text, ProductGroup, Size, UnitType, string.Empty);
                }


                if (rt_RPT_Order.Count > 0)
                {
                    string url = "../Report/ReportViewer.aspx?RPT=RPT_Order&Region=" + ddlSearchRegion.SelectedValue
                                 + "&AgentName=" + ddlAgentName.SelectedValue
                                 + "&Month_From=" + ddlMonth_From.SelectedValue
                                 + "&Month_To=" + ddlMonth_To.SelectedValue
                                 + "&Year=" + txt_Year.Text
                                 + "&ProductGroup=" + ddl_ProductGroup.SelectedValue
                                 + "&Size=" + ddl_Size.SelectedValue
                                 + "&Unit=" + ddlUnit.SelectedValue;

                    string s = "window.open('" + url + "', 'popup_window', 'width=1024,height=768,left=100,top=100,resizable=yes');";

                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SAM", s, true);
                }
                else
                {
                    Messages.Show("ไม่พบข้อมูล กรุณาเลือกเงื่อนไขอีกครั้ง", this.Page);
                }
            }
            else
            {
                System.Threading.Thread.Sleep(500);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SAMWAIT", "myApp.hidePleaseWait();", true);
                ddlMonth_From.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {
            logger.Error(ex);
        }
    }
Ejemplo n.º 50
0
    private void DisplayReportDailyFinance()
    {
        try
        {
            List <RPT_SALE_AMT_DAILY_41220A> rt_RPT_AMT_DAILY = new List <RPT_SALE_AMT_DAILY_41220A>();
            #region old
            //string User_ID = HttpContext.Current.Request.Cookies["User_ID"].Value;
            //dbo_UserClass user_class = dbo_UserDataClass.Select_Record(User_ID);
            //List<dbo_AgentClass> agent = dbo_AgentDataClass.Search(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Active", string.Empty);

            //if (user_class.User_Group_ID == "CP Meiji")
            //{
            //    string region = user_class.Region;

            //    string[] regions = region.Split(',');

            //    List<dbo_AgentClass> cv_code_ = new List<dbo_AgentClass>();

            //    foreach (string in_region in regions)
            //    {
            //        List<dbo_AgentClass> cv_code2 = new List<dbo_AgentClass>(agent.Where(f => f.Location_Region == in_region).Select(f => f));
            //        foreach (dbo_AgentClass _cv in cv_code2)
            //        {

            //            List<RPT_SALE_AMT_DAILY_41220A> _inrpt = Reports.RPT_SALE_AMT_DAILY_41220A(string.Empty, _cv.CV_Code , InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
            //            foreach (RPT_SALE_AMT_DAILY_41220A rpt in _inrpt)
            //            {
            //                rt_RPT_AMT_DAILY.Add(rpt);
            //            }
            //        }
            //    }

            //}
            //else
            //{

            //    rt_RPT_AMT_DAILY = Reports.RPT_SALE_AMT_DAILY_41220A(string.Empty, string.Empty, InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
            //}
            #endregion

            string                User_ID    = HttpContext.Current.Request.Cookies["User_ID"].Value;
            dbo_UserClass         user_class = dbo_UserDataClass.Select_Record(User_ID);
            List <dbo_AgentClass> agent      = dbo_AgentDataClass.Search(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Active", string.Empty);

            if (user_class.User_Group_ID == "CP Meiji")
            {
                string   region  = user_class.Region;
                string[] regions = region.Split(',');

                List <dbo_AgentClass> cv_code2 = new List <dbo_AgentClass>(agent.Where(f => regions.Contains(f.Location_Region)).Select(f => f));
                foreach (dbo_AgentClass _cv in cv_code2)
                {
                    List <RPT_SALE_AMT_DAILY_41220A> _inrpt = Reports.RPT_SALE_AMT_DAILY_41220A(string.Empty, _cv.CV_Code, InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

                    foreach (RPT_SALE_AMT_DAILY_41220A rpt in _inrpt)
                    {
                        rt_RPT_AMT_DAILY.Add(rpt);
                    }
                }
            }
            else
            {
                rt_RPT_AMT_DAILY = Reports.RPT_SALE_AMT_DAILY_41220A(string.Empty, CV_CODE, InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
            }

            foreach (var d in rt_RPT_AMT_DAILY)
            {
                d.Create_Date = DateTime.Now.ToShortDateString();
            }

            cryRpt.Load(Server.MapPath("~/Report/RT_ReportDailyFinance.rpt"));
            cryRpt.SetDataSource(rt_RPT_AMT_DAILY);

            ReportViewer1.ToolPanelView  = ToolPanelViewType.None;
            ReportViewer1.HasCrystalLogo = false;
            ReportViewer1.ReportSource   = cryRpt;
            ReportViewer1.RefreshReport();

            //BinaryReader stream = new BinaryReader(cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
            //Response.ClearContent();
            //Response.ClearHeaders();
            //Response.ContentType = "application/pdf";
            //Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)));
            //Response.Flush();
            //Response.Close();
        }
        catch (Exception ex)
        {
            logger.Error(ex.Message);
        }
    }
Ejemplo n.º 51
0
 public int GetNumberOfExecutedBenchmarks() => Reports.Count(report => report.ExecuteResults.Any(result => result.FoundExecutable));
Ejemplo n.º 52
0
 public void SaveUserSettings(int reportID, string data)
 {
     Reports.SetUserSettings(TSAuthentication.GetLoginUser(), TSAuthentication.UserID, reportID, data);
 }
Ejemplo n.º 53
0
 ///<summary>Sends the query to the database to retrieve the table.  Then initializes the column objects.</summary>
 public void SubmitQuery()
 {
     TableQ = Reports.GetTable(Query);
     InitializeColumns();
 }
Ejemplo n.º 54
0
 public ReportColumn[] GetReportColumns(int reportID)
 {
     return(Reports.GetReportColumns(TSAuthentication.GetLoginUser(), reportID));
 }
Ejemplo n.º 55
0
    private void DisplayReportSummaryIncome()
    {
        try
        {
            List <RPT_SUMM_EXPENSE_41219> rt_RPT_EXPENSE = new List <RPT_SUMM_EXPENSE_41219>();


            string                User_ID    = HttpContext.Current.Request.Cookies["User_ID"].Value;
            dbo_UserClass         user_class = dbo_UserDataClass.Select_Record(User_ID);
            List <dbo_AgentClass> agent      = dbo_AgentDataClass.Search(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Active", string.Empty);
            if (user_class.User_Group_ID == "CP Meiji")
            {
                string region = user_class.Region;

                string[] regions = region.Split(',');

                List <dbo_AgentClass> cv_code_ = new List <dbo_AgentClass>();

                foreach (string in_region in regions)
                {
                    List <dbo_AgentClass> cv_code2 = new List <dbo_AgentClass>(agent.Where(f => f.Location_Region == in_region).Select(f => f));
                    foreach (dbo_AgentClass _cv in cv_code2)
                    {
                        List <RPT_SUMM_EXPENSE_41219> _inrpt = Reports.RPT_SUMM_EXPENSE_41219(string.Empty, _cv.CV_Code, InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

                        foreach (RPT_SUMM_EXPENSE_41219 rpt in _inrpt)
                        {
                            rt_RPT_EXPENSE.Add(rpt);
                        }
                    }
                }


                foreach (var d in rt_RPT_EXPENSE)
                {
                    d.paramCV_Code = d.CV_Code;

                    // dbo_AgentClass _agent = dbo_AgentDataClass.Select_Record(d.paramCV_Code);
                    dbo_AgentClass _agent = agent.FirstOrDefault(f => f.CV_Code == d.CV_Code);
                    if (_agent != null)
                    {
                        d.paramCV_Name = _agent.AgentName;
                    }

                    d.Temp0 = DateTime.Now.ToShortDateString();
                }
            }
            else
            {
                rt_RPT_EXPENSE = Reports.RPT_SUMM_EXPENSE_41219(string.Empty, CV_CODE, InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

                foreach (var d in rt_RPT_EXPENSE)
                {
                    d.paramCV_Code = d.CV_Code;

                    // dbo_AgentClass _agent = dbo_AgentDataClass.Select_Record(d.paramCV_Code);
                    dbo_AgentClass _agent = agent.FirstOrDefault(f => f.CV_Code == d.CV_Code);

                    if (_agent != null)
                    {
                        d.paramCV_Name = _agent.AgentName;
                    }
                    d.Temp0 = DateTime.Now.ToShortDateString();
                }
            }



            /*
             * rt_RPT_EXPENSE = Reports.RPT_SUMM_EXPENSE_41219(string.Empty, CV_CODE, InvoiceDate, InvoiceDateTo, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
             *
             * foreach (var d in rt_RPT_EXPENSE)
             * {
             *  d.paramCV_Code = CV_CODE;
             *  user_class = dbo_UserDataClass.Select_Record(d.paramCV_Code);
             *  d.paramCV_Name = user_class.AgentName;
             * }
             */



            cryRpt.Load(Server.MapPath("~/Report/RT_ReportSummaryIncome.rpt"));
            cryRpt.SetDataSource(rt_RPT_EXPENSE);

            ReportViewer1.ToolPanelView  = ToolPanelViewType.None;
            ReportViewer1.HasCrystalLogo = false;
            ReportViewer1.ReportSource   = cryRpt;
            ReportViewer1.RefreshReport();

            //BinaryReader stream = new BinaryReader(cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
            //Response.ClearContent();
            //Response.ClearHeaders();
            //Response.ContentType = "application/pdf";
            //Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)));
            //Response.Flush();
            //Response.Close();
        }
        catch (Exception ex)
        {
            logger.Error(ex.Message);
        }
    }
        private void ImprimePedidosSec()
        {
            try
            {
                Reports        _Reporte  = new Reports();
                ReportDocument objReport = new ReportDocument();

                //String reportPath = Application.StartupPath + @"\Reporting\" + "IngresoCompras_Sintetico.rpt";

                String reportPath = ConfigurationManager.AppSettings["Reports"] + "\\Reporting\\" + "PedidoLab.rpt";
                objReport.Load(reportPath);
                objReport.Refresh();
                objReport.ReportOptions.EnableSaveDataWithReport = false;


                // PARAMETROS DE CONEXION
                TableLogOnInfo logoninfo = new TableLogOnInfo();
                logoninfo.ConnectionInfo.ServerName         = ConfigurationManager.AppSettings["Source"];
                logoninfo.ConnectionInfo.DatabaseName       = ConfigurationManager.AppSettings["CatalogSISTMED"];
                logoninfo.ConnectionInfo.UserID             = ConfigurationManager.AppSettings["User ID"];
                logoninfo.ConnectionInfo.Password           = ConfigurationManager.AppSettings["Password"];
                logoninfo.ConnectionInfo.IntegratedSecurity = false;
                Tables tables = objReport.Database.Tables;
                foreach (Table table in tables)
                {
                    table.ApplyLogOnInfo(logoninfo);
                }
                // FIN PARAMETROS DE CONEXION

                ParameterFields        Parametros     = new ParameterFields();
                ParameterField         ParametroField = new ParameterField();
                ParameterDiscreteValue ParametroValue = new ParameterDiscreteValue();
                Parametros.Clear();
                //1er PARAMETRO
                ParametroField.Name = "@INF";
                if (radioTodos.Checked)
                {
                    ParametroValue.Value = "TOD";
                }
                if (radioTipo.Checked)
                {
                    ParametroValue.Value = "TIP";
                }
                if (radioSector.Checked)
                {
                    ParametroValue.Value = "SEC";
                }
                if (radioEstado.Checked)
                {
                    ParametroValue.Value = "EST";
                }
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);

                //2° PARAMETRO
                ParametroField       = new ParameterField();
                ParametroValue       = new ParameterDiscreteValue();
                ParametroField.Name  = "@FECHA_DESDE";
                ParametroValue.Value = this.dateDesde.Value;
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);

                //3° PARAMETRO
                ParametroField       = new ParameterField();
                ParametroValue       = new ParameterDiscreteValue();
                ParametroField.Name  = "@FECHA_HASTA";
                ParametroValue.Value = this.dateHasta.Value;
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);

                //4° PARAMETRO
                ParametroField      = new ParameterField();
                ParametroValue      = new ParameterDiscreteValue();
                ParametroField.Name = "@SECTOR";
                if (cboSector.SelectedIndex == 0)
                {
                    ParametroValue.Value = "GEN";
                }
                if (cboSector.SelectedIndex == 1)
                {
                    ParametroValue.Value = "MIC";
                }
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);

                //5° PARAMETRO
                ParametroField       = new ParameterField();
                ParametroValue       = new ParameterDiscreteValue();
                ParametroField.Name  = "@TIPO";
                ParametroValue.Value = this.cboTipo.SelectedIndex + 1;
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);

                //6° PARAMETRO
                ParametroField       = new ParameterField();
                ParametroValue       = new ParameterDiscreteValue();
                ParametroField.Name  = "@ESTADO";
                ParametroValue.Value = this.cboEstado.SelectedValue;
                ParametroField.CurrentValues.Add(ParametroValue);
                Parametros.Add(ParametroField);


                _Reporte.Parameters = Parametros;
                _Reporte.Reporte    = objReport;
                _Reporte.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 57
0
    private void DisplayReportReduceDebt_CustomerAndAgent()
    {
        List <RPT_CUSTOMER_DEBT_41223> rt_RPT_CUSTOMER_DEBT = new List <RPT_CUSTOMER_DEBT_41223>();
        //rt_RPT_CUSTOMER_DEBT = Reports.RPT_CUSTOMER_DEBT_41223(Region, AgentName, SPName, DebtDate_From, DebtDate_To, Status, string.Empty, string.Empty, string.Empty, string.Empty);
        //cryRpt.Load(Server.MapPath("~/Report/RT_ReportReduceDebt_CustomerAndAgent.rpt"));
        //cryRpt.SetDataSource(rt_RPT_CUSTOMER_DEBT);

        string                User_ID    = HttpContext.Current.Request.Cookies["User_ID"].Value;
        dbo_UserClass         user_class = dbo_UserDataClass.Select_Record(User_ID);
        List <dbo_AgentClass> agent      = dbo_AgentDataClass.Search(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Active", string.Empty);

        if (user_class.User_Group_ID == "CP Meiji")
        {
            string   region  = user_class.Region;
            string[] regions = region.Split(',');
            //string[] CVCode_tmp = agent.Where(f => regions.Contains(f.Location_Region)).Select(f => f.CV_Code).ToArray();

            List <dbo_AgentClass> cv_code2 = new List <dbo_AgentClass>(agent.Where(f => regions.Contains(f.Location_Region)).Select(f => f));
            foreach (dbo_AgentClass _cv in cv_code2)
            {
                List <RPT_CUSTOMER_DEBT_41223> _inrpt = Reports.RPT_CUSTOMER_DEBT_41223(_cv.Location_Region, _cv.CV_Code, SPName, DebtDate_From, DebtDate_To, Status, string.Empty, string.Empty, string.Empty, string.Empty);

                foreach (RPT_CUSTOMER_DEBT_41223 rpt in _inrpt)
                {
                    rt_RPT_CUSTOMER_DEBT.Add(rpt);
                }
            }
        }
        else
        {
            rt_RPT_CUSTOMER_DEBT = Reports.RPT_CUSTOMER_DEBT_41223(Region, AgentName, SPName, DebtDate_From, DebtDate_To, Status, string.Empty, string.Empty, string.Empty, string.Empty);
        }

        // rt_RPT_CUSTOMER_DEBT = Reports.RPT_CUSTOMER_DEBT_41223(Region, AgentName, SPName, DebtDate_From, DebtDate_To, Status, string.Empty, string.Empty, string.Empty, string.Empty);
        cryRpt.Load(Server.MapPath("~/Report/RT_ReportReduceDebt_CustomerAndAgent.rpt"));
        cryRpt.SetDataSource(rt_RPT_CUSTOMER_DEBT);
        #region old
        ///////
        //List<RPT_CUSTOMER_DEBT_41223> rt_RPT_CUSTOMER_DEBT = new List<RPT_CUSTOMER_DEBT_41223>();
        //rt_RPT_CUSTOMER_DEBT = Reports.RPT_CUSTOMER_DEBT_41223(Region, AgentName, SPName, DebtDate_From, DebtDate_To, Status, string.Empty, string.Empty, string.Empty, string.Empty);
        //foreach (var d in rt_RPT_CUSTOMER_DEBT)
        //{
        //    d.pramDebt_StartDate = Request.QueryString["DebtDate_From"];
        //    d.pramDebt_EndDate = Request.QueryString["DebtDate_To"];
        //    d.pramStatus = Request.QueryString["Status"];
        //}
        //cryRpt.Load(Server.MapPath("~/Report/RT_ReportReduceDebt_CustomerAndAgent.rpt"));
        //cryRpt.SetDataSource(rt_RPT_CUSTOMER_DEBT);
        ///////

        #endregion

        ReportViewer1.ToolPanelView  = ToolPanelViewType.None;
        ReportViewer1.HasCrystalLogo = false;
        ReportViewer1.ReportSource   = cryRpt;
        ReportViewer1.RefreshReport();


        //BinaryReader stream = new BinaryReader(cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
        //Response.ClearContent();
        //Response.ClearHeaders();
        //Response.ContentType = "application/pdf";
        //Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)));
        //Response.Flush();
        //Response.Close();
    }
        public void GetBalanceSheet()
        {
            CultureInfo info = new CultureInfo("ne-NP");

            info.NumberFormat.CurrencySymbol = "Rs";
            info.DateTimeFormat              = new DateTimeFormatInfo();
            info.DateTimeFormat.Calendar     = new GregorianCalendar(GregorianCalendarTypes.Localized);
            info.DateTimeFormat.AMDesignator = "AM";
            info.DateTimeFormat.PMDesignator = "PM";
            System.Threading.Thread.CurrentThread.CurrentCulture = info;
            Thread.CurrentThread.CurrentUICulture = info;
            Assets                  = new ObservableCollection <AssetsVm>();
            Liabilities             = new ObservableCollection <LiabilitiesVm>();
            Equities                = new ObservableCollection <Rms.Classes.EquityVm>();
            LiabilitiesAndEquity    = new ObservableCollection <Rms.Classes.LiabilitiesAndEquity>();
            TotalAssetsBalance      = 0;
            TotalLiabilitiesBalance = 0;
            TotalEquityBalance      = 0;
            Reports.Add(new BalanceSheetExport {
                AccountType = "Assets", Date = BalanceSheetDate.Date.ToLongDateString()
            });


            #region grouping
            List <LedgerAccount> acountlistwithparentacount = new List <LedgerAccount>();
            foreach (var item in LedgerAccounts.Where(a => a.parentLedgerAccount != null))
            {
                acountlistwithparentacount.Add(item);
            }
            List <LedgerAccount> accountlistwithoutparentaccount = new List <LedgerAccount>();
            accountlistwithoutparentaccount = LedgerAccounts.Except(acountlistwithparentacount).ToList();

            var groups = acountlistwithparentacount.GroupBy(a => a.parentLedgerAccount);
            #endregion

            #region foreach
            foreach (var item in groups)
            {
                decimal assetgroupbalance = 0;

                foreach (var i in LedgerAccounts.Where(a => a.parentLedgerAccount == item.Key && a.AccountClassId == 1))
                {
                    var v = GetAssets(i);
                    if (v != null)
                    {
                        assetgroupbalance += v.Amount;
                    }
                }
                if (assetgroupbalance > 0)
                {
                    Reports.Add(new BalanceSheetExport {
                        Account = item.Key.AccountName, Balance = assetgroupbalance.ToString("C")
                    });
                    // Assets.Add(new AssetsVm { LedgerAccountName = item.Key.AccountName, Amount = assetgroupbalance });
                }
            }
            #endregion
            foreach (var item in accountlistwithoutparentaccount.Where(a => a.AccountClassId == 1))
            {
                var v = GetAssets(item);
                if (v != null)
                {
                    Reports.Add(new BalanceSheetExport {
                        Account = v.LedgerAccountName, Balance = v.Amount.ToString("C")
                    });
                }
            }
            Reports.Add(new BalanceSheetExport {
                TotalHeading = "Total Assets", Total = TotalAssetsBalance.ToString("C")
            });
            Reports.Add(new BalanceSheetExport {
                AccountType = "Liabilities"
            });
            #region foreach
            foreach (var item in groups)
            {
                decimal liabilitiesgroupbalance = 0;


                foreach (var i in LedgerAccounts.Where(a => a.AccountClassId == 4 && a.parentLedgerAccount == item.Key))
                {
                    var v = GetLiabilities(i);
                    if (v != null)
                    {
                        liabilitiesgroupbalance += v.Amount;
                    }
                }
                if (liabilitiesgroupbalance > 0)
                {
                    Reports.Add(new BalanceSheetExport {
                        Account = item.Key.AccountName, Balance = liabilitiesgroupbalance.ToString("C")
                    });

                    // Liabilities.Add(new LiabilitiesVm { LedgerAccountName = item.Key.AccountName, Amount = liabilitiesgroupbalance });
                }
            }
            #endregion
            foreach (var item in accountlistwithoutparentaccount.Where(a => a.AccountClassId == 4))
            {
                var v = GetLiabilities(item);
                if (v != null)
                {
                    //Liabilities.Add(v);
                    Reports.Add(new BalanceSheetExport {
                        Account = v.LedgerAccountName, Balance = v.Amount.ToString("C")
                    });
                }
            }
            Reports.Add(new BalanceSheetExport {
                TotalHeading = "Total Liabilities", Total = TotalLiabilitiesBalance.ToString("C")
            });
            Reports.Add(new BalanceSheetExport {
                AccountType = "Equity"
            });

            #region foreach
            foreach (var item in groups)
            {
                decimal equitygroupbalance = 0;

                foreach (var i in LedgerAccounts.Where(a => a.AccountClassId == 5 && a.parentLedgerAccount == item.Key))
                {
                    var v = GetEquities(i);
                    if (v != null)
                    {
                        equitygroupbalance += v.Amount;
                    }
                }
                if (equitygroupbalance > 0)
                {
                    Reports.Add(new BalanceSheetExport {
                        Account = item.Key.AccountName, Balance = equitygroupbalance.ToString("C")
                    });
                }
            }
            #endregion
            foreach (var item in accountlistwithoutparentaccount.Where(a => a.AccountClassId == 5))
            {
                var v = GetEquities(item);
                if (v != null)
                {
                    //Equities.Add(v);
                    Reports.Add(new BalanceSheetExport {
                        Account = v.LedgerAccountName, Balance = v.Amount.ToString("C")
                    });
                }
            }
            GetIncomeStatement();
            var lande      = TotalEquityBalance + GetNetIncome() + TotalLiabilitiesBalance;
            var totalquity = TotalEquityBalance + GetNetIncome();
            Reports.Add(new BalanceSheetExport {
                Account = "Net Income", Balance = GetNetIncome().ToString("C")
            });
            Reports.Add(new BalanceSheetExport {
                TotalHeading = "Total Equities", Total = totalquity.ToString("C")
            });

            Reports.Add(new BalanceSheetExport {
            });

            Reports.Add(new BalanceSheetExport {
                TotalHeading = "Liabilities And Equity", Total = lande.ToString("C")
            });
        }
Ejemplo n.º 59
0
 public void RemoveReports(DateTime beforeDate)
 {
     Reports.RemoveAll(usage => usage.Date.Date != beforeDate.Date);
 }
Ejemplo n.º 60
0
 public GridResult GetReportData(int reportID, int from, int to, string sortField, bool isDesc, bool useUserFilter)
 {
     return(Reports.GetReportData(TSAuthentication.GetLoginUser(), reportID, from, to, sortField, isDesc, useUserFilter));
 }