示例#1
0
        private ActionResult InternalTokenLogin(string _token, string _url, Utilizator u)
        {
            string conStr = HttpContext.Server.MapPath("~").ToLower().IndexOf("test") > 0 ? CommonFunctions.StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["MySQLConnectionString_test"].ConnectionString, CommonFunctions.StringCipher.RetrieveKey()) : CommonFunctions.StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString, CommonFunctions.StringCipher.RetrieveKey()); // separam socisa de socisa_test

            HttpContext.Session["TOKEN"] = _token;
            TempData.Clear();

            string[] separator = { "|" };
            string[] token     = _token.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            int      id        = Convert.ToInt32(token[1]);
            Dosar    d         = new Dosar(Convert.ToInt32(u.ID), conStr, id);

            HttpContext.Session["conStr"]         = conStr;
            HttpContext.Session["CURENT_USER_ID"] = u.ID;
            HttpContext.Session["CURENT_USER"]    = u;
            FormsAuthentication.SetAuthCookie(u.USER_NAME, true);
            //System.Web.Security.FormsAuthentication.SetAuthCookie("", false);
            NomenclatoareRepository nr = new NomenclatoareRepository(Convert.ToInt32(u.ID), conStr);
            Nomenclator             n  = (Nomenclator)nr.Find("TIP_UTILIZATORI", Convert.ToInt32(u.ID_TIP_UTILIZATOR)).Result;

            HttpContext.Session["CURENT_USER_TYPE"]     = n;
            HttpContext.Session["CURENT_USER_RIGHTS"]   = (Drept[])u.GetDrepturi().Result;
            HttpContext.Session["CURENT_USER_ACTIONS"]  = (SOCISA.Models.Action[])u.GetActions().Result;
            HttpContext.Session["CURENT_USER_SETTINGS"] = (Setare[])u.GetSetari().Result;
            HttpContext.Session["CURENT_USER_SOCIETATI_ADMINISTRATE"] = (SocietateAsigurare[])u.GetSocietatiAdministrate().Result;

            HttpContext.Session["ID_SOCIETATE"] = d.ID_SOCIETATE_CASCO;
            SocietateAsigurare sa = new SocietateAsigurare(Convert.ToInt32(u.ID_SOCIETATE), conStr, Convert.ToInt32(d.ID_SOCIETATE_CASCO));

            HttpContext.Session["SOCIETATE_ASIGURARE"] = sa;
            //return Redirect(String.Format("/Dashboard/IndexMain/{0}", Token));
            return(Redirect(String.Format("{0}{1}", HttpUtility.UrlDecode(_url), _token)));
        }
示例#2
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();
                }
            }
        }
示例#3
0
        public ProcesView(int _CURENT_USER_ID, string conStr, int?_ID_DOSAR, int?_ID_PROCES)
        {
            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"]));
            StadiiRepository sr = new StadiiRepository(_CURENT_USER_ID, conStr);

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

            this.CurProces  = new ProcesExtended(new Proces());
            this.procesJson = new ProcesJson();
            if (_ID_DOSAR != null && _ID_PROCES == null)
            {
                this.ID_DOSAR  = Convert.ToInt32(_ID_DOSAR);
                this.ID_PROCES = null;
                Dosar d = new Dosar(_CURENT_USER_ID, conStr, Convert.ToInt32(_ID_DOSAR));
                //this.Dosar = d;
                this.Procese = (Proces[])d.GetProcese().Result;

                /*
                 * Proces[] ps = (Proces[])d.GetProcese().Result;
                 * this.Procese = new ProcesExtended[ps.Length];
                 * for (int i = 0; i < ps.Length; i++)
                 * {
                 *  this.Procese[i] = new ProcesExtended(ps[i]);
                 * }
                 */
                this.procesJson          = new ProcesJson();
                this.procesJson.Calitate = d.ID_SOCIETATE_CASCO == Societate.ID ? "RECLAMANT" : "PARAT";
                SocietateAsigurare cealaltaSocietate = new SocietateAsigurare(_CURENT_USER_ID, conStr, Convert.ToInt32(d.ID_SOCIETATE_CASCO == Societate.ID ? d.ID_SOCIETATE_RCA : d.ID_SOCIETATE_CASCO));
                this.procesJson.Reclamant = d.ID_SOCIETATE_CASCO == Societate.ID ? Societate.DENUMIRE : cealaltaSocietate.DENUMIRE;
                this.procesJson.Parat     = d.ID_SOCIETATE_CASCO == Societate.ID ? cealaltaSocietate.DENUMIRE : Societate.DENUMIRE;
                this.procesJson.Tert      = "";
            }
            if (_ID_DOSAR == null && _ID_PROCES != null)
            {
                this.ID_PROCES = Convert.ToInt32(_ID_PROCES);
                this.ID_DOSAR  = null;

                this.procesJson.Reclamant = "";
                this.procesJson.Parat     = "";
                this.procesJson.Tert      = "";
            }
        }
示例#4
0
        public PlataView(int _CURENT_USER_ID, int _ID_DOSAR, string conStr)
        {
            this.ID_DOSAR = _ID_DOSAR;
            NomenclatoareRepository tpr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);

            this.TipuriPlati = (Nomenclator[])tpr.GetAll("tip_plata").Result;

            Dosar d = new Dosar(_CURENT_USER_ID, conStr, _ID_DOSAR);

            this.Plati = (Plata[])d.GetPlati().Result;
        }
示例#5
0
        private ActionResult LoginInternal(string returnUrl)
        {
            Utilizator u = (Utilizator)TempData["tempLogin"];

            TempData.Clear();
            u.IS_ONLINE = true;
            //Session["LAST_LOGIN"] = DateTime.Now;
            Session["LAST_LOGIN"] = u.CURRENT_LOGIN = DateTime.Now;
            //string s = "{'IS_ONLINE':true}";
            u.Update();
            Session["CURENT_USER"]    = u;
            Session["CURENT_USER_ID"] = u.ID;
            FormsAuthentication.SetAuthCookie(u.USER_NAME, true);
            //NomenclatoareRepository nr = new NomenclatoareRepository(Convert.ToInt32(u.ID), conStr);
            NomenclatoareRepository nr = new NomenclatoareRepository(Convert.ToInt32(u.ID), Session["conStr"].ToString());
            Nomenclator             n  = (Nomenclator)nr.Find("TIP_UTILIZATORI", Convert.ToInt32(u.ID_TIP_UTILIZATOR)).Result;

            Session["CURENT_USER_TYPE"]     = n;
            Session["CURENT_USER_RIGHTS"]   = (Drept[])u.GetDrepturi().Result;
            Session["CURENT_USER_ACTIONS"]  = (SOCISA.Models.Action[])u.GetActions().Result;
            Session["CURENT_USER_SETTINGS"] = (Setare[])u.GetSetari().Result;
            Session["CURENT_USER_SOCIETATI_ADMINISTRATE"] = (SocietateAsigurare[])u.GetSocietatiAdministrate().Result;

            if (u.ID_SOCIETATE == null && (n != null && n.DENUMIRE.ToUpper() == "ADMINISTRATOR"))
            {
                //return Redirect(returnUrl ?? Url.Action("SelectSocietate", "UtilizatoriController"));
                return(RedirectToAction("SelectSocietate"));
            }
            else
            {
                Session["ID_SOCIETATE"] = u.ID_SOCIETATE;
                //SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(Convert.ToInt32(u.ID), conStr);
                SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(Convert.ToInt32(u.ID), Session["conStr"].ToString());
                SocietateAsigurare           sa  = (SocietateAsigurare)sar.Find(Convert.ToInt32(u.ID_SOCIETATE)).Result;
                Session["SOCIETATE_ASIGURARE"] = sa;

                //return RedirectToAction("Index", "Home");
                //return Redirect(returnUrl ?? Url.Action("Index", "Home"));
                //return Redirect(returnUrl ?? Url.Action("IndexMain", "Dashboard"));
                if (returnUrl != null && returnUrl != "/")
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("IndexMain", "Dashboard"));
                }
            }
        }
示例#6
0
        public DosarView(int _CURENT_USER_ID, string 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;
            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;
        }
示例#7
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;
            }
        }
示例#8
0
        public UtilizatorView(int CURENT_USER_ID, string conStr)
        {
            SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(CURENT_USER_ID, conStr);

            SocietatiAsigurare             = GetFromBase((SocietateAsigurare[])sar.GetCombo().Result);
            SocietatiAsigurareAdministrate = GetFromBase((SocietateAsigurare[])sar.GetAllAdministrate().Result);

            DrepturiRepository dr = new DrepturiRepository(CURENT_USER_ID, conStr);

            Drepturi = GetFromBase((Drept[])dr.GetAll().Result);

            ActionsRepository ar = new ActionsRepository(CURENT_USER_ID, conStr);

            Actions = GetFromBase((SOCISA.Models.Action[])ar.GetAll().Result);

            NomenclatoareRepository nr = new NomenclatoareRepository(CURENT_USER_ID, conStr);

            TipuriUtilizator = (Nomenclator[])nr.GetAll("tip_utilizatori").Result;

            //HttpContext.Current.Session["l"] = new Dictionary<int, Utilizator>();
            UtilizatorJson = new UtilizatorJson(CURENT_USER_ID, conStr, CURENT_USER_ID);

            UtilizatorJson.UtilizatoriSubordonati = UtilizatorJson.GetUtilizatoriSubordonati(CURENT_USER_ID, conStr);
        }
示例#9
0
        public PlataView(int _CURENT_USER_ID, string conStr)
        {
            NomenclatoareRepository tpr = new NomenclatoareRepository(_CURENT_USER_ID, conStr);

            this.TipuriPlati = (Nomenclator[])tpr.GetAll("tip_plata").Result;
        }
示例#10
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;
         }
     }
 }