Ejemplo n.º 1
0
        public ActionResult Create(DoctorViewModel model)
        {
            try
            {
                //Check LogOn session is null or not. If null then do sign out
                if (this.Session[LogOnSession.UserLogOnSession] == null)
                {
                    return(RedirectToAction("SignOut", "Main"));
                }
                this.objLogOnSession  = (LogOnSession)this.Session[LogOnSession.UserLogOnSession];
                this.ViewBag.UserName = string.Concat("Welcome ", this.objLogOnSession.FirstName, " ", this.objLogOnSession.LastName);

                if (ModelState.IsValid)
                {
                    if (repository.SetDoctor(model))
                    {
                        ViewBag.Message = "Doctor Added Successfully";
                        ModelState.Clear();
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create()
        {
            //Check LogOn session is null or not. If null then do sign out
            if (this.Session[LogOnSession.UserLogOnSession] == null)
            {
                return(RedirectToAction("SignOut", "Main"));
            }
            this.objLogOnSession = (LogOnSession)this.Session[LogOnSession.UserLogOnSession];

            this.ViewBag.UserName = string.Concat("Welcome ", this.objLogOnSession.FirstName, " ", this.objLogOnSession.LastName);
            this.model.UserId     = this.objLogOnSession.UserId = model.UserId;

            return(View());
        }
        public string MakeOdataQuery(String ReportName, string SiteId, String Query)
        {
            Query       = Query.Replace("amp;", "");
            sessionData = LogOnSessionFactory.Instance.GetCurrent();
            using (new Win32ImpersonationContext(sessionData.Win32Identity))
            {
                //get the machine name
                ICollection <ConnectorAddress> ConnectorAd = sessionData.SitesById[SiteId].GetConnectorAddresses(typeof(IBrokerConnector));
                ConnectorAddress ServernameConnector       = ConnectorAd.ElementAt <ConnectorAddress>(0);


                //construct query
                string    odataqueryString = "http://" + ServernameConnector.ServerName + "/citrix/monitor/odata/v2/data/" + Query + "&$format=json";
                WebClient wc = new WebClient();
                wc.UseDefaultCredentials = true;
                //if (!EventLog.SourceExists("odataquery"))
                //    EventLog.CreateEventSource("odataquery", "Application");
                //try
                //{
                //    EventLog.WriteEntry("odataquery", odataqueryString);
                //}
                //catch { }
                //wc.Headers.Add("Accept", "application/xml");
                string odatastr = wc.DownloadString(odataqueryString);
                //wc.Dispose();
                //try
                //{
                //    EventLog.WriteEntry("odataquery", odatastr);
                //}
                //catch(Exception e) {
                //    EventLog.WriteEntry("odataquery",e.Message );
                //}
                Guid guid = Guid.NewGuid();

                this.sessionData.TrendsChartCache.AddKey(guid);
                //create collection
                //try
                //{
                //    EventLog.WriteEntry("odataquery", odatastr);
                //}
                //catch { }
                Task.Factory.StartNew(() => ProcessCustomReportData(guid, Query, odatastr, ReportName));


                return(guid.ToString());
            }
        }
Ejemplo n.º 4
0
            public string MakeOdataQuery(String ReportName,string SiteId, String Query)
            {
                Query = Query.Replace("amp;","");
                 sessionData = LogOnSessionFactory.Instance.GetCurrent();
                using (new Win32ImpersonationContext(sessionData.Win32Identity))
                {
                    //get the machine name               
                    ICollection<ConnectorAddress> ConnectorAd = sessionData.SitesById[SiteId].GetConnectorAddresses(typeof(IBrokerConnector));                    
                    ConnectorAddress ServernameConnector = ConnectorAd.ElementAt<ConnectorAddress>(0);


                    //construct query
                    string odataqueryString = "http://" + ServernameConnector.ServerName + "/citrix/monitor/odata/v2/data/" + Query +"&$format=json";                    
                    WebClient wc = new WebClient();                      
                    wc.UseDefaultCredentials = true;
                    //if (!EventLog.SourceExists("odataquery"))
                    //    EventLog.CreateEventSource("odataquery", "Application");
                    //try
                    //{
                    //    EventLog.WriteEntry("odataquery", odataqueryString);
                    //}
                    //catch { }
                    //wc.Headers.Add("Accept", "application/xml");
                    string odatastr = wc.DownloadString(odataqueryString);
                    //wc.Dispose();
                    //try
                    //{
                    //    EventLog.WriteEntry("odataquery", odatastr);
                    //}
                    //catch(Exception e) {
                    //    EventLog.WriteEntry("odataquery",e.Message );
                    //}
                    Guid guid = Guid.NewGuid();

                    this.sessionData.TrendsChartCache.AddKey(guid);
                    //create collection
                    //try
                    //{
                    //    EventLog.WriteEntry("odataquery", odatastr);
                    //}
                    //catch { }
                    Task.Factory.StartNew(() => ProcessCustomReportData(guid,Query,odatastr,ReportName));
                              

                    return guid.ToString();
                }
            }