public XmlDocumentViewSchema(string name, Pair data, bool includeSpecialSchema)
 {
     this._includeSpecialSchema = includeSpecialSchema;
     this._children = (OrderedDictionary) data.First;
     this._attrs = (ArrayList) data.Second;
     this._name = name;
 }
示例#2
0
    public static Hashtable GetTotalServicesRemainingByPatients(int[] patient_ids, DateTime start_date)
    {
        if (start_date == DateTime.MinValue)
        {
            start_date = new DateTime(1900, 1, 1);  // dates in sql server must be after year 17xx
        }
        string sql = @"SELECT hc.patient_id, hc.date_referral_signed,
                              ISNULL((SELECT SUM(num_services_remaining)
                                      FROM   HealthCardEPCRemaining
                                      WHERE  (deleted_by IS NULL AND date_deleted IS NULL AND health_card_id = hc.health_card_id)), 0) AS count

                       FROM   HealthCard hc
                       WHERE  hc.patient_id IN (" + string.Join(",", patient_ids) + @") AND hc.is_active = 1 AND hc.date_referral_signed > '" + start_date.ToString("yyyy-MM-dd") + @"'";

        Hashtable result = new Hashtable();

        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            int      patient_id  = Convert.ToInt32(tbl.Rows[i]["patient_id"]);
            int      count       = Convert.ToInt32(tbl.Rows[i]["count"]);
            DateTime date_signed = Convert.ToDateTime(tbl.Rows[i]["date_referral_signed"]);
            result[patient_id] = new System.Web.UI.Pair(count, date_signed);
        }

        return(result);
    }
        /// <summary>
        /// Page의 ViewState 정보를 특정 저장소에 저장하고, 저장 토큰 값을 <see cref="AbstractServerPageStatePersister.StateValue"/>에 저장합니다.
        /// </summary>
        protected override void SaveToRepository() {
            if(IsDebugEnabled)
                log.Debug("Page 상태정보를 저장합니다...");

            RemoveExpires(Expiration);

            var pageState = new Pair(ViewState, ControlState);

            if(StateValue.IsWhiteSpace())
                StateValue = Guid.NewGuid().ToString();

            var stateEntity = (PageStateEntity)PageStateTool.CreateStateEntity(StateValue, pageState, Compressor, CompressThreshold);

            using(var repository = CreateRepository()) {
                var query = Query.EQ(MongoTool.IdString, stateEntity.Id);
                var updated = Update.Set("Value", stateEntity.Value).Set("IsCompressed", stateEntity.IsCompressed).Set("CreatedDate",
                                                                                                                       stateEntity.
                                                                                                                           CreatedDate);

                // UPSERT
                var result = repository.FindAndModify(query, SortBy.Null, updated, true, true);

                if(IsDebugEnabled)
                    log.Debug("캐시에 Page 상태정보를 저장했습니다!!! StateValue=[{0}], Expiration=[{1}] (min), Result=[{2}]", StateValue, Expiration,
                              result.Ok);
            }
        }
示例#4
0
 /// <summary>
 /// Saves the current view state of the <see cref="Composition" /> object.
 /// </summary>
 /// <param name="saveAll"><c>true</c> if all values should be saved regardless
 /// of whether they are dirty; otherwise <c>false</c>.</param>
 /// <returns>An object that represents the saved state. The default is <c>null</c>.</returns>
 protected override object SaveViewState(bool saveAll)
 {
     Pair pair = new Pair();
     pair.First = base.SaveViewState(saveAll);
     if (_points != null)
         pair.Second = ((IStateManagedObject)_points).SaveViewState(saveAll);
     return (pair.First == null && pair.Second == null) ? null : pair;
 }
示例#5
0
		protected override object SaveViewState ()
		{
			if (tabData != null) {
				Pair p = new Pair (tabData, titles);
				return new Pair (base.SaveViewState (), p);
			}
			return null;
		}
 protected override object SaveViewState() {
     var myState = new Pair();
     myState.First = base.SaveViewState();
     if (_dataServiceContext != null) {
         myState.Second = _dataServiceContext.Entities.Where(ed => !String.IsNullOrEmpty(ed.ETag)).ToDictionary(
             ed => DataServiceUtilities.BuildCompositeKey(ed.Entity), ed => ed.ETag);
     }
     return myState;
 }
 public override void Save()
 {
     Pair pair = new Pair();
     if (base.ViewState != null)
     { pair.First = base.ViewState; }
     if (base.ControlState != null)
     { pair.Second = base.ControlState; }
     this.Page.Session["__Houfeng_AjaxEngine_"+this.GetUniqueKey()] =pair;
 }
示例#8
0
		/// <summary>
		/// IContextLoaderStep.ExecuteContextLoader() implementation
		/// </summary>
		/// <param name="data">The data which the values are read from.</param>
		/// <param name="contextConfig">The configuration for the context loader test step.</param>
		/// <param name="context">The context object into which the values will be written.</param>
		public void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context)
		{
			var contextNodes = contextConfig.SelectNodes("XPath");

			foreach (XmlNode contextNode in contextNodes)
			{
                var xPathPair = new Pair(contextNode.SelectSingleNode("@contextKey").Value, contextNode.SelectSingleNode(".").InnerText);
			    _xPathExpressions.Add(xPathPair);
			}

            ExecuteContextLoader(data, context);
		}
 /// <summary>
 /// 保存视图状态
 /// </summary>
 public override void Save()
 {
     Pair pair = new Pair();
     if (base.ViewState != null)
         pair.First = base.ViewState;
     if (base.ControlState != null)
         pair.Second = base.ControlState;
     //
     //TheCache.Insert("__Houfeng_AjaxEngine_" + this.GetUniqueKey(), pair);
     TheCache.Insert("__Houfeng_AjaxEngine_" + this.GetUniqueKey(), pair, null,
     DateTime.Now.AddMinutes(this.Timeout), Cache.NoSlidingExpiration, CacheItemPriority.Default, null);
 }
        protected override void SaveToRepository() {
            if(IsDebugEnabled)
                log.Debug("Page 상태정보를 압축하여 Hidden Field에 저장합니다...");

            var pair = new Pair(ViewState, ControlState);
            var stateEntity = PageStateTool.CreateStateEntity(string.Empty, pair, Compressor, CompressThreshold);

            StateValue = Serializer.Serialize(stateEntity).Base64Encode();

            if(IsDebugEnabled)
                log.Debug("Page 상태정보를 압축하여 Hidden Field에 저장했습니다!!!");
        }
        public override void Save()
        {
            if (base.Page.Form != null && (base.ControlState != null || base.ViewState != null))
            {
                var fileName = string.Concat(DateTime.Now.Ticks, 16, "-", HttpContext.Current.Session.SessionID, ".vs");
                var filePath = Path.Combine(HttpContext.Current.Server.MapPath(_stateFileFolderPath), fileName);
                var pair = new Pair(base.ViewState, base.ControlState);
                File.WriteAllText(filePath, base.StateFormatter.Serialize(pair));

                var stateField = string.Format(@"{0}<input type=""hidden"" name=""{1}"" value=""{2}"" />{0}{0}", System.Environment.NewLine, _viewstateFormFieldId, fileName);
                base.Page.Form.Controls.AddAt(0, new LiteralControl(stateField));
            }
        }
示例#12
0
        internal /*public*/ void Load(MobilePage page, Pair id)
        {
            _state = null;

            SessionViewStateHistory history = (SessionViewStateHistory)page.Session[ViewStateKey];
            if (history != null)
            {
                SessionViewStateHistoryItem historyItem = history.Find(id);
                if (historyItem != null)
                {
                    LoadFrom(historyItem);
                }
            }
        }
 public override void Save()
 {
     Pair pair = new Pair();
     if (base.ViewState != null)
         pair.First = base.ViewState;
     if (base.ControlState != null)
         pair.Second = base.ControlState;
     //
     LosFormatter los = new LosFormatter();
     StringWriter writer = new StringWriter();
     los.Serialize(writer, pair);
     StreamWriter sw = File.CreateText(ViewStateFilePath);
     sw.Write(writer.ToString());
     sw.Close();
 }
        private void Process(DrawContainer draw, int i, Pair item, int total)
        {
            int value = (int)item.Second;
            double angleplus = 360 * value * 1.0 / total;
            double popangle = this.angle + (angleplus / 2);
            System.Drawing.Color color = this.ColorFromHSL(this.start, 0.5, 0.5);
            int delta = 30;
            System.Drawing.Color bcolor = this.ColorFromHSL(this.start, 1, 0.5);
            int r = 200;
            double rad = Math.PI / 180;

            draw.Gradients.Add(new LinearGradient
            {
                Degrees = 90,
                GradientID = "Grd" + i,
                Stops = {
                    new GradientStop{Offset = 0, Color = System.Drawing.ColorTranslator.ToHtml(bcolor)},
                    new GradientStop{Offset = 100, Color = System.Drawing.ColorTranslator.ToHtml(color)}
                }
            });

            AbstractSprite sector = this.Sector(250, 250, r, this.angle, this.angle + angleplus);
            sector.FillStyle = "url(#Grd" + i + ")";
            sector.StrokeStyle = "#fff";
            sector.LineWidth = 3;

            draw.Items.Add(sector);

            TextSprite text = new TextSprite
            {
                SpriteID = "text" + i,
                X = Convert.ToInt32(350 + (r + delta + 55) * Math.Cos(-popangle * rad)),
                Y = Convert.ToInt32(350 + (r + delta + 25) * Math.Sin(-popangle * rad)),
                Text = item.First.ToString(),
                FillStyle = System.Drawing.ColorTranslator.ToHtml(bcolor),
                StrokeStyle = "none",
                GlobalAlpha = 0,
                FontSize = "20"
            };

            draw.Items.Add(text);

            //sector.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0});", i);
            //sector.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i);

            this.angle += angleplus;
            this.start += 0.1;
        }
        /// <summary>
        /// Save page state.
        /// </summary>
        public override void Save()
        {
            //No processing needed if no state available
            if (ViewState == null & ControlState == null)
            {
                return;
            }

            //Save view state and control state separately
            Pair state = new Pair(ViewState, ControlState);

            //Add view state and control state to session
            HttpContext.Current.Session[base.StateKey] = state;

            base.Save();
        }
 public override void Save()
 {
     if (ViewState == null && ControlState == null)
     {
         return;
     }
     StringBuilder key = new StringBuilder();
     {
         key.Append("VS_");
         key.Append(Page.Session == null ? Guid.NewGuid().ToString() : Page.Session.SessionID);
         key.Append("_");
         key.Append(DateTime.Now.Ticks.ToString());
     }
     Pair state = new Pair(ViewState, ControlState);
     //DataCache.SetCache(key.ToString(), state, objDependency, DateTime.Now.AddMinutes(Page.Session.Timeout), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.NotRemovable, null);
     Page.ClientScript.RegisterHiddenField(VIEW_STATE_CACHEKEY, key.ToString());
 }
        /// <summary>
        /// Page의 ViewState 정보를 특정 저장소에 저장하고, 저장 토큰 값을 <see cref="AbstractServerPageStatePersister.StateValue"/>에 저장합니다.
        /// </summary>
        protected override void SaveToRepository() {
            if(IsDebugEnabled)
                log.Debug("상태정보를 Session에 저장하려고 합니다...");

            ThrowIfSessionStateModeIsOff(Page.Session.Mode);

            if(StateValue.IsWhiteSpace())
                StateValue = CreateStateValue();

            var pair = new Pair(ViewState, ControlState);
            var stateEntity = PageStateTool.CreateStateEntity(StateValue, pair, Compressor, CompressThreshold);

            Page.Session[GetCacheKey()] = stateEntity;

            if(IsDebugEnabled)
                log.Debug("세션에 상태정보를 저장했습니다!!! StateValue=[{0}]", StateValue);
        }
 private void ParseViewStateForCachedObjects(object vs)
 {
     if (!PageNeedsToValidateCachedObjects)
     {
         return;
     }
     if (vs is Pair)
     {
         System.Web.UI.Pair pair = (Pair)vs;
         if (pair.First is BlockOutputCache)
         {
             BlockOutputCache cache = (BlockOutputCache)pair.First;
             if (cache.ChildViewState == null)
             {
                 cache.ChildViewState = pair.Second;
             }
             else
             {
                 pair.Second = cache.ChildViewState;
             }
             pair.First = cache.ViewState;
         }
         if (pair.First is PageOutputCache)
         {
             PageOutputCache pagecache = (PageOutputCache)pair.First;
             if (pagecache.ChildViewState == null)
             {
                 pagecache.ChildViewState = pair.Second;
             }
             else
             {
                 pair.Second = pagecache.ChildViewState;
             }
             pair.First = pagecache.ViewState;
         }
         ParseViewStateForCachedObjects(pair.First);
         ParseViewStateForCachedObjects(pair.Second);
     }
     else if (vs != null && (vs is ArrayList || vs.GetType().IsArray))
     {
         foreach (object item in (IEnumerable)vs)
         {
             ParseViewStateForCachedObjects(item);
         }
     }
 }
示例#19
0
        public ClientJavaScript()
        {
            // get the sticky id for the request
            Guid stickyId = WebContext.Current.StickyId;
            if (!scripts.ContainsKey(stickyId))
            {
                lock (syncRoot)
                {
                    if (!scripts.ContainsKey(stickyId))
                    {
                        Dictionary<string, Pair> scriptIncludes = new Dictionary<string, Pair>();
                        Dictionary<string, Pair>  scriptVariables = new Dictionary<string, Pair>();

                        scripts[stickyId] = new Pair() { First = scriptIncludes, Second = scriptVariables };
                    }
                }
            }
        }
 public override void Save()
 {
     Pair pair = new Pair();
     if (base.ViewState != null)
     { pair.First = base.ViewState; }
     if (base.ControlState != null)
     { pair.Second = base.ControlState; }
     //
     LosFormatter los = new LosFormatter();
     StringWriter writer = new StringWriter();
     los.Serialize(writer, pair);
     //
     string viewStateString = writer.ToString();
     Page.ClientScript.RegisterHiddenField("__AJAXVIEWSTATE", viewStateString);
     if (((IAjaxPage)Page).PageEngine.IsAjaxPostBack)
     {
         ((IAjaxPage)Page).PageEngine.OutMessages.Add(new Message(MessageType.Script, "__AJAXVIEWSTATE", string.Format("document.getElementById('__AJAXVIEWSTATE').value='{0}'", viewStateString)));
     }
 }
        public List<Pair> getAttractionsInPairs()
        {
            int i = 0;
            List<Pair> attractions = new List<Pair>();
            for (i = 0; i < this.nightLife.Count; i++)
            {
                GeoCoordinate myCoor = new GeoCoordinate(Double.Parse(this.nightLife[i].location.First.ToString())
                    , Double.Parse(this.nightLife[i].location.Second.ToString()));
                int nearestIndex = this.getNearestAttr(myCoor);

                if (nearestIndex == -1)
                {
                    break;
                }

                Pair newPair = new Pair(this.nightLife[i], this.otherAttr[nearestIndex]);

                attractions.Add(newPair);

                this.otherAttr.RemoveAt(nearestIndex);
            }

            if (!(i == this.nightLife.Count - 1))
            {
                for (int j = i; j < this.nightLife.Count - 1; j += 2)
                {
                    Pair newPair = new Pair(this.nightLife[j], this.nightLife[j + 1]);
                    attractions.Add(newPair);
                }
            }

            if (this.otherAttr.Count > 1)
            {
                for (int j = 0; j < this.otherAttr.Count - 1; j += 2)
                {
                    Pair newPair = new Pair(this.otherAttr[j], this.otherAttr[j + 1]);
                    attractions.Add(newPair);
                }

            }

            return attractions;
        }
        protected override object LoadPageStateFromPersistenceMedium()
        {
            object mainViewState;
            bool   useQueryString = false;

            ViewStateIsValid = false;

            NameValueCollection request = this.Request.Form;

            if (this.Request.Form.AllKeys.Length == 0 && this.Request.QueryString.Count > 0)
            {
                // use query string as source for the request
                request        = this.Request.QueryString;
                useQueryString = true;
            }

            // load the main view state
            string viewState = request["__OSVSTATE"];

            // unescape spaces...
            if (useQueryString && viewState != null)
            {
                viewState = viewState.Replace(' ', '+');
            }

            string hash = "";

            if (viewState == null)
            {
                mainViewState = new System.Web.UI.Pair();
            }
            else
            {
                mainViewState    = DeserializeViewState(viewState, out hash);
                ViewStateIsValid = true;
            }

            // compute and store the hash of this viewstate
            StoreViewStateHash("__OSVSTATE", viewState, hash);

            return(mainViewState);
        }
 public override void Save()
 {
     if (ViewState == null && ControlState == null)
     {
         return;
     }
     if (Page.Session != null)
     {
         if (!Directory.Exists(CacheDirectory))
         {
             Directory.CreateDirectory(CacheDirectory);
         }
         StreamWriter writer = new StreamWriter(StateFileName, false);
         IStateFormatter formatter = this.StateFormatter;
         Pair statePair = new Pair(ViewState, ControlState);
         string serializedState = formatter.Serialize(statePair);
         writer.Write(serializedState);
         writer.Close();
     }
 }
示例#24
0
        public override void Save()
        {
            if(cache.Loaded)
            {
                string cacheKey = CacheKeyPrefix + Guid.NewGuid().ToString("N"); // dynamic guid 
                Pair data = new Pair(ViewState, ControlState);
                string state = StateFormatter.Serialize(data);
                
                
                bool cached = false;
                try
                {
                        cached = cache.Insert(cacheKey, state); //insert without grouping
                }
                catch (Exception e)
                {
                    if (!cached)
                        trace.WriteTrace(TraceSeverity.WarningEvent, TraceCategory.Content, "Could not cache view state."+e.Message);
                }

                if (cached)
                {
                    _hiddenFiledPagePersister.ViewState = cacheKey; // send dynamic guid to client
                    ContentPerfCounters.Current.UpdateViewstateSize(state.Length);
                    ContentPerfCounters.Current.IncrementViewstateAdditions();
                    trace.WriteTrace(TraceSeverity.InformationEvent, TraceCategory.Content, "view state cached: " + cacheKey);
                }
            }
            else
            {
                trace.WriteTrace(TraceSeverity.CriticalEvent, TraceCategory.Content, " Cache is not loaded. ");

                _hiddenFiledPagePersister.ViewState = ViewState;
                _hiddenFiledPagePersister.ControlState = ControlState;
            }

            _hiddenFiledPagePersister.Save();            
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   Configures the initial visibility status of the default label
 /// </summary>
 /// <param name = "p"></param>
 /// <returns></returns>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///   [Vicenç]	26/03/2006	Created
 /// </history>
 /// -----------------------------------------------------------------------------
 protected bool ExpandDefault(Pair p)
 {
     return p.Second.ToString().Length < 150;
 }
示例#26
0
文件: Page.cs 项目: jdecuyper/mono
	internal void SavePageViewState ()
	{
		if (!handleViewState)
			return;

		object controlState = SavePageControlState ();
		Pair vsr = null;
		object viewState = null;
		
		if (EnableViewState
#if NET_4_0
		    && this.ViewStateMode == ViewStateMode.Enabled
#endif
		)
			viewState = SaveViewStateRecursive ();
		
		object reqPostback = (_requiresPostBack != null && _requiresPostBack.Count > 0) ? _requiresPostBack : null;
		if (viewState != null || reqPostback != null)
			vsr = new Pair (viewState, reqPostback);

		Pair pair = new Pair ();
		pair.First = vsr;
		pair.Second = controlState;
		if (pair.First == null && pair.Second == null)
			SavePageStateToPersistenceMedium (null);
		else
			SavePageStateToPersistenceMedium (pair);

	}
 // Loads items using view state pair in templated case where custom paging 
 // on, view state off.  In this special case, load items early as 
 // possible to enable events to be raised.
 private void ConditionalLoadItemsFromPersistedArgs()
 {
     if (_stateLoadItemsArgs != null && IsCustomPaging && IsTemplated && !IsViewStateEnabled())
     {
         OnLoadItems(
             new LoadItemsEventArgs((int) _stateLoadItemsArgs.First, (int) _stateLoadItemsArgs.Second));
         _stateLoadItemsArgs = null;
     }
 }
        /// <include file='doc\PagedControl.uex' path='docs/doc[@for="PagedControl.LoadPrivateViewState"]/*' />
        protected override void LoadPrivateViewState(Object state)
        {
            Debug.Assert (state == null || state.GetType() == typeof(Pair), 
               "If the base state is non-null, private viewstate should always be saved as a pair");

            Pair statePair = state as Pair;
            if (statePair != null)
            {
                base.LoadPrivateViewState(statePair.First); 
                _stateLoadItemsArgs = statePair.Second as Pair;
                ConditionalLoadItemsFromPersistedArgs();
            }
        }
示例#29
0
		object IStateManager.SaveViewState ()
		{
			object[] state = null;
			bool hasData = false;
			
			if (dirty) {
				if (items.Count > 0) {
					hasData = true;
					state = new object [items.Count + 1];
					state [0] = true;
					for (int n = 0; n < items.Count; n++) {
						TreeNode node = items [n] as TreeNode;
						object ns = ((IStateManager) node).SaveViewState ();
						Type type = node.GetType ();
						state [n + 1] = new Pair (type == typeof (TreeNode) ? null : type, ns);
					}
				}
			} else {
				ArrayList list = new ArrayList ();
				for (int n=0; n<items.Count; n++) {
					TreeNode node = items[n] as TreeNode;
					object ns = ((IStateManager)node).SaveViewState ();
					if (ns != null) {
						hasData = true;
						list.Add (new Pair (n, ns));
					}
				}
				if (hasData) {
					list.Insert (0, false);
					state = list.ToArray ();
				}
			}
			
			if (hasData)
				return state;
			else
				return null;
		}
示例#30
0
 protected override object SaveViewState()
 {
     Pair pair = new Pair();
     pair.First = base.SaveViewState();
     if (_composition != null)
         pair.Second = ((IStateManager)this.Composition).SaveViewState();
     return (pair.First == null && pair.Second == null) ? null : pair;
 }
示例#31
0
        /// <include file='doc\LOSFormatter.uex' path='docs/doc[@for="LosFormatter.DeserializeValueInternal"]/*' />
        /// <devdoc>
        ///     Deserializes a value from tokens, starting at current. When this
        ///     function returns, current will be left at the next token.
        ///
        ///     This function is recursive.
        /// </devdoc>
        private object DeserializeValueInternal()
        {
            // Determine the data type... possible combinations are:
            //
            //   @<...>     == array of strings
            //   @T<...>    == array of (typeref T)
            //   b<...>     == base64 encoded value
            //   h<...>     == hashtable
            //   l<...>     == arraylist
            //   p<...>     == pair
            //   t<...>     == triplet
            //   i<...>     == int
            //   o<t/f>     == boolean true/false
            //   T<...>     == (typeref T)
            //   ...        == string
            //

            object value = null;

            string token = ConsumeOneToken();

            if (_current >= _deserializationData.Length || _deserializationData[_current] != leftAngleBracketChar)
            {
                // just a string - next token is not a left angle bracket
                // we can shortcut here and just return the string
                //_current++; //consume right angle bracket or delimiter
                return(token);
            }

            _current++; // consume left angle bracket

            // otherwise, we have typeref followed by value
            if (token.Length == 1)
            {
                // simple type we recognize
                char ch = token[0];
                if (ch == 'p')
                {
                    Pair p = new Pair();

                    if (_deserializationData[_current] != valueDelimiterChar)
                    {
                        p.First = DeserializeValueInternal();
                    }
                    _current++; // consume delimeter
                    if (_deserializationData[_current] != rightAngleBracketChar)
                    {
                        p.Second = DeserializeValueInternal();
                    }
                    value = p;
                }
                else if (ch == 't')
                {
                    Triplet t = new Triplet();

                    if (_deserializationData[_current] != valueDelimiterChar)
                    {
                        t.First = DeserializeValueInternal();
                    }
                    _current++; // consume delimeter
                    if (_deserializationData[_current] != valueDelimiterChar)
                    {
                        t.Second = DeserializeValueInternal();
                    }
                    _current++; // consume delimeter
                    if (_deserializationData[_current] != rightAngleBracketChar)
                    {
                        t.Third = DeserializeValueInternal();
                    }
                    value = t;
                }

                // Parse int32...
                else if (ch == 'i')
                {
                    value = Int32.Parse(ConsumeOneToken(), NumberFormat);
                }

                else if (ch == 'o')
                {
                    value = _deserializationData[_current] == 't';
                    _current++;  // consume t or f
                }

                // Parse arrayList...
                //
                else if (ch == 'l')
                {
                    ArrayList data = new ArrayList();

                    while (_deserializationData[_current] != rightAngleBracketChar)
                    {
                        object itemValue = null;
                        if (_deserializationData[_current] != valueDelimiterChar)
                        {
                            itemValue = DeserializeValueInternal();
                        }
                        data.Add(itemValue);
                        _current++; //consume the delimiter
                    }

                    value = data;
                }
                else if (ch == '@')
                {
                    // if we're here, length == 1 so this is a string array
                    value = ConsumeStringArray();
                }

                // Parse hashtable...
                //
                else if (ch == 'h')
                {
                    Hashtable data = new Hashtable();

                    while (_deserializationData[_current] != rightAngleBracketChar)
                    {
                        object key;
                        key = DeserializeValueInternal(); // hashtable key cannot be null

                        _current++;                       // consume delimiter
                        if (_deserializationData[_current] != valueDelimiterChar)
                        {
                            data[key] = DeserializeValueInternal();
                        }
                        else
                        {
                            data[key] = null;
                        }

                        _current++; // consume delimiter
                    }

                    value = data;
                }

                // base64 encoded...
                //
                else if (ch == 'b')
                {
                    string text = ConsumeOneToken();
                    byte[] serializedData;
                    serializedData = Convert.FromBase64String(text);

                    if (serializedData != null && serializedData.Length > 0)
                    {
                        System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                        value = formatter.Deserialize(new MemoryStream(serializedData));
                    }
                }

                // Parse typeconverter value ...
                //
                else
                {
                    // we have a typeref which is only one character long
                    value = ConsumeTypeConverterValue(token);
                }
            }
            else
            {
                // length > 1

                // Parse array...
                //
                if (token[0] == '@')
                {
                    // if we're here, length > 1 so we must have a type ref after the @
                    Type creatableType = TypeFromTypeRef(token.Substring(1));
                    value = ConsumeArray(creatableType);
                }

                // Parse typeconverter value ...
                //
                else
                {
                    // we have a typeref which is more than one character long
                    value = ConsumeTypeConverterValue(token);
                }
            }

            _current++; //consume right angle bracket
            return(value);
        }
示例#32
0
    protected ArrayList CreateClaims(Invoice invoice, InvoiceLine[] invoiceLines, Hashtable bulkHealthCardHash = null, Hashtable bulkRegisterStaffHash = null, Hashtable bulkStaffHash = null, Hashtable bulkSites = null, Hashtable bulkHealthCardActionsHash = null, Hashtable bulkEPCReferrersHash = null)
    {
        ArrayList claims = new ArrayList();

        invoice.Booking.Provider = StaffDB.GetByID(invoice.Booking.Provider.StaffID);

        bool[] isDuplicate = new bool[invoiceLines.Length];  // IF EITHER OF PREV OR NEXT IS SAME .. YES .. ELSE NO
        for (int i = 0; i < invoiceLines.Length; i++)
        {
            if (i == 0 && i == invoiceLines.Length - 1)
            {
                isDuplicate[i] = false;
            }
            else if (i == 0)
            {
                isDuplicate[i] = invoiceLines[i].Patient.PatientID == invoiceLines[i + 1].Patient.PatientID;
            }
            else if (i == invoiceLines.Length - 1)
            {
                isDuplicate[i] = invoiceLines[i].Patient.PatientID == invoiceLines[i - 1].Patient.PatientID;
            }
            else
            {
                isDuplicate[i] = invoiceLines[i].Patient.PatientID == invoiceLines[i + 1].Patient.PatientID || invoiceLines[i].Patient.PatientID == invoiceLines[i - 1].Patient.PatientID;
            }
        }



        for (int i = 0; i < invoiceLines.Length; i++)
        {
            InvoiceLine invoiceLine = invoiceLines[i];

            if (invoiceLine.Patient.PatientID == -1)
            {
                throw new HINXNoPatientOnInvoiceLineException("Invoice: " + invoice.InvoiceID + " Claim Nbr: " + invoice.HealthcareClaimNumber);
            }

            HealthCard hc = GetHealthCareCard(bulkHealthCardHash, invoiceLine.Patient.PatientID);  // usees bulk db result
            if (hc == null)
            {
                throw new HINXNoHealthcardException("Invoice: " + invoice.InvoiceID + " Claim Nbr: " + invoice.HealthcareClaimNumber + " InvoiceLine: " + invoiceLine.InvoiceLineID + " PT: " + invoiceLine.Patient.PatientID + "(" + invoiceLine.Patient.Person.FullnameWithoutMiddlename + ")");
            }
            System.Web.UI.Pair name = GetFirstLastNames(hc.CardName, invoiceLine.Patient);                                             // no db used
            string             staffProviderNumber = GetStaffProviderNumber(bulkRegisterStaffHash, bulkStaffHash, bulkSites, invoice); // usees bulk db result
            string             referrerProviderNbr = GetReferrerProviderNumber(bulkEPCReferrersHash, invoiceLine);                     // usees bulk db result

            DateTime epcSignedDate = DateTime.MinValue;                                                                                // not used for GP invoices
            if (invoice.Booking.Provider.Field.ID != 1)
            {
                epcSignedDate =                                                                                                             //claimType == ClaimType.DVA ? hc.DateReferralSigned :   // if aged care, use date signed as they never renew dva epc's. but in clinics, need to get most recent hc action date
                                GetEPCDateSigned(bulkHealthCardActionsHash, invoiceLine.Patient.PatientID, invoice.Booking.DateStart.Date); // usees bulk db result
            }
            // apparently it is still renewed.... so run the function GetEPCDateSigned(...) for both


            // -- start creating xml -- //

            XElement claim = new XElement("Claim");
            claim.Add(new XElement("TypeOfService", this.claimType == ClaimType.Medicare ? "M" : "V"));
            if (this.claimType == ClaimType.DVA)
            {
                claim.Add(new XElement("VaaServiceTypeCde", "J"));
            }
            claim.Add(new XElement("ServiceTypeCde", invoice.Booking.Provider.Field.ID == 1 ? "G" : "S"));
            claim.Add(new XElement("ExtServicingDoctor", staffProviderNumber));


            XElement voucher = new XElement("Voucher");
            voucher.Add(new XElement("BenefitAssignmentAuthorised", "Y"));
            voucher.Add(new XElement("ExternalPatientId", invoiceLine.Patient.PatientID));
            voucher.Add(new XElement("ExternalInvoice", invoice.InvoiceID));
            voucher.Add(new XElement("PatientFamilyName", ((string)name.Second).ToUpper()));
            voucher.Add(new XElement("PatientFirstName", ((string)name.First).ToUpper()));
            voucher.Add(new XElement("PatientDateOfBirth", invoiceLine.Patient.Person.Dob == DateTime.MinValue ? "" : invoiceLine.Patient.Person.Dob.ToString("dd'/'MM'/'yyyy")));
            if (this.claimType == ClaimType.DVA && invoiceLine.Patient.Person.Gender.Length > 0)
            {
                voucher.Add(new XElement("PatientGender", invoiceLine.Patient.Person.Gender));
            }
            voucher.Add(new XElement(this.claimType == ClaimType.Medicare ? "PatientMedicareCardNum" : "VeteranFileNum", hc.CardNbr));
            if (this.claimType == ClaimType.Medicare)
            {
                voucher.Add(new XElement("PatientReferenceNum", hc.CardFamilyMemberNbr));
            }
            voucher.Add(new XElement("DateOfService", invoice.Booking.DateStart.ToString("dd'/'MM'/'yyyy")));

            if (invoice.Booking.Provider.Field.ID != 1)  // if provider is not GP
            {
                voucher.Add(new XElement("ReferringProviderNum", referrerProviderNbr));
                voucher.Add(new XElement("ReferralIssueDate", epcSignedDate.ToString("dd'/'MM'/'yyyy")));
                voucher.Add(new XElement("ReferralPeriodTypeCde", "S"));
            }

            voucher.Add(new XElement("BClmAmt", invoiceLine.Price));

            /*
             * Used breifly in BEST, but removed 3 days after going live with this software.
             *
             * if (this.claimType == ClaimType.DVA && invoiceLine.Offering.OfferingType.ID == 398)  // DVA home visit
             * {
             *  //  home visits set to be so that
             *  // - first invoice line says it was for a home visit (ie offering type id = 398)
             *  // - next invoice line says if has a travel component (ie offering type id = 399) saying how many km's travelled and the visitation code
             *  //
             *  //  ie IF an invoice line has offering type 398 AND IF next invoice line has offering type 399, that is info belonging to first invoice line
             *  //  - so need to f*****g look at next invoice line
             *  //  - then when done this methods - skip that invoice line!!
             *
             *
             *  // in BEST he has to get the Offering.DvaVisitType code, and that points to a kpi id row and the code is in kpi descr
             *  // but as I explained in the definition of Create Table Offering, this is idiotic and we will store it directly in that field
             *  voucher.Add(new XElement("TreatmentLocationCde", invoiceLine.Offering.DvaVisitType));
             *
             *  // if has travel component
             *  if (i + 1 < invoiceLines.Length && invoiceLines[i + 1].Offering.OfferingType.ID == 399)
             *  {
             *      voucher.Add(new XElement("DistanceKms", invoiceLines[i + 1].Quantity));  // travel component is on next invoice line
             *      i++;  // move past this in list of invoice lines
             *  }
             * }
             */

            voucher.Add(new XElement("NumberItems", "1"));
            if (this.claimType == ClaimType.DVA)
            {
                voucher.Add(new XElement("TimeOfService", invoice.Booking.DateStart.ToString("HHmm")));
            }
            voucher.Add(AddServiceTag(invoiceLine, invoice, this.claimType, isDuplicate[i]));


            claim.Add(voucher);
            claims.Add(claim);
        }

        return(claims);
    }
示例#33
0
        public void GetPageControlsViewState()
        {
            System.Web.UI.HtmlControls.HtmlGenericControl VSHtml = new  System.Web.UI.HtmlControls.HtmlGenericControl();

            if (((Page)HttpContext.Current.Handler).Request.Form["__VIEWSTATE"] != null)
            {
                string vsInput  = ((Page)HttpContext.Current.Handler).Request.Form["__VIEWSTATE"].Replace("\n", "").Replace("\r", "");
                object vsObject = new LosFormatter().Deserialize(vsInput);
                // -Triplet.First
                // Get Page view state - the First object in the first Triplet
                VSHtml.InnerHtml = "<b>Page Data : </b><br>" + ParseViewState(((Triplet)vsObject).First, 1);
                // -Triplet.First - Page hash value
                // -Triplet.Second
                //               .First(Pair)
                //                          .First(ArrayList) - keys
                //                          .Second(ArrayList)- values
                // get the secound object of the first triplet, if the first object of that object is pair
                // it holds user viewstate. the first element in the pair is arraylist of keys and the second element in the pair
                // is the arraylist of values.
                Triplet Second = (Triplet)((Triplet)vsObject).Second;
                if (Second.First is System.Web.UI.Pair)
                {
                    System.Web.UI.Pair           oPair = (System.Web.UI.Pair)Second.First;
                    System.Collections.ArrayList oKeys = (System.Collections.ArrayList)oPair.First;
                    System.Collections.ArrayList oVals = (System.Collections.ArrayList)oPair.Second;
                    VSHtml.InnerHtml += "<br><b> User ViewState : </b><BR>";
                    for (int i = 0; i < oKeys.Count; i++)
                    {
                        VSHtml.InnerHtml += "\t Key=" + oKeys[i].ToString() + " Value=" + oVals[i].ToString() + "<br>";
                    }
                }
                // -Triplet.First - Page hash value
                // -Triplet.Second
                //               .First(Pair)
                //                          .First(ArrayList) - keys
                //                          .Second(ArrayList)- values
                //               .Third(ArrayList)
                //                                [X](Triplet)
                //                                            .Second(ArrayList) - array that holds the control
                //                                                                 Position in Form controls
                //                                                                 collection.
                //                                            .Third(ArrayList) - array that holds the viewstate
                //                                                                for every control from the upper
                //                                                                array.
                // get object list. first we get the third object that contains array of triplets
                ArrayList oArrObjectsAndData = (ArrayList)Second.Third;
                // loop thrhogou the array triplet
                for (int iObjAndData = 0; iObjAndData < oArrObjectsAndData.Count; iObjAndData++)
                {
                    // get the triplet second and third objects that contain list of control location in the form
                    // controls collection and the match entry in the third object contain the control ViewState.
                    Triplet   oTripControls = (Triplet)oArrObjectsAndData[iObjAndData];
                    ArrayList oArrObjects   = (ArrayList)oTripControls.Second;
                    ArrayList oArrData      = (ArrayList)oTripControls.Third;
                    for (int iCont = 0; iCont < oArrObjects.Count; iCont++)
                    {
                        // get the control ID
                        string ContID = GetForm().Controls[(int)oArrObjects[iCont]].ID;
                        // Get the control ViewState.
                        Triplet oTrip = (Triplet)oArrData[iCont];
                        VSHtml.InnerHtml += "<br><b>" + ContID + " : </b><BR>" + ParseViewState(oTrip, 5);
                    }
                }
                VSHtml.Visible = true;
                GetForm().Controls.Add(VSHtml);
            }
        }
 private object cc(object tipo)
 {
     if (tipo == null)
     {
         return(null);
     }
     if (esConocido(tipo))
     {
         return(tipo);
     }
     else if (tipo is System.Web.UI.Triplet)
     {
         System.Web.UI.Triplet triple = (System.Web.UI.Triplet)tipo;
         return(new seriable3(cc(triple.First), cc(triple.Second), cc(triple.Third)));
     }
     else if (tipo is System.Web.UI.Pair)
     {
         System.Web.UI.Pair par = (System.Web.UI.Pair)tipo;
         return(new seriable2(cc(par.First), cc(par.Second)));
     }
     else if (tipo is ArrayList)
     {
         ArrayList trans  = (ArrayList)tipo;
         ArrayList salida = new ArrayList(trans.Count);
         foreach (object x in trans)
         {
             salida.Add(cc(x));
         }
         return(salida);
     }
     else if (tipo is Array)
     {
         Array trans  = (Array)tipo;
         Array salida = Array.CreateInstance(tipo.GetType().GetElementType(), trans.Length);
         for (int x = 0; x < trans.Length; x++)
         {
             salida.SetValue(cc(trans.GetValue(x)), x);
         }
         return(salida);
     }
     else if (tipo is Hashtable)
     {
         IDictionaryEnumerator enumerator = ((Hashtable)tipo).GetEnumerator();
         Hashtable             salida     = new Hashtable();
         while (enumerator.MoveNext())
         {
             salida.Add(cc(enumerator.Key), cc(enumerator.Value));
         }
         return(salida);
     }
     else
     {
         Type valueType       = tipo.GetType();
         Type destinationType = typeof(string);
         bool flag;
         bool flag2;
         System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(valueType);
         if (((converter == null) || converter is System.ComponentModel.ReferenceConverter))
         {
             flag  = false;
             flag2 = false;
         }
         else
         {
             flag  = converter.CanConvertTo(destinationType);
             flag2 = converter.CanConvertFrom(destinationType);
         }
         if ((flag && flag2))
         {
             return(new generalCnv(valueType, converter.ConvertToInvariantString(tipo)));
         }
         else
         {
             return(tipo);
             //Salida General
         }
     }
 }
示例#35
0
			protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
			{
				Pair p = new Pair ();
				p.First = ReadObject (r, ctx);
				p.Second = ReadObject (r, ctx);
				return p;
			}
        /// <devdoc>
        /// Saves the total row count to cache.
        /// </devdoc>
        /*internal virtual void SaveTotalRowCountToCache(int totalRowCount) {
            string key = CreateMasterCacheKey();
            Cache.SaveDataToCache(key, totalRowCount);
        }*/

        /// <devdoc>
        /// Saves view state.
        /// </devdoc>
        protected override object SaveViewState() {
            Pair myState = new Pair();

            myState.First = base.SaveViewState();

            if (_view != null) {
                myState.Second = ((IStateManager)_view).SaveViewState();
            }

            if ((myState.First == null) &&
                (myState.Second == null)) {
                return null;
            }

            return myState;
        }
示例#37
0
        /// <include file='doc\LOSFormatter.uex' path='docs/doc[@for="LosFormatter.SerializeValue"]/*' />
        /// <devdoc>
        ///     Recursively serializes value into the writer.
        /// </devdoc>
        private void SerializeValue(TextWriter output, object value)
        {
            if (value == null)
            {
                return;
            }

            // First determine the type... either typeless (string), array,
            // typed array, hashtable, pair, triplet, knowntype, typetable reference, or
            // type...
            //

            // serialize string...
            //
            if (value is string)
            {
                WriteEscapedString(output, (string)value);
            }

            // serialize Int32...
            //
            else if (value is Int32)
            {
                output.Write('i');
                output.Write(leftAngleBracketChar);
                output.Write(((Int32)value).ToString(NumberFormat));
                output.Write(rightAngleBracketChar);
            }
            else if (value is Boolean)
            {
                output.Write('o');
                output.Write(leftAngleBracketChar);
                output.Write(((bool)value) ? 't' : 'f');
                output.Write(rightAngleBracketChar);
            }

            // serialize arraylist...
            //
            else if (value is ArrayList)
            {
                output.Write('l');
                output.Write(leftAngleBracketChar);

                ArrayList ar = (ArrayList)value;
                int       c  = ar.Count;
                for (int i = 0; i < c; i++)
                {
                    SerializeValue(output, ar[i]);
                    output.Write(valueDelimiterChar);
                }
                output.Write(rightAngleBracketChar);
            }

            // serialize hashtable...
            //
            else if (value is Hashtable)
            {
                output.Write('h');
                output.Write(leftAngleBracketChar);

                Hashtable table = (Hashtable)value;

                IDictionaryEnumerator e = table.GetEnumerator();
                while (e.MoveNext())
                {
                    SerializeValue(output, e.Key);
                    output.Write(valueDelimiterChar);

                    SerializeValue(output, e.Value);
                    output.Write(valueDelimiterChar);
                }
                output.Write(rightAngleBracketChar);
            }

            else
            {
                // we'll need the Type object for the last two possibilities
                Type valueType = value.GetType();
                Type strtype   = typeof(string);

                // serialize Pair
                if (valueType == typeof(Pair))
                {
                    Pair p = (Pair)value;
                    output.Write('p');
                    output.Write(leftAngleBracketChar);

                    SerializeValue(output, p.First);
                    output.Write(valueDelimiterChar);
                    SerializeValue(output, p.Second);
                    output.Write(rightAngleBracketChar);
                }

                // serialize Triplet
                //
                else if (valueType == typeof(Triplet))
                {
                    Triplet t = (Triplet)value;
                    output.Write('t');
                    output.Write(leftAngleBracketChar);

                    SerializeValue(output, t.First);
                    output.Write(valueDelimiterChar);
                    SerializeValue(output, t.Second);
                    output.Write(valueDelimiterChar);
                    SerializeValue(output, t.Third);
                    output.Write(rightAngleBracketChar);
                }

                // serialize array...
                //
                else if (valueType.IsArray)
                {
                    Type underlyingValueType;
                    underlyingValueType = valueType.GetElementType();

                    output.Write('@');

                    if (underlyingValueType != strtype)
                    {
                        // write type of array before elements
                        int typeId = GetTypeId(underlyingValueType);
                        WriteTypeId(output, typeId, underlyingValueType);

                        output.Write(leftAngleBracketChar);
                        Array ar = (Array)value;
                        for (int i = 0; i < ar.Length; i++)
                        {
                            SerializeValue(output, ar.GetValue(i));
                            output.Write(valueDelimiterChar);
                        }
                    }
                    else
                    {
                        // optimization: since we know the underlying values are strings,
                        // we can skip the recursive call to SerializeValue
                        output.Write(leftAngleBracketChar);
                        string[] ar = (string[])value;
                        for (int i = 0; i < ar.Length; i++)
                        {
                            WriteEscapedString(output, ar[i]);
                            output.Write(valueDelimiterChar);
                        }
                    }
                    output.Write(rightAngleBracketChar);
                }

                // serialize other value...
                //
                else
                {
                    int typeId = GetTypeId(valueType);

                    // get the type converter
                    TypeConverter tc = TypeDescriptor.GetConverter(valueType);

                    bool toString;
                    bool fromString;
                    if (tc == null || tc is ReferenceConverter)
                    {
                        toString   = false;
                        fromString = false;
                    }
                    else
                    {
                        toString   = tc.CanConvertTo(strtype);
                        fromString = tc.CanConvertFrom(strtype);
                    }

                    if (toString && fromString)
                    {
                        //we can convert to and from a string
                        WriteTypeId(output, typeId, valueType);

                        output.Write(leftAngleBracketChar);
                        WriteEscapedString(output, tc.ConvertToInvariantString(null, value));
                    }
                    else
                    {
                        // the typeconverter failed us, so we are resorting to binary serialization
                        MemoryStream ms = new MemoryStream();
                        System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                        try {
                            formatter.Serialize(ms, value);
                        }
                        catch (SerializationException) {
                            throw new HttpException(HttpRuntime.FormatResourceString(SR.Object_Must_Be_Serializable, value.GetType().FullName));
                        }

                        output.Write('b');
                        output.Write(leftAngleBracketChar);

                        // Since base64 doesn't have any chars that we escape, we can
                        // skip WriteEscapedString
                        output.Write(Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length));
                    }
                    output.Write(rightAngleBracketChar);
                }
            }
        }
示例#38
0
        protected override void DataBindInternal()
        {
            DataBindInternal(SkinDataField, ref _skinValue);

            DataBindInternal(ContainerDataField, ref _containerValue);

            Value = new Pair {First = _skinValue, Second = _containerValue};
        }
示例#39
0
        private void LoadChangedItemsFromViewState(object savedState)
        {
            Triplet triplet = (Triplet)savedState;

            if (triplet.Third is Pair)
            {
                Pair      third  = (Pair)triplet.Third;
                ArrayList first  = (ArrayList)triplet.First;
                ArrayList second = (ArrayList)triplet.Second;
                ArrayList list3  = (ArrayList)third.First;
                ArrayList list4  = (ArrayList)third.Second;
                for (int i = 0; i < first.Count; i++)
                {
                    int num2 = (int)first[i];
                    if (num2 < this.Count)
                    {
                        ((IStateManager)((IList)this)[num2]).LoadViewState(second[i]);
                    }
                    else
                    {
                        object obj2;
                        if (list3 == null)
                        {
                            obj2 = this.CreateKnownType(0);
                        }
                        else
                        {
                            int index = (int)list3[i];
                            if (index < this.GetKnownTypeCount())
                            {
                                obj2 = this.CreateKnownType(index);
                            }
                            else
                            {
                                string typeName = (string)list4[index - this.GetKnownTypeCount()];
                                obj2 = Activator.CreateInstance(Type.GetType(typeName));
                            }
                        }
                        ((IStateManager)obj2).TrackViewState();
                        ((IStateManager)obj2).LoadViewState(second[i]);
                        ((IList)this).Add(obj2);
                    }
                }
            }
            else
            {
                ArrayList list5 = (ArrayList)triplet.First;
                ArrayList list6 = (ArrayList)triplet.Second;
                ArrayList list7 = (ArrayList)triplet.Third;
                for (int j = 0; j < list5.Count; j++)
                {
                    int num5 = (int)list5[j];
                    if (num5 < this.Count)
                    {
                        ((IStateManager)((IList)this)[num5]).LoadViewState(list6[j]);
                    }
                    else
                    {
                        int num6 = 0;
                        if (list7 != null)
                        {
                            num6 = (int)list7[j];
                        }
                        object obj3 = this.CreateKnownType(num6);
                        ((IStateManager)obj3).TrackViewState();
                        ((IStateManager)obj3).LoadViewState(list6[j]);
                        ((IList)this).Add(obj3);
                    }
                }
            }
        }