Esempio n. 1
0
        public ProcesView(int _CURENT_USER_ID, string conStr, string predefinedFilter)
        {
            NomenclatoareRepository tpr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);

            this.TipuriProcese = (Nomenclator[])tpr.GetAll("tip_procese").Result;
            this.Instante      = (Nomenclator[])tpr.GetAll("instante").Result;
            this.Complete      = (Nomenclator[])tpr.GetAll("complete").Result;
            //ContracteRepository cr = new ContracteRepository(_CURENT_USER_ID, conStr);
            //this.Contracte = (Contract[])cr.GetAll().Result;
            ProceseRepository pr = new ProceseRepository(_CURENT_USER_ID, conStr);

            this.TipDocumenteScanateProcese = (string[])pr.GetTipDocumenteScanatePocese().Result;
            //PartiRepository par = new PartiRepository(_CURENT_USER_ID, conStr);
            //this.Parti = (Parte[])par.GetAll().Result;
            this.Calitati = (Nomenclator[])tpr.GetAll("calitati").Result;
            //Utilizator u = new Utilizator(_CURENT_USER_ID, conStr, _CURENT_USER_ID);
            //this.Societate = (SocietateAsigurare)u.GetSocietatiAsigurare().Result;
            this.Societate = new SocietateAsigurare(_CURENT_USER_ID, conStr, Convert.ToInt32(HttpContext.Current.Session["ID_SOCIETATE"]));
            //this.CurProces = new ProcesExtended(new Proces());
            //this.procesJson = new ProcesJson();
            StadiiRepository sr = new StadiiRepository(_CURENT_USER_ID, conStr);

            this.Stadii = (StadiuCombo[])sr.GetCombo().Result;

            this.Procese           = null;
            this.CurProces         = new ProcesExtended(new Proces());
            this.FilteredRowsCount = 0;
            this.procesJson        = new ProcesJson();

            if (predefinedFilter != "empty")
            {
                try
                {
                    //daca vrem sa aducem din start inregistrari !!!
                    string initFilter = String.Format(" ((PROCESE.ID_DOSAR IS NULL AND (PROCESE.ID_RECLAMANT={0} OR PROCESE.ID_PARAT={0} OR PROCESE.ID_TERT={0})) OR (PROCESE.ID_DOSAR IS NOT NULL AND (DOSARE.ID_SOCIETATE_CASCO={0} OR DOSARE.ID_SOCIETATE_RCA={0}))) ", Convert.ToInt32(HttpContext.Current.Session["ID_SOCIETATE"]));

                    ProceseRepository prep   = new ProceseRepository(_CURENT_USER_ID, conStr);
                    string            filter = String.IsNullOrWhiteSpace(predefinedFilter) ? initFilter : predefinedFilter;
                    string            limit  = String.Format(" LIMIT 0, {0} ", (CommonFunctions.ROWS_BLOCK_SIZE).ToString());

                    /*
                     * this.Procese = (ProcesExtended[])prep.GetFilteredExtended(null, null, filter, limit).Result;
                     * this.CurProces = this.Procese[0];
                     */
                    this.Procese           = (Proces[])prep.GetFiltered(null, null, filter, limit).Result;
                    this.CurProces         = new ProcesExtended(this.Procese[0]);
                    this.FilteredRowsCount = Convert.ToInt32(prep.CountFiltered(null, null, filter, null).Result);
                    this.procesJson        = new ProcesJson();
                }
                catch
                {
                    this.Procese           = null;
                    this.CurProces         = new ProcesExtended(new Proces());
                    this.FilteredRowsCount = 0;
                    this.procesJson        = new ProcesJson();
                }
            }
        }
Esempio n. 2
0
        private static void SincronizareTermenePortal()
        {
            string            conStr = CommonFunctions.StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString(), CommonFunctions.StringCipher.RetrieveKey());
            int               id     = 1;
            ProceseRepository pr     = new ProceseRepository(id, conStr);

            Proces[] procese = (Proces[])pr.GetFiltered(null, null, " PROCESE.NR_DOSAR_INSTANTA LIKE '%/%' ", null).Result;
            List <SOCISA.Models.SedintaPortal> lst = new List <SedintaPortal>();
            QuerySoapClient ws = new QuerySoapClient();

            for (int i = 0; i < procese.Length; i++)
            {
                try
                {
                    int    id_dosar  = Convert.ToInt32(procese[i].ID_DOSAR);
                    Dosar  d         = new Dosar(id, conStr, id_dosar);
                    int    id_proces = Convert.ToInt32(procese[i].ID);
                    string nr_dosar  = procese[i].NR_DOSAR_INSTANTA;

                    socisaV2.PortalWS.Dosar dosar = ws.CautareDosare2(nr_dosar, null, null, null, null, null, null, null)[0];
                    for (int j = 0; j < dosar.sedinte.Length; j++)
                    {
                        bool gasit = false;
                        for (int k = 0; k <= 7; k++)
                        {
                            if (dosar.sedinte[j].data.Date == DateTime.Now.Date.AddDays(k).Date)
                            {
                                SedintaPortal dsp = new SedintaPortal(id, conStr);
                                dsp.ID_DOSAR = id_dosar;
                                try
                                {
                                    dsp.NR_DOSAR_CASCO = d.NR_DOSAR_CASCO;
                                }
                                catch { }
                                dsp.ID_PROCES         = id_proces;
                                dsp.NR_DOSAR_INSTANTA = procese[i].NR_DOSAR_INSTANTA;
                                dsp.DATA         = DateTime.Now.Date;
                                dsp.DATA_SEDINTA = dosar.sedinte[j].data;
                                dsp.INSTANTA     = dosar.institutie.ToString();
                                dsp.COMPLET      = dosar.sedinte[j].complet;
                                dsp.ORA          = dosar.sedinte[j].ora;
                                dsp.MONITORIZARE = true;
                                dsp.Insert();
                                gasit = true;
                                break;
                            }
                        }
                        if (gasit)
                        {
                            break;
                        }
                    }
                }
                catch (Exception exp) { exp.ToString(); }
            }
        }
Esempio n. 3
0
        public response GetFiltered(JToken jProces, JToken jprocesJson)
        {
            string            conStr          = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int               _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]);
            ProceseRepository pr = new ProceseRepository(_CURENT_USER_ID, conStr);

            string limit = null;

            if (jprocesJson != null)
            {
                if (jprocesJson["LimitStart"] != null && !String.IsNullOrEmpty(jprocesJson["LimitStart"].ToString()) && jprocesJson["LimitEnd"] != null && !String.IsNullOrEmpty(jprocesJson["LimitEnd"].ToString()))
                {
                    limit = String.Format(" LIMIT {0},{1} ", jprocesJson["LimitStart"].ToString(), jprocesJson["LimitEnd"].ToString());
                }
            }
            //response r = dr.GetFiltered(null, null, String.Format("{'jProces':{0},'jprocesJson':{1}}", JsonConvert.SerializeObject(jProces), JsonConvert.SerializeObject(jprocesJson)), null);
            string jsonParam = CreateFilterString(jProces, jprocesJson);
            //response r = pr.GetFilteredExtended(null, null, jsonParam, limit);
            response r = pr.GetFiltered(null, null, jsonParam, limit);

            r.InsertedId = Convert.ToInt32(pr.CountFiltered(null, null, jsonParam, null).Result); // folosim campul InsertedId pt. counter
            return(r);
        }
Esempio n. 4
0
        public void ExportProceseToExcel(string _sort, string _order, string _filter, string _limit)
        {
            try
            {
                JObject  jObj       = (JObject)JsonConvert.DeserializeObject(_filter);
                string   filterName = jObj["filterName"].ToString();
                string   filterKey  = jObj["filterKey"].ToString();
                object[] args       = JsonConvert.DeserializeObject <object[]>(jObj["args"].ToString());
                _filter = PredefinedFilters.CreateFilter(filterName, filterKey, args);
            }
            catch { }


            string conStr          = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]);

            ProceseRepository pr = new ProceseRepository(_CURENT_USER_ID, conStr);

            Proces[] procese = (Proces[])pr.GetFiltered(_sort, _order, _filter, _limit).Result;

            DataTable table = (DataTable)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(procese, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
            {
                DateTimeFormat = SOCISA.CommonFunctions.DATE_FORMAT
            }), (typeof(DataTable)));
            List <string> columns_to_remove = new List <string>();

            foreach (DataColumn dc in table.Columns)
            {
                if (dc.ColumnName.ToLower().IndexOf("id") > -1)
                {
                    columns_to_remove.Add(dc.ColumnName);
                }
            }
            foreach (string col_name in columns_to_remove)
            {
                table.Columns.Remove(col_name);
            }
            // TO DO: add external fields !!!

            /*
             * DataColumn newdc = new DataColumn("ASIGURAT_CASCO", Type.GetType("System.String"));
             * table.Columns.Add(newdc);
             * newdc = new DataColumn("ASIGURATOR_RCA", Type.GetType("System.String"));
             * table.Columns.Add(newdc);
             * table.AcceptChanges();
             *
             * foreach (DataRow drow in table.Rows)
             * {
             *  try
             *  {
             *      Dosar dosar = new Dosar(_CURENT_USER_ID, conStr, Convert.ToInt32(drow["ID"]));
             *      Asigurat aCasco = (Asigurat)dosar.GetAsiguratCasco().Result;
             *      drow["ASIGURAT_CASCO"] = aCasco.DENUMIRE;
             *      SocietateAsigurare sRca = (SocietateAsigurare)dosar.GetSocietateRca().Result;
             *      drow["ASIGURATOR_RCA"] = sRca.DENUMIRE;
             *  }
             *  catch (Exception exp) { LogWriter.Log(exp); }
             * }
             */
            table.AcceptChanges();
            using (ExcelPackage pack = new ExcelPackage())
            {
                ExcelWorksheet ws = pack.Workbook.Worksheets.Add("Procese");
                ws.Cells["A1"].LoadFromDataTable(table, true);
                var ms = new System.IO.MemoryStream();
                pack.SaveAs(ms);
                Response.BinaryWrite(ms.GetBuffer());
            }
        }