Example #1
0
        public ImportDosarView(int CURENT_USER_ID, string conStr)
        {
            DosareRepository dr = new DosareRepository(CURENT_USER_ID, conStr);

            ImportDates = ((List <string>)dr.GetImportDates().Result).ToArray();
            SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(CURENT_USER_ID, conStr);

            this.SocietatiRCA = (SocietateAsigurare[])sar.GetAll().Result;
        }
Example #2
0
        public JsonResult GetNewMessages(string j, int?_START_LIMIT, int?_END_LIMIT)
        {
            dynamic x      = JsonConvert.DeserializeObject(j);
            string  conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int     uid    = Convert.ToInt32(Session["CURENT_USER_ID"]);

            if (x.id_dosar != null)
            {
                DosareRepository dr = new DosareRepository(uid, conStr);
                Dosar            d  = (Dosar)dr.Find(Convert.ToInt32(x.id_dosar)).Result;
                //return Json(d.GetNewMesaje(Convert.ToDateTime(x.last_refresh)), JsonRequestBehavior.AllowGet);
                return(Json(d.GetNewMesaje(DateTime.ParseExact(Convert.ToString(x.last_refresh), CommonFunctions.DATE_TIME_FORMAT, System.Globalization.CultureInfo.InvariantCulture)), JsonRequestBehavior.AllowGet));
            }
            else
            {
                Utilizator u = (Utilizator)Session["CURENT_USER"];
                return(Json(u.GetNewMesaje(DateTime.ParseExact(Convert.ToString(x.last_refresh), CommonFunctions.DATE_TIME_FORMAT, System.Globalization.CultureInfo.InvariantCulture), _START_LIMIT, _END_LIMIT), JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
        public static void CallDocumente()
        {
            response         r               = new response();
            string           conStr          = CommonFunctions.StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString(), CommonFunctions.StringCipher.RetrieveKey());
            int              _CURENT_USER_ID = 1;
            DosareRepository dr              = new DosareRepository(_CURENT_USER_ID, conStr);

            SOCISA.Models.Dosar[] ds = (SOCISA.Models.Dosar[])dr.GetAll().Result;
            foreach (SOCISA.Models.Dosar d in ds)
            {
                try
                {
                    ProcessDirectory(Cale, d);
                }
                catch (Exception exp)
                {
                    LogWriter.Log(exp);
                }
            }
        }
Example #4
0
        public DosarView(int _CURENT_USER_ID, int _ID_SOCIETATE, Dosar dosar, string conStr)
        {
            if (HttpContext.Current.Session["TOKEN"] == null) // nu e request din link email notificare
            {
                this.Dosar     = dosar;
                this.dosarJson = new DosarJson(_CURENT_USER_ID, _ID_SOCIETATE, conStr);
                SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(_CURENT_USER_ID, conStr);
                //this.SocietatiCASCO = this.SocietatiRCA = (SocietateAsigurare[])sar.GetAll().Result;
                this.SocietatiAsigurare = (SocietateAsigurare[])sar.GetAll().Result;
                NomenclatoareRepository nr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);
                this.TipuriCaz    = (Nomenclator[])nr.GetAll("tip_caz").Result;
                this.TipuriDosar  = (Nomenclator[])nr.GetAll("tip_dosare").Result;
                this.StatusDosare = SOCISA.CommonFunctions.STATUS_DOSARE;

                //daca vrem sa aducem din start inregistrari !!!
                DosareRepository dr     = new DosareRepository(_CURENT_USER_ID, conStr);
                string           filter = String.Format(" DOSARE.ID_SOCIETATE_CASCO = {0} ", HttpContext.Current.Session["ID_SOCIETATE"]);
                string           limit  = String.Format(" LIMIT 0, {0} ", (SOCISA.CommonFunctions.ROWS_BLOCK_SIZE).ToString());
                this.DosareResult      = (Dosar[])dr.GetFiltered(null, null, filter, limit).Result;
                this.FilteredRowsCount = Convert.ToInt32(dr.CountFiltered(null, null, filter, null).Result);
            }
            else // request din link email notificare - doar un dosar
            {
                SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(_CURENT_USER_ID, conStr);
                //this.SocietatiCASCO = this.SocietatiRCA = (SocietateAsigurare[])sar.GetAll().Result;
                this.SocietatiAsigurare = (SocietateAsigurare[])sar.GetAll().Result;
                NomenclatoareRepository nr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);
                this.TipuriCaz    = (Nomenclator[])nr.GetAll("tip_caz").Result;
                this.TipuriDosar  = (Nomenclator[])nr.GetAll("tip_dosare").Result;
                this.StatusDosare = SOCISA.CommonFunctions.STATUS_DOSARE;

                this.Dosar             = dosar;
                DosareResult           = new Dosar[] { dosar };
                this.dosarJson         = new DosarJson(_CURENT_USER_ID, _ID_SOCIETATE, conStr);
                this.FilteredRowsCount = 1;
            }
        }
Example #5
0
 public DosarView(int _CURENT_USER_ID, int _ID_SOCIETATE, string conStr, string predefinedFilter)
 {
     if (HttpContext.Current.Session["TOKEN"] == null) // nu e request din link email notificare
     {
         SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(_CURENT_USER_ID, conStr);
         //this.SocietatiCASCO = this.SocietatiRCA = (SocietateAsigurare[])sar.GetAll().Result;
         this.SocietatiAsigurare = (SocietateAsigurare[])sar.GetAll().Result;
         NomenclatoareRepository nr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);
         this.TipuriCaz    = (Nomenclator[])nr.GetAll("tip_caz").Result;
         this.TipuriDosar  = (Nomenclator[])nr.GetAll("tip_dosare").Result;
         this.StatusDosare = SOCISA.CommonFunctions.STATUS_DOSARE;
         try
         {
             //daca vrem sa aducem din start inregistrari !!!
             DosareRepository dr = new DosareRepository(_CURENT_USER_ID, conStr);
             //string filter = String.Format(" DOSARE.ID_SOCIETATE_CASCO = {0} ", HttpContext.Current.Session["ID_SOCIETATE"]);
             string filter = String.IsNullOrWhiteSpace(predefinedFilter) ? String.Format(" DOSARE.ID_SOCIETATE_CASCO = {0} ", HttpContext.Current.Session["ID_SOCIETATE"]) : predefinedFilter;
             string limit  = String.Format(" LIMIT 0, {0} ", (SOCISA.CommonFunctions.ROWS_BLOCK_SIZE).ToString());
             this.DosareResult      = (Dosar[])dr.GetFiltered(null, null, filter, limit).Result;
             this.Dosar             = DosareResult[0];
             this.dosarJson         = new DosarJson(_CURENT_USER_ID, _ID_SOCIETATE, conStr);
             this.FilteredRowsCount = Convert.ToInt32(dr.CountFiltered(null, null, filter, null).Result);
         }
         catch
         {
             this.DosareResult        = null;
             this.Dosar               = new Dosar();
             Dosar.ID_SOCIETATE_CASCO = Convert.ToInt32(HttpContext.Current.Session["ID_SOCIETATE"]);
             this.dosarJson           = new DosarJson();
             this.FilteredRowsCount   = 0;
         }
     }
     else // request din link email notificare - doar un dosar
     {
         SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(_CURENT_USER_ID, conStr);
         //this.SocietatiCASCO = this.SocietatiRCA = (SocietateAsigurare[])sar.GetAll().Result;
         this.SocietatiAsigurare = (SocietateAsigurare[])sar.GetAll().Result;
         NomenclatoareRepository nr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);
         this.TipuriCaz    = (Nomenclator[])nr.GetAll("tip_caz").Result;
         this.TipuriDosar  = (Nomenclator[])nr.GetAll("tip_dosare").Result;
         this.StatusDosare = SOCISA.CommonFunctions.STATUS_DOSARE;
         try
         {
             string token    = HttpContext.Current.Session["TOKEN"].ToString();
             int    id_dosar = Convert.ToInt32(token.Substring(token.LastIndexOf('|') + 1));
             Dosar  d        = new Dosar(_CURENT_USER_ID, conStr, id_dosar);
             DosareResult           = new Dosar[] { d };
             Dosar                  = d;
             this.dosarJson         = new DosarJson(_CURENT_USER_ID, _ID_SOCIETATE, conStr);
             this.FilteredRowsCount = 1;
         }
         catch
         {
             DosareResult             = null;
             Dosar                    = new Dosar();
             Dosar.ID_SOCIETATE_CASCO = Convert.ToInt32(HttpContext.Current.Session["ID_SOCIETATE"]);
             dosarJson                = new DosarJson();
             FilteredRowsCount        = 0;
         }
     }
 }
Example #6
0
        public DocumentView(int _CURENT_USER_ID, int _ID_DOSAR, string conStr)
        {
            this.ID_DOSAR = _ID_DOSAR;
            TipDocumenteRepository tdr = new TipDocumenteRepository(_CURENT_USER_ID, conStr);

            //this.TipuriDocumente = (TipDocument[])tdr.GetAll().Result;
            TipDocument[]    tipuriDocumente = (TipDocument[])tdr.GetAll().Result;
            DosareRepository dr = new DosareRepository(_CURENT_USER_ID, conStr);
            Dosar            d  = (Dosar)dr.Find(_ID_DOSAR).Result;

            //this.DocumenteScanate = (DocumentScanat[])d.GetDocumente().Result;
            DocumentScanat[] dss = (DocumentScanat[])d.GetDocumente().Result;

            /*
             * List<TipDocumentJson> l = new List<TipDocumentJson>();
             * foreach (TipDocument td in tipuriDocumente)
             * {
             *  List<DocumentScanat> ld = new List<DocumentScanat>();
             *  foreach(DocumentScanat ds in dss)
             *  {
             *      if(ds.ID_TIP_DOCUMENT == td.ID)
             *      {
             *          ld.Add(ds);
             *      }
             *  }
             *  l.Add(new TipDocumentJson(td, ld.ToArray()));
             * }
             * this.TipuriDocumente = l.ToArray();
             * //this.CurDocumentScanat = new DocumentScanat();
             */

            this.TipuriDocumente = new TipDocumentJson[tipuriDocumente.Length];
            for (int i = 0; i < tipuriDocumente.Length; i++)
            {
                List <DocumentScanat> ld = new List <DocumentScanat>();
                for (int j = 0; j < dss.Length; j++)
                {
                    if (dss[j].ID_TIP_DOCUMENT == tipuriDocumente[i].ID)
                    {
                        ld.Add(dss[j]);
                    }
                }

                this.TipuriDocumente[i] = new TipDocumentJson(tipuriDocumente[i], ld.ToArray());
            }

            ResourceSet resourceSet = socisaV2.Resources.TipDocumenteResx.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
            List <KeyValuePair <string, string> > t = new List <KeyValuePair <string, string> >();

            foreach (DictionaryEntry entry in resourceSet)
            {
                t.Add(new KeyValuePair <string, string>(entry.Key.ToString(), entry.Value.ToString()));
            }
            this.TranslatedTipDocumenteNames = new string[t.Count][];
            for (int i = 0; i < t.Count; i++)
            {
                this.TranslatedTipDocumenteNames[i]    = new string[2];
                this.TranslatedTipDocumenteNames[i][0] = t[i].Key;
                this.TranslatedTipDocumenteNames[i][1] = t[i].Value;
            }
        }
Example #7
0
        public void ExportDosareToExcel(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"]);

            DosareRepository dr = new DosareRepository(_CURENT_USER_ID, conStr);

            //Dosar[] dosare = (Dosar[])dr.GetFiltered(null, null, String.Format(" DOSARE.DATA_SCA = '{0}' AND DOSARE.ID_SOCIETATE_CASCO = '{1}' AND DOSARE.ID_SOCIETATE_RCA = '{2}' ", CommonFunctions.ToMySqlFormatDate(d), Convert.ToInt32(Session["ID_SOCIETATE"]), Convert.ToInt32(id_soc_rca)), null).Result;
            Dosar[] dosare = (Dosar[])dr.GetFiltered(_sort, _order, _filter, _limit).Result;

            DataTable table = (DataTable)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(dosare, 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().Equals("id") &&
                    !dc.ColumnName.ToLower().Contains("nr_dosar_casco") &&
                    !dc.ColumnName.ToLower().Contains("nr_sca") &&
                    !dc.ColumnName.ToLower().Contains("data_sca") &&
                    !dc.ColumnName.ToLower().Contains("nr_polita_casco") &&
                    !dc.ColumnName.ToLower().Contains("nr_auto_casco") &&
                    !dc.ColumnName.ToLower().Contains("nr_polita_rca") &&
                    !dc.ColumnName.ToLower().Contains("nr_auto_rca") &&
                    !dc.ColumnName.ToLower().Contains("data_eveniment") &&
                    !dc.ColumnName.ToLower().Contains("valoare_regres") &&
                    !dc.ColumnName.ToLower().Contains("data_avizare")
                    )
                {
                    columns_to_remove.Add(dc.ColumnName);
                }
            }
            foreach (string col_name in columns_to_remove)
            {
                table.Columns.Remove(col_name);
            }
            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("Dosare");
                ws.Cells["A1"].LoadFromDataTable(table, true);
                var ms = new System.IO.MemoryStream();
                pack.SaveAs(ms);
                Response.BinaryWrite(ms.GetBuffer());
            }
        }