Esempio n. 1
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;
            }
        }
Esempio n. 2
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;
         }
     }
 }