예제 #1
0
        //[AuthorizeUser(ActionName = "Nomenclatoare", Recursive = false)]
        public ActionResult Details(string id)
        {
            string      conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int         uid    = Convert.ToInt32(Session["CURENT_USER_ID"]);
            Nomenclator tp     = !String.IsNullOrWhiteSpace(id) && id != "null" ? new Nomenclator(uid, conStr, "tip_procese", Convert.ToInt32(id)) : new Nomenclator();

            return(PartialView("_PartialTipProces", tp));
        }
예제 #2
0
        /// <summary>
        /// Create the channel factory for calling the session manager in the host
        /// </summary>
        /// <param name="sessionManagerProcessId"></param>

        private static void SetSessionManagerProcessId(int sessionManagerProcessId)
        {
            string sessionManagerEndpointAddress =
                Nomenclator.GetIPCEndpointAddress(typeof(INativeSessionManager), sessionManagerProcessId);
            EndpointAddress endpointAddress = new EndpointAddress(sessionManagerEndpointAddress);

            NativeSessionManagerClientFactory =
                new ChannelFactory <INativeSessionManager>("NativeSessionManager_IPCEndpoint", endpointAddress);
        }
예제 #3
0
 public MesajJson(Mesaj m, Dosar dos, Utilizator s, Utilizator[] us, Nomenclator n, DateTime?d)
 {
     this.Mesaj      = m;
     this.Dosar      = dos;
     this.Sender     = s;
     this.Receivers  = us;
     this.TipMesaj   = n;
     this.DataCitire = d;
 }
예제 #4
0
        /// <summary>
        /// Open the service endpoint(s) and wait for connection from client
        /// For this method to operate properly the following must be setup:
        /// 1. .Net port sharing must be set up by issueing the following
        ///    command under an admin account: sc.exe config NetTcpPortSharing start= demand
        /// 2. Must run the app in admin mode or the current user must be added
        ///    to the allowedAccounts section in the SMSvcHost.exe.config file.
        /// </summary>

        private static void OpenServiceHost()
        {
            int processId = Process.GetCurrentProcess().Id;

            NativeSessionHost nativeSessionHost =             // Create the native session host obj for the IPC and NetTcp service hosts to use
                                                  new NativeSessionHost();

            ServiceHost serviceHost =             // Create the host object
                                      new ServiceHost(nativeSessionHost);

            // Add the native session's IPC endpoint (for use by the NativeSessionManager)

            string endpointAddressName      = Nomenclator.GetIPCEndpointAddress(typeof(Types.Internal.INativeSession), processId);
            NetNamedPipeBinding ipcBinding  = new NetNamedPipeBinding("ipcBinding");
            ServiceEndpoint     ipcEndpoint = serviceHost.AddServiceEndpoint(
                typeof(Types.Internal.INativeSession),
                ipcBinding,
                new Uri(endpointAddressName));

            // Add the NetTcp endpoint (for use by the native client)

            NativeSessionEndpointAddress.ServiceHostName = ServiceHostUtil.HostName;
            NativeSessionEndpointAddress.ServicePort     = ServiceHostUtil.BasePort + 5;         // //port offset for native services = +2

            endpointAddressName = NativeSessionEndpointAddress.Build(processId);
            NetTcpBinding tcpBinding = new NetTcpBinding("tcpBinding");

            ServiceEndpoint tcpEndpoint = serviceHost.AddServiceEndpoint(
                typeof(Native.INativeSession),
                tcpBinding,
                new Uri(endpointAddressName));

            // Up the value of maxItemsInObjectGraph so that the MetaTree can pass over the wire...

            foreach (OperationDescription op in tcpEndpoint.Contract.Operations)
            {
                if (op.Name != "InvokeNativeMethod")
                {
                    continue;
                }

                DataContractSerializerOperationBehavior dataContractBehavior =
                    op.Behaviors.Find <DataContractSerializerOperationBehavior>()
                    as DataContractSerializerOperationBehavior;
                if (dataContractBehavior != null)
                {
                    dataContractBehavior.MaxItemsInObjectGraph = 2147483647;
                }
            }


            // We really don't need to do this anymore. Why rewrite the address?  Just keep the address from the config file.
            //ServiceHostUtil.ApplyEndpointAddressAndIdentityConfig(serviceHost);

            serviceHost.Open();             // Open the host
        }
예제 #5
0
        public JsonResult GetMessages(int?id, int?_START_LIMIT, int?_END_LIMIT)    // id_dosar
        {
            MesajView mv     = new MesajView();
            string    conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int       uid    = Convert.ToInt32(Session["CURENT_USER_ID"]);
            Mesaj     mesaj  = new Mesaj(uid, conStr);

            Utilizator[] us = (Utilizator[])mesaj.GetReceivers().Result;
            Utilizator   s  = (Utilizator)mesaj.GetSender().Result;
            Nomenclator  n  = (Nomenclator)mesaj.GetTipMesaj().Result;
            DateTime?    da = (DateTime?)mesaj.GetMessageReadDate(uid).Result;
            Dosar        d  = new Dosar(uid, conStr, Convert.ToInt32(id));

            mv.MesajJson       = new MesajJson(mesaj, d, s, us, n, da);
            mv.InvolvedParties = (Utilizator[])d.GetInvolvedParties().Result;
            mv.TipuriMesaj     = (Nomenclator[])(new NomenclatoareRepository(uid, conStr).GetAll("tip_mesaje").Result);
            List <MesajJson> ls = new List <MesajJson>();

            Mesaj[] ms = null;

            if (id != null)
            {
                d  = new Dosar(uid, conStr, Convert.ToInt32(id));
                ms = (Mesaj[])d.GetMesaje().Result;
            }
            else
            {
                Utilizator u = (Utilizator)Session["CURENT_USER"];
                ms = (Mesaj[])u.GetMesaje(_START_LIMIT, _END_LIMIT).Result;
            }

            /*
             * foreach(Mesaj m in ms)
             * {
             *  //ls.Add(new MesajJson(m, (Dosar)m.GetDosar().Result, (Utilizator)m.GetSender().Result, (Utilizator[])m.GetReceivers().Result, (Nomenclator)m.GetTipMesaj().Result, (DateTime?)m.GetMessageReadDate(uid).Result));
             *  MesajJson mj = new MesajJson(m);
             *  mj.DataCitire = (DateTime?)m.GetMessageReadDate(uid).Result;
             *  ls.Add(mj);
             * }
             * mv.MesajeJson = ls.ToArray();
             */
            mv.MesajeJson = new MesajJson[ms.Length];
            for (int i = 0; i < ms.Length; i++)
            {
                mv.MesajeJson[i]            = new MesajJson(ms[i]);
                mv.MesajeJson[i].DataCitire = (DateTime?)ms[i].GetMessageReadDate(uid).Result;
            }

            //return PartialView("_MesajeView", mv);
            return(Json(mv, JsonRequestBehavior.AllowGet));
        }
예제 #6
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"));
                }
            }
        }
예제 #7
0
        public static void Process_PMO(List <Nomenclator> list, int pmoType)
        {
            Nomenclator wNomenclator;

            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                string[] auxiliar;
                foreach (Nomenclator temp in list.OrderBy(p => p.Id))
                {
                    wNomenclator = new Nomenclator();

                    auxiliar = temp.Code.Split('.');

                    if (auxiliar.Length == 3)
                    {
                        wNomenclator.Code       = temp.Code.Trim();
                        wNomenclator.ParentCode = string.Concat(auxiliar[0], '.', auxiliar[1]);
                        wNomenclator.HasChilds  = false;
                    }

                    if (auxiliar.Length == 2)
                    {
                        wNomenclator.Code       = temp.Code.Trim();
                        wNomenclator.ParentCode = auxiliar[0].ToString();
                        wNomenclator.HasChilds  = true;
                    }


                    if (auxiliar.Length == 1)
                    {
                        wNomenclator.Code       = temp.Code.Trim();
                        wNomenclator.ParentCode = string.Empty;
                        wNomenclator.HasChilds  = true;
                    }



                    wNomenclator.Description = temp.Description.Trim();
                    wNomenclator.PMOType     = pmoType;
                    //wNomenclator.Id = temp.Id;

                    dc.Nomenclators.InsertOnSubmit(wNomenclator);
                }
                dc.SubmitChanges();
            }
        }