Example #1
0
        private void WorkerMethodRptProdMedCon(object sender, WaitWindowEventArgs e)
        {
            string path = Application.StartupPath;

            path = path.Replace("\\", "/");
            path = path.Replace("/bin/Debug", "");

            path = path + "/Dominio/Reportes/rptProdMedCon.rpt";

            rpt.Load(path);

            int    count = 0;
            string sql   = "SELECT X.año, X.mes, X.fecha_atencion, X.medico, X.consultorio, SUM(X.ccon) AS cantidad, SUM(X.tcon) AS total, X.turno, X.cturno, X.horas, X.colegiatura, X.sueldo from (" + this.vSQL + ") X WHERE ccon>0 GROUP BY X.año, X.mes, X.fecha_atencion, X.medico, X.consultorio, X.turno, X.cturno, X.horas, X.colegiatura, X.sueldo";

            sql = "SELECT Y.año, Y.mes, Y.fecha_atencion, Y.medico, Y.consultorio, SUM(Y.cantidad) AS cantidad, SUM(Y.total) AS total, Y.turno, Y.cturno, Y.horas, Y.colegiatura, SUM(Y.sueldo * Y.cturno) AS sueldo from (" + sql + ") Y GROUP BY Y.año, Y.mes, Y.fecha_atencion, Y.medico, Y.consultorio, Y.turno, Y.cturno, Y.horas, Y.colegiatura ORDER BY 4, 3, 8";
            Conexion.CMD.CommandText = sql;
            using (SqlDataAdapter da = new SqlDataAdapter(Conexion.CMD))
            {
                using (ReportsDS ds = new ReportsDS())
                {
                    ds.Clear();
                    da.Fill(ds, "ProdMed");
                    count = ds.Tables["ProdMed"].Rows.Count;
                    rpt.SetDataSource(ds);
                }
            }

            rpt.SetParameterValue("periodo", this.periodo);
            rpt.SetParameterValue("subtitle", this.subtitle);

            e.Result = count.ToString();
        }
Example #2
0
        private void WorkerMethodRptPagEsp(object sender, WaitWindowEventArgs e)
        {
            string path = Application.StartupPath;

            path = path.Replace("\\", "/");
            path = path.Replace("/bin/Debug", "");

            path = path + "/Dominio/Reportes/rptPagEsp.rpt";

            rpt.Load(path);

            int count = 0;

            Conexion.CMD.CommandText = this.vSQL;
            using (SqlDataAdapter da = new SqlDataAdapter(Conexion.CMD))
            {
                using (ReportsDS ds = new ReportsDS())
                {
                    ds.Clear();
                    da.Fill(ds, "PagEsp");
                    count = ds.Tables["PagEsp"].Rows.Count;
                    rpt.SetDataSource(ds);
                }
            }

            rpt.SetParameterValue("periodo", this.periodo);
            rpt.SetParameterValue("subtitle", this.subtitle);

            e.Result = count.ToString();
        }
Example #3
0
        private void PlayWorker(object sender, WaitWindowEventArgs e)
        {
            if (_mPlayer.Playing)
            {
                return;
            }

            if (Methods.RemoteFileExists(StreamingContent.StreamInformation.Links.View))
            {
                //file/URI to play
                var fileName = (string)e.Arguments[0];

                //GUI and worker methods
                StartPlayer(fileName);
                SetIconPause();

                //tooltip set
                tipMain.SetToolTip(btnPlayPause, @"Pause Playback");

                //stop button enable
                btnStop.Enabled = true;
            }
            else
            {
                UIMessages.Error(
                    @"Couldn't load the stream because the remote file doesn't exist or returned an error",
                    @"Network Error");
            }
        }
Example #4
0
        private void LoadCase(object sender, WaitWindowEventArgs e)
        {
            string        password  = e.Arguments[0].ToString();
            DirectoryInfo parentDir = Directory.GetParent(file.FullName);

            using (ZipFile zip = ZipFile.Read(file.FullName))
            {
                zip.Password = password;
                zip.ExtractAll(parentDir.FullName, ExtractExistingFileAction.OverwriteSilently);
            }

            try
            {
                File.Delete(file.FullName);
            }
            catch (IOException io)
            {
                MessageBox.Show($"Unable to delete: {io}");
            }

            Constants.CasePath          = parentDir.FullName;
            Constants.CaseContainerName = Path.GetFileName(file.FullName.Replace(Constants.ContainerExtension, ""));

            if (password != "")
            {
                e.Window.Message = "Re-encrypting password... Please Wait";
                string hash = SecurePasswordHasher.Hash(password);
                UpdateCaseTableWithPassword(hash);
            }

            if (!isReport)
            {
                Logger.Log(new OsirtActionsLog(Actions.CaseLoaded, uiFileHashTextBox.Text, Constants.CaseContainerName));
            }
        }
Example #5
0
        private void GetScreenshot(object sender, WaitWindowEventArgs e)
        {
            DirectoryInfo directory = new DirectoryInfo(Constants.CacheLocation);

            FileSystemInfo[] files = directory.GetFileSystemInfos();
            ScreenshotHelper.CombineScreenshot(files, e);
        }
Example #6
0
        private void DownloadWorker(object sender, WaitWindowEventArgs e)
        {
            var dir = $@"update_files\{UpdateData.id}";
            var dl  = new List <HttpDownloader>();

            foreach (var a in UpdateData.assets)
            {
                var dirA = $@"{dir}\{a.id}";
                if (!Directory.Exists(dirA))
                {
                    Directory.CreateDirectory(dirA);
                }
                var uri  = a.browser_download_url;
                var file = $@"{dirA}\{a.name}";

                //only download it if the file doesn't already exist
                if (File.Exists(file))
                {
                    continue;
                }

                var engine = new HttpDownloader(uri, file);
                dl.Add(engine);
                dl[dl.IndexOf(engine)].StartAsync();
            }

            e.Result = dir;
        }
Example #7
0
        private void WorkerMethodRpt(object sender, WaitWindowEventArgs e)
        {
            string path = Application.StartupPath;

            path = path.Replace("\\", "/");
            path = path.Replace("/bin/Debug", "");

            path = path + "/Dominio/Reportes/rptTotVenEsp.rpt";

            rpt.Load(path);

            Conexion.CMD.CommandText = this.sqlVenCons;

            using (SqlDataAdapter da = new SqlDataAdapter(Conexion.CMD))
            {
                using (ReportsDS ds = new ReportsDS())
                {
                    ds.Clear();
                    da.Fill(ds, "VenCons");
                    rpt.SetDataSource(ds);
                }
            }

            e.Result = true;
        }
Example #8
0
 private static void LoadPxz(object sender, WaitWindowEventArgs e)
 {
     if (e.Arguments.Count == 1)
     {
         e.Result = LoadPxz((string)e.Arguments[0], false);
     }
 }
        private void XuatBBGioKoDungQuyDinh_Va_DiTreVesom(object sender, WaitWindowEventArgs e)
        {
            string saveFileName = (string)e.Arguments[0];

            using (var p = new ExcelPackage()) {
                //2. xuat bb bang ChiTietVaoTreRaSom

                #region ghi sheet bang ChiTietVaoTreRaSom

                p.Workbook.Worksheets.Add("ChiTietVaoTreRaSom");
                var ws = p.Workbook.Worksheets["ChiTietVaoTreRaSom"];
                ws.Name = "ChiTietVaoTreRaSom";                 //Setting Sheet's name
                XL.ExportSheetTreSom(ws, m_dsnv);
                #endregion

                #region ghi sheet bang ChiTietVaoTreRaSom

                p.Workbook.Worksheets.Add("ThieuChamCong_KhongNhanDienCa");
                ws      = p.Workbook.Worksheets["ThieuChamCong_KhongNhanDienCa"];
                ws.Name = "ThieuChamCong_KhongNhanDienCa";                 //Setting Sheet's name
                XL.ExportSheetThieuChamCong_KhongHieuCa(ws, m_dsnv);
                #endregion
                Byte[] bytes = p.GetAsByteArray();
                XL.XuatFileExcel(saveFileName, bytes, "frmXuatBBCongPC_XuatBBGioKoDungQuyDinh_Va_DiTreVesom");
            }
        }
Example #10
0
        private void WorkerMethodRpt(object sender, WaitWindowEventArgs e)
        {
            string path = Application.StartupPath;

            path = path.Replace("\\", "/");
            path = path.Replace("/bin/Debug", "");

            path = path + "/Dominio/Reportes/rptTotUser.rpt";

            rpt.Load(path);

            Conexion.CMD.CommandText = this.vSQL;
            int count = 0;

            using (SqlDataAdapter da = new SqlDataAdapter(Conexion.CMD))
            {
                using (ReportsDS ds = new ReportsDS())
                {
                    ds.Clear();
                    da.Fill(ds, "TotUser");
                    count = ds.Tables["TotUser"].Rows.Count;

                    foreach (DataRow row in ds.Tables["TotUser"].Rows)
                    {
                        row["Digitador"] = General.TradUser(row["Digitador"].ToString());
                    }
                    rpt.SetDataSource(ds);
                }
            }

            e.Result = count.ToString();
        }
Example #11
0
        private void WorkerMethodRpt(object sender, WaitWindowEventArgs e)
        {
            string path = Application.StartupPath;

            path = path.Replace("\\", "/");
            path = path.Replace("/bin/Debug", "");

            path = path + "/Dominio/Reportes/rptFrecEnf.rpt";

            rpt.Load(path);

            Conexion.CMD.CommandText = this.sql;

            using (SqlDataAdapter da = new SqlDataAdapter(Conexion.CMD))
            {
                using (ReportsDS ds = new ReportsDS())
                {
                    ds.Clear();
                    da.Fill(ds, 0, int.Parse(spinner1.Value.ToString()), "FrecEnf");
                    rpt.SetDataSource(ds);
                }
            }

            //rpt.SetParameterValue("consul", e.Arguments[0].ToString());
            //rpt.SetParameterValue("fi", e.Arguments[1].ToString());
            //rpt.SetParameterValue("ff", e.Arguments[2].ToString());
            rpt.SetParameterValue("texto", this.texto);

            e.Result = true;
        }
Example #12
0
        private void WorkerMethod(object sender, WaitWindowEventArgs e)
        {
            try
            {
                //debe pasar un datareader para usar la funcion
                Conexion.CMD.CommandText = vSQL + " ORDER BY 5, 2";

                using (SqlDataAdapter da = new SqlDataAdapter(Conexion.CMD))
                {
                    dt.Clear();
                    da.Fill(dt);
                    da.Dispose();
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (e.Arguments.Count > 0)
            {
                e.Result = e.Arguments[0].ToString();
            }
            else
            {
                e.Result = "Proceso culminado.";
            }
        }
Example #13
0
 /// <summary>
 /// Multi-threaded code; this is automatic do not hook or call.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GetUpdateInfo(object sender, WaitWindowEventArgs e)
 {
     if (e.Arguments.Count == 1)
     {
         var resource = (string)e.Arguments[0];
         e.Result = GetUpdateInfo(resource, false);
     }
 }
Example #14
0
 private static void LoadMetadataArchive(object sender, WaitWindowEventArgs e)
 {
     if (e.Arguments.Count > 0)
     {
         var fileName = (string)e.Arguments[0];
         e.Result = LoadMetadataArchive(fileName, false);
     }
 }
Example #15
0
 private static void GetPoster(object sender, WaitWindowEventArgs e)
 {
     if (e.Arguments.Count == 1)
     {
         var c = (PlexObject)e.Arguments[0];
         e.Result = GetPoster(c, false);
     }
 }
Example #16
0
 private static void CommitDefaultSettings(object sender, WaitWindowEventArgs e)
 {
     if (e.Arguments.Count == 1)
     {
         var settings = (ApplicationOptions)e.Arguments[0];
         e.Result = settings.CommitDefaultSettings(false);
     }
 }
Example #17
0
        private void WorkerMethod(object sender, WaitWindowEventArgs e)
        {
            bool flag = IsUpdate();

            if (e.Arguments.Count > 0)
            {
                e.Result = flag.ToString().ToLower() == "true" ? "true" : "false";
            }
        }
Example #18
0
 public static void MetadataFromFile(object sender, WaitWindowEventArgs e)
 {
     if (e.Arguments.Count > 1)
     {
         var file   = (PxzFile)e.Arguments[0];
         var silent = (bool)e.Arguments[1];
         e.Result = MetadataFromFile(file, false, silent);
     }
 }
Example #19
0
        private object DoWork()
        {
            // Invoke the worker method and return the result.
            var e = new WaitWindowEventArgs(_parent, _parent.Args);

            _parent.WorkerMethod?.Invoke(this, e);

            // Return the worker result
            return(e.Result);
        }
Example #20
0
        private void RenderServersView(object sender, WaitWindowEventArgs e)
        {
            if (e.Arguments.Count == 2)
            {
                var servers           = (List <Server>)e.Arguments[0];
                var renderTokenColumn = (bool)e.Arguments[1];

                ServerViewRenderer.RenderView(servers, renderTokenColumn, dgvServers);
            }
        }
        public void XuLyXemCong(object sender, WaitWindowEventArgs e)
        {
            List <cUserInfo> listNV       = (List <cUserInfo>)e.Arguments[0];
            DateTime         ngayBD_Bef2D = (DateTime)e.Arguments[1];
            DateTime         ngayKT_Aft2D = (DateTime)e.Arguments[2];

            XL.XemCongThoiGianChuaKetLuong(listNV, ngayBD_Bef2D, ngayKT_Aft2D);
            XL.TaoTableXemCong(listNV, m_Bang_TongHopXemCong);

            //Reload4DataGrid(listNV);
        }
Example #22
0
        public static void GetSearchEnum(object sender, WaitWindowEventArgs e)
        {
            var table      = (DataTable)e.Arguments[3];
            var column     = (string)e.Arguments[2];
            var searchRule = (SearchRule)e.Arguments[1];
            var searchKey  = (string)e.Arguments[0];
            //UIMessages.Info(SearchQuery.SqlSearchFromRule(column, searchKey, searchRule));
            var rowCollection = table.Select(SearchQuery.SqlSearchFromRule(column, searchKey, searchRule));

            e.Result = rowCollection;
        }
Example #23
0
        private void CreatePDF(object sender, WaitWindowEventArgs e)
        {
            //TODO: When audit log is exported and case notes are then exported (or vice-verca) as PDF, the application hangs...
            string path = e.Arguments[0].ToString();
            string html = CaseNotesToHtml.CreateHtml();

            HtmLtoPdf.SaveHtmltoPdf(html, "", "Case Notes", path);
            string hash = OsirtHelper.GetFileHash(path);

            Logger.Log(new OsirtActionsLog(Enums.Actions.CaseNotes, hash, System.IO.Path.GetFileName(path)));
        }
Example #24
0
        internal object DoWork()
        {
            WaitWindowEventArgs e = new WaitWindowEventArgs(this._Parent, this._Parent._Args);

            if ((this._Parent._WorkerMethod != null))
            {
                this._Parent._WorkerMethod(this, e);
            }

            return(e.Result);
        }
Example #25
0
        private void LoadTor(object sender, WaitWindowEventArgs e)
        {
            Thread.Sleep(5000); //give a chance for the tor process to load

            ClientRemoteParams remoteParams = new ClientRemoteParams();

            remoteParams.Address         = "127.0.0.1";
            remoteParams.ControlPassword = "";
            remoteParams.ControlPort     = 9050;

            Client client = Client.CreateForRemote(remoteParams);

            client.Status.BandwidthChanged += Status_BandwidthChanged;
        }
Example #26
0
        private void ActorsWorker(object sender, WaitWindowEventArgs e)
        {
            //Clear all previous actors (maybe there's a dud panel in place?)
            if (flpActors.Controls.Count > 0)
            {
                if (flpActors.InvokeRequired)
                {
                    flpActors.BeginInvoke((MethodInvoker) delegate
                    {
                        flpActors.Controls.Clear();
                    });
                }
                else
                {
                    flpActors.Controls.Clear();
                }
            }

            if (StreamingContent.Actors.Count > 0)
            {
                //start filling the actors panel from the real data
                foreach (var a in StreamingContent.Actors)
                {
                    //actor panel
                    var p = ActorPanel(a);

                    //add it to the form
                    if (flpActors.InvokeRequired)
                    {
                        flpActors.BeginInvoke((MethodInvoker) delegate { flpActors.Controls.Add(p); });
                    }
                    else
                    {
                        flpActors.Controls.Add(p);
                    }
                }
            }
            else
            {
                //no actors, so tell the user with a dud panel
                if (flpActors.InvokeRequired)
                {
                    flpActors.BeginInvoke((MethodInvoker) delegate { flpActors.Controls.Add(NoActorsFound()); });
                }
                else
                {
                    flpActors.Controls.Add(NoActorsFound());
                }
            }
        }
        private void SaveAsOther(object sender, WaitWindowEventArgs e)
        {
            //string fileName = e.Arguments[0].ToString();

            ImageSaveOptions options  = (ImageSaveOptions)e.Arguments[0];
            string           fileName = options.FileName;
            string           fileType = options.FileType;
            MagickFormat     format   = options.ImageFormat;

            pathToSave = "";
            bool thrown = false;

            try
            {
                using (MagickImage image = new MagickImage(filePath /*, settings*/))
                {
                    image.Format = format;

                    //uncomment this to get annotation
                    //image.Annotate(Url + "\n" + DateAndTime, Gravity.Southwest);

                    pathToSave = Path.Combine(Constants.ContainerLocation, Constants.Directories.GetSpecifiedCaseDirectory(action), fileName + fileType);
                    image.Write(pathToSave);
                    e.Window.Message = $"Rehashing {fileType}";
                    Hash             = OsirtHelper.GetFileHash(pathToSave);
                    successful       = true;
                }
            }
            catch (Exception ex) when(ex is MagickErrorException || ex is System.Runtime.InteropServices.SEHException || ex is ArgumentException || ex is System.Reflection.TargetInvocationException /*|| ex is System.AccessViolationException || ex is Exception*/)
            {
                thrown = true;
                var message = $"Unable to save as {fileType}. Reverting to saving as PNG.";

                Invoke((MethodInvoker)(() => uiFileExtensionComboBox.SelectedIndex = uiFileExtensionComboBox.Items.IndexOf(SaveableFileTypes.Png)));
                e.Window.Message = message;
                Task.Delay(2000).Wait(); //just so the user can see we're saving as PNG instead
                SaveAsPng(fileName);
            }
            finally
            {
                //delete temp pdf file
                if (thrown)
                {
                    if (File.Exists(pathToSave))
                    {
                        File.Delete(pathToSave);
                    }
                }
            }
        }
Example #28
0
        private void WorkerMethodRPT(object sender, WaitWindowEventArgs e)
        {
            this.cn_ = this.rs = "";

            List <Dictionary <string, string> > xx    = General.GetDictionaryList(grdProductos);
            List <Dictionary <string, string> > items = xx.FindAll(x => x["dNroHistoria"] == this.nh && x["dM"] == "True");

            foreach (Dictionary <string, string> item in items)
            {
                this.rs  += (rs.Length > 0 ? "\n" : "") + item["dResultado"];
                this.cn_ += (cn_.Length > 0 ? "\n" : "") + item["dConclusion"];
                this.er  += (rs.Length + cn_.Length > 0 ? item["dDescripcion"] + ", " : "");
            }

            string result = this.rs + "\n" + (this.cn_.Length > 0? "CONCLUSION:\n" + this.cn_: "");

            er = er.Length > 0 ? General.SafeSubstring(er, 0, er.Length - 1) : "";

            //define la ruta por defecto de la app
            string path = Application.StartupPath;

            path = path.Replace("\\", "/");
            path = path.Replace("/bin/Debug", "");

            //define el reporte dependiendo del tipo de seleccion
            path = path + "/Dominio/Reportes/rptResultado.rpt";

            //carga el reporte
            rpt.Load(path);

            //setea los parametros del reporte Parte de atencion diario
            rpt.SetParameterValue("Operativo", Operativo.descripcion);
            rpt.SetParameterValue("Especialidad", this.especialidad);
            rpt.SetParameterValue("docVenta", this.docVenta);
            rpt.SetParameterValue("Paciente", this.paciente + "(" + this.edad + " AÑOS)");
            rpt.SetParameterValue("Examen", this.especialidad + " " + this.er);
            rpt.SetParameterValue("Especialista", this.medico);
            rpt.SetParameterValue("Fecha", this.fechaAtencion);
            rpt.SetParameterValue("resultados", result);

            if (e.Arguments.Count > 0)
            {
                e.Result = e.Arguments[0].ToString();
            }
            else
            {
                e.Result = "Proceso culminado.";
            }
        }
Example #29
0
        private static void RenderWithStruct(object sender, WaitWindowEventArgs e)
        {
            //there must always be a correct argument count
            if (e.Arguments.Count == 2)
            {
                //GUI grid that will be re-rendered
                var gridToRender = (DataGridView)e.Arguments[0];

                //the information used to dictate how the GUI grid will be re-rendered
                var renderInfo = (GenericRenderStruct)e.Arguments[1];

                //the result is a returned filtered view table
                e.Result = GenericViewRenderer.RenderView(renderInfo, gridToRender);
            }
        }
Example #30
0
        private void CopyPageSaveToCase(string folder, WaitWindowEventArgs e)
        {
            using (ZipFile zip = new ZipFile())
            {
                zip.AddDirectory(folder);
                zip.Save(folder + ".zip");
                e.Window.Message = "Zipping...Please Wait";
            }

            string copyTo = Path.Combine(Constants.ContainerLocation, Constants.Directories.GetSpecifiedCaseDirectory(Enums.Actions.Download), Path.GetFileNameWithoutExtension(folder) + ".zip");

            File.Copy(folder + ".zip", copyTo);
            e.Window.Message = "Logging...Please Wait";
            Logger.Log(new WebpageActionsLog(uiTabbedBrowserControl.CurrentTab.Browser.URL, Enums.Actions.Download, OsirtHelper.GetFileHash(copyTo), Path.GetFileNameWithoutExtension(folder) + ".zip", "Webpage downloaded"));
            Thread.Sleep(2000);
            File.Delete(folder + ".zip");
            ImageDiskCache.RemoveItemsInCache();
        }
 private void CollectorMethod(object sender, WaitWindowEventArgs e)
 {
     //заблокировать родительское поле
    
     //ПРОБЛЕМА!!!!                
     CommandUsageMode mode = CommandUsageMode.TaskParallelUsage;
     //mode = CommandUsageMode.TaskParallelUsage;
     CommandUsage.CommandUsage comm = new CommandUsage.CommandUsage(_taskId, mode);
     //подписываемся на событие о, том что задачи завершены
     comm.taskCompleted += this.UnlockApplicationAfterComplete;
     //вызываем задачу
     comm.Dispatcher();
     //запускаем ожидание пока не выполняться все задачи
     waitHandle.Wait();
 }