public ModuleControl(Guid moduleID, String fileName)
 {
     Dictionary<string, object> parameters = new Dictionary<string,object>();
     parameters.Add("moduleID", moduleID);
     parameters.Add("fileName", fileName);
     this.DataManager.Load(parameters);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Logs a session and returns session information on success.
        /// </summary>
        public static void LogSession(MonoBehaviour mb, ClientArgs args, Guid userId, string detail, string revisionId, Action<Guid, string> onSuccess, Action<string> onFailure)
        {
            var data = new Dictionary<string, object>();
            data.Add("user_id", userId);
            data.Add("release_id", args.ReleaseId);
            // XXX (kasiu): Need to check if this is the right DateTime string to send. I THINK THIS IS WRONG BUT I DON'T GIVE A FOOBAR RIGHT NOW. FIXME WHEN THE SERVER SCREAMS.
            data.Add("client_time", DateTime.Now.ToString());
            data.Add("detail", detail);
            data.Add("library_revid", revisionId);

            // Processing to get session_id
            Action<string> callback = s => {
                var s2 = s.Replace("{", "").Replace("}", "").Replace("\"", "").Trim();
                var split = s2.Split(',');
                if (split.Length != 2) {
                    onFailure(string.Format("LogSession received ill-formatted JSON: {0}", s));
                }
                var sessionId = split[0].Split(':')[1].Trim();
                var sessionKey = split[1].Split(':')[1].Trim();

                onSuccess(new Guid(sessionId), sessionKey);
            };

            var newArgs = new ClientArgs(new Uri(args.BaseUri, "/api/session"), args);
            SendNonSessionRequest(mb, newArgs, data, callback, onFailure);
        }
        public void TestOtherIdMappings()
        {
            String otherIdMapping = "<agent id=\"Repro\" sifVersion=\"2.0\">"
                                    + "    <mappings id=\"Default\">"
                                    + "        <object object='StudentPersonal'>"
                                    +
                                    "            <field direction='inbound' name='FIELD1'><otherid type='ZZ' prefix='FIELD1:'/></field>"
                                    +
                                    "            <field direction='outbound' name='FIELD1'>OtherIdList/OtherId[@Type='ZZ'+]=FIELD1:$(FIELD1)</field>"
                                    +
                                    "            <field direction='inbound' name='FIELD2'><otherid type='ZZ' prefix='FIELD2:'/></field>"
                                    +
                                    "            <field direction='outbound' name='FIELD2'>OtherIdList/OtherId[@Type='ZZ'+]=FIELD2:$(FIELD2)</field>"
                                    + "        </object>" + "    </mappings>" + "</agent>";

            Dictionary<String, String> sourceMap = new Dictionary<String, String>();
            sourceMap.Add( "FIELD1", "1234" );
            sourceMap.Add( "FIELD2", "5678" );
            StringMapAdaptor sma = new StringMapAdaptor( sourceMap );
            StudentPersonal sp = mapToStudentPersonal( sma, otherIdMapping, null );
            Assertion.AssertNotNull( "Student should not be null", sp );

            IDictionary destinationMap = doInboundMapping( otherIdMapping, sp );
            assertMapsAreEqual( sourceMap, destinationMap );
        }
        public ActionResult GetMerchantHashKey()
        {
            try
            {
                long mid = 1000179;
                //### 透過WebService取得Key與IV
                ApiWS.ApiWSSoapClient WS = new ApiWS.ApiWSSoapClient();
                ApiWS.AllPayMerchantFunction merchantFunction = WS.GetAllPayMerchantFunctionByMerchant(mid);

                Dictionary<string, string> postCollection = new Dictionary<string, string>();
                postCollection.Add("MerchantID", mid.ToString());
                postCollection.Add("XMLData", "tXrjXcgaYAHCE4QIKuDAcuuDKprFV0kXfIrsUWk45RvnYGwXPOkoG8/PHVkUnZvhmzcnceccITG43H1PwnWctlVL43s7Aow8HU8HJmYiuI/Q/MaWX+5yd1zGhuhKMzR/wpJzjEzYyn9ZBErGru+4W69aEHQg/LheV2Yl5Ln0DiP8SKpSiZZPCge2vULAMJYvMlf9qfa5Dhd7x3uuf8BirnCSg6MxIMBnaftx7B2HjCQi+gQeo9n4cJ9JUucWHf3BWgRyTGgPeLF/kxfWEjXmkcpsSEfDqxeFUEQzt7PjHmmqqCUd8Kg5VDJmdBo3Rrz9iMtd3MpV4vAj5I4aIttfGdW4PYCJSmzC4jpopQOD7mRyCwX5iFFfN6hGgSYKvBzxhAvoPQ6/8SYaInS/nvvjzawEYjEC7OWjJFZx0InLAKPA6Wr1q8nG0SZXocvt+HtTi8prBepMiZTYwyaJYCXKZQ==");

                Hashtable RequestTable = new Hashtable();

                foreach (var item in postCollection)
                {
                    RequestTable.Add(item.Key, item.Value);

                }


                //### 發送到Mp, 取得Response
                string ServerResponse = DoRequest("http://payment-stage.allpay.com.tw/cashier/OrderChangeConfirm", RequestTable);

                ViewBag.SendResult = ServerResponse;

                return null;
            }
            catch (Exception e)
            {              
                throw e;
            }
        }
Exemplo n.º 5
0
        public IList<MstIndexModels> GetIndexMasterList(string indexCode, string indexName, string indexTypeCode, string securityType, string term)
        {
            Dictionary<string, object> param = new Dictionary<string, object>();
            if (!StringUtils.IsEmpty(indexCode))
            {
                param.Add("indexCode", indexCode);
            }
            if (!StringUtils.IsEmpty(term))
            {
                param.Add("term", term);
            }
            if (!StringUtils.IsEmpty(indexName))
            {
                param.Add("indexName", indexName);
            }
            if (!StringUtils.IsEmpty(indexTypeCode))
            {
                param.Add("indexTypeCode", indexTypeCode);
            }
            if (!StringUtils.IsEmpty(securityType))
            {
                param.Add("securityType", securityType);
            }
            param.Add("indexStatus", Constants.Status.Active);

            IList<MstIndexModels> result = mapper.QueryForList<MstIndexModels>("Master.selectIndexMaster", param);
            return result;
        }
Exemplo n.º 6
0
        private void CreateTransitionTable()
        {
            _transitions = new Dictionary<MenuItemID, ScreenID>();

            //Opening screen transitions
            _transitions.Add(MenuItemID.OPENING_SCREEN_NEW_GAME, ScreenID.NEW_GAME_SCREEN);
            _transitions.Add(MenuItemID.OPENING_SCREEN_LOAD_GAME, ScreenID.LOAD_GAME_SCREEN);
            _transitions.Add(MenuItemID.OPENING_SCREEN_SETTINGS, ScreenID.SETTINGS_SCREEN);
            _transitions.Add(MenuItemID.OPENING_SCREEN_SCORES, ScreenID.SCORES_SCREEN);
            _transitions.Add(MenuItemID.OPENING_SCREEN_CREDITS, ScreenID.CREDITS_SCREEN);
            _transitions.Add(MenuItemID.OPENING_SCREEN_QUIT, ScreenID.QUIT_SCREEN);

            //New game screen's transitions
            _transitions.Add(MenuItemID.NEW_GAME_SCREEN_BACK, ScreenID.OPENING_SCREEN);

            //Load game screen's transitions
            _transitions.Add(MenuItemID.LOAD_GAME_SCREEN_BACK, ScreenID.OPENING_SCREEN);

            //Settings screen's transitions
            _transitions.Add(MenuItemID.SETTINGS_SCREEN_BACK, ScreenID.OPENING_SCREEN);

            //Scores screen's transitions
            _transitions.Add(MenuItemID.SCORES_SCREEN_BACK, ScreenID.OPENING_SCREEN);

            //Credits screen's transitions
            _transitions.Add(MenuItemID.CREDITS_SCREEN_BACK, ScreenID.OPENING_SCREEN);

            //Quit screen transitions
            _transitions.Add(MenuItemID.QUIT_SCREEN_CANCEL, ScreenID.OPENING_SCREEN);
        }
Exemplo n.º 7
0
		// Static Initializer
		
		static WebHeaderCollection () 
		{
			// the list of restricted header names as defined 
			// by the ms.net spec
			restricted = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
						    CaseInsensitiveComparer.DefaultInvariant);

			restricted.Add ("accept", true);
			restricted.Add ("connection", true);
			restricted.Add ("content-length", true);
			restricted.Add ("content-type", true);
			restricted.Add ("date", true);
			restricted.Add ("expect", true);
			restricted.Add ("host", true);
			restricted.Add ("if-modified-since", true);
			restricted.Add ("range", true);
			restricted.Add ("referer", true);
			restricted.Add ("transfer-encoding", true);
			restricted.Add ("user-agent", true);			
			restricted.Add ("proxy-connection", true);			

			//
			restricted_response = new Dictionary<string, bool> (StringComparer.InvariantCultureIgnoreCase);
			restricted_response.Add ("Content-Length", true);
			restricted_response.Add ("Transfer-Encoding", true);
			restricted_response.Add ("WWW-Authenticate", true);

			// see par 14 of RFC 2068 to see which header names
			// accept multiple values each separated by a comma
			multiValue = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
						    CaseInsensitiveComparer.DefaultInvariant);

			multiValue.Add ("accept", true);
			multiValue.Add ("accept-charset", true);
			multiValue.Add ("accept-encoding", true);
			multiValue.Add ("accept-language", true);
			multiValue.Add ("accept-ranges", true);
			multiValue.Add ("allow", true);
			multiValue.Add ("authorization", true);
			multiValue.Add ("cache-control", true);
			multiValue.Add ("connection", true);
			multiValue.Add ("content-encoding", true);
			multiValue.Add ("content-language", true);			
			multiValue.Add ("expect", true);		
			multiValue.Add ("if-match", true);
			multiValue.Add ("if-none-match", true);
			multiValue.Add ("proxy-authenticate", true);
			multiValue.Add ("public", true);			
			multiValue.Add ("range", true);
			multiValue.Add ("transfer-encoding", true);
			multiValue.Add ("upgrade", true);
			multiValue.Add ("vary", true);
			multiValue.Add ("via", true);
			multiValue.Add ("warning", true);
			multiValue.Add ("www-authenticate", true);

			// Extra
			multiValue.Add ("set-cookie", true);
			multiValue.Add ("set-cookie2", true);
		}
Exemplo n.º 8
0
 /* Find first character which is not repetitve in string
  * if string has length n, it may need n*n time O(n).
  * Let's find a better algorithm
  * First, make Hash table that saves the number of character appears in string
  * 	for each char
  * 		if, not saved value for the char, save 1
  * 		else, value++;
  * Second, lookup character
  *  for each char
  *  	if, the number of appears = 1, return char
  *      else, 1 not exists, return null
  */
 public static char FindFirstChar(string str)
 {
     Dictionary<char,int> table = new Dictionary<char, int>();
     int length = str.Length;
     char c;
     int i;
     for (i = 0; i< length; i++)
     {
         c = str[i];
         if (table.ContainsKey (c)) {
             int temp = table [c];
             table.Remove (c);
             table.Add (c, temp+1);
         } else {
             table.Add (c, 1);
         }
     }
     for ( i = 0; i<length; i++)
     {
         c = str[i];
         if (table [c] == 1) {
             return c;
         }
     }
     char Null = '\0';
     return Null;
 }
Exemplo n.º 9
0
        internal KeywordCollection(Scintilla scintilla)
            : base(scintilla)
        {
            //	Auugh, this plagued me for a while. Each of the lexers cna define their own "Name"
            //	and also asign themsleves to a Scintilla Lexer Constant. Most of the time these
            //	match the defined constant, but sometimes they don't. We'll always use the constant
            //	name since it's easier to use, consistent and will always have valid characters.
            //	However its still valid to access the lexers by this name (as SetLexerLanguage
            //	uses this value) so we'll create a lookup.
            _lexerAliasMap = new Dictionary<string, Lexer>(StringComparer.OrdinalIgnoreCase);

            //	I have no idea how Progress fits into this. It's defined with the PS lexer const
            //	and a name of "progress"

            _lexerAliasMap.Add("PL/M", Lexer.Plm);
            _lexerAliasMap.Add("props", Lexer.Properties);
            _lexerAliasMap.Add("inno", Lexer.InnoSetup);
            _lexerAliasMap.Add("clarion", Lexer.Clw);
            _lexerAliasMap.Add("clarionnocase", Lexer.ClwNoCase	);

            //_lexerKeywordListMap = new Dictionary<string,string[]>(StringComparer.OrdinalIgnoreCase);

            //_lexerKeywordListMap.Add("xml", new string[] { "HTML elements and attributes", "JavaScript keywords", "VBScript keywords", "Python keywords", "PHP keywords", "SGML and DTD keywords" });
            //_lexerKeywordListMap.Add("yaml", new string[] { "Keywords" });
            //	baan, kix, ave, scriptol, diff, props, makefile, errorlist, latex, null, lot, haskell
            //	lexers don't have keyword list names
        }
Exemplo n.º 10
0
        public int insertFee(String feeDesc, Double feeAmount, ArrayList memberTypeNo, int Status)
        {
            int resultInner = 0;
             DAL dal = new DAL(ConfigurationManager.ConnectionStrings["CMS"].ConnectionString);
             String sql = "EXEC insertFee @feeDesc, @Amount, @Status;";
             Dictionary<String, Object> parameters = new Dictionary<string, object>();
             parameters.Add("@feeDesc", feeDesc);
             parameters.Add("@Amount", feeAmount);
             parameters.Add("@Status", Status);
             int result = Convert.ToInt32(dal.executeNonQuery(sql, parameters));
             Object rs = dal.executeScalar("SELECT @@IDENTITY");     //problem area
             int id = int.Parse(rs.ToString());
             if (id != 0)
             {

                 foreach (int i in memberTypeNo)
                 {
                     String sqlInner = "INSERT INTO MEMBER_TYPE_FEE (MemberTypeNo, FeeId) VALUES (@memberTypeNo, @feeId)";
                     Dictionary<String, Object> parametersInner = new Dictionary<string, object>();
                     parametersInner.Add("@memberTypeNo", i);
                     parametersInner.Add("@feeId", id);
                     resultInner = Convert.ToInt32(dal.executeNonQuery(sqlInner, parametersInner));
                 }

             }

             return resultInner;
        }
Exemplo n.º 11
0
        private object GenerateUsageReport(IUnitOfWork uow, DateRange dateRange, int start,
            int length, out int count)
        {
            _dataUrlMappings = new Dictionary<string, string>();
            _dataUrlMappings.Add("BookingRequest", "/Dashboard/Index/");
            _dataUrlMappings.Add("Email", "/Dashboard/Index/");
            _dataUrlMappings.Add("User", "/User/Details?userID=");


            var factDO = uow.FactRepository.GetQuery().WhereInDateRange(e => e.CreateDate, dateRange);

            count = factDO.Count();

            return factDO
                .OrderByDescending(e => e.CreateDate)
                .Skip(start)
                .Take(length)
                .AsEnumerable()
                .Select(
                    f => new
                        {
                            PrimaryCategory = f.PrimaryCategory,
                            SecondaryCategory = f.SecondaryCategory,
                            Activity = f.Activity,
                            Status = f.Status,
                            Data = AddClickability(f.Data),
                            CreateDate = f.CreateDate.ToString(DateStandardFormat),
                        })
                .ToList();

        }
Exemplo n.º 12
0
        /// <summary>
        ///     Overrides the Format method for log4net's layout
        /// </summary>
        /// <param name="writer">The text writer</param>
        /// <param name="loggingEvent">The logging event</param>
        public override void Format(TextWriter writer, LoggingEvent loggingEvent)
        {
            var dictionary = new Dictionary<string, object>();

            // Add the main properties
            dictionary.Add("timestamp", loggingEvent.TimeStamp);
            dictionary.Add("level", loggingEvent.Level != null ? loggingEvent.Level.DisplayName : "null");
            dictionary.Add("message", loggingEvent.RenderedMessage);
            dictionary.Add("logger", loggingEvent.LoggerName);

            // Loop through all other properties
            foreach (DictionaryEntry dictionaryEntry in loggingEvent.GetProperties())
            {
                var key = dictionaryEntry.Key.ToString();

                // Check if the key exists
                if (!dictionary.ContainsKey(key))
                {
                    dictionary.Add(key, dictionaryEntry.Value);
                }
            }

            // Convert the log string into a JSON string
            var logString = JsonConvert.SerializeObject(dictionary);

            writer.WriteLine(logString);
        }
 public OAuthAccessToken AuthOauthCheckToken(string oauthToken)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.auth.oauth.checkToken");
     dictionary.Add("oauth_token", oauthToken);
     return GetResponse<OAuthAccessToken>(dictionary);
 }
Exemplo n.º 14
0
        public void Initialize()
        {
            // Create some items and place them in a dictionary
            // Add some include information so that when we check the final 
            // item spec we can verify that the item was recreated properly
            BuildItem[] buildItems = new BuildItem[1];
            buildItems[0] = new BuildItem("BuildItem1", "Item1");
            Dictionary<object, object> dictionary1 = new Dictionary<object, object>();
            dictionary1.Add("Target1", buildItems);
            Hashtable resultsByTarget1 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultsByTarget1.Add("Target1", Target.BuildState.CompletedSuccessfully);

            Dictionary<object, object> dictionary2 = new Dictionary<object, object>();
            dictionary2.Add("Target2", buildItems);
            dictionary2.Add("Target3", null);
            Hashtable resultsByTarget2 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultsByTarget2.Add("Target2", Target.BuildState.CompletedSuccessfully);
            resultsByTarget2.Add("Target3", Target.BuildState.CompletedSuccessfully);

            Dictionary<object, object> dictionary3 = new Dictionary<object, object>();
            dictionary3.Add("Target4", buildItems);
            Hashtable resultsByTarget3 = new Hashtable(StringComparer.OrdinalIgnoreCase);
            resultsByTarget3.Add("Target4", Target.BuildState.Skipped);

            resultWith0Outputs = new BuildResult(new Hashtable(), new Hashtable(StringComparer.OrdinalIgnoreCase), true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            resultWith1Outputs = new BuildResult(dictionary1, resultsByTarget1, true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            resultWith2Outputs = new BuildResult(dictionary2, resultsByTarget2, true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
            uncacheableResult = new BuildResult(dictionary3, resultsByTarget3, true, 1, 1, 2, true, string.Empty, string.Empty, 0, 0, 0);
        }
Exemplo n.º 15
0
        public Dictionary<string, string> GetFeaturedItem(string SectionId)
        {
            SqlDataReader myDA = null;
            connection = new SqlConnection(is_dsn);
            connection.Open();
            selectCommand = new SqlCommand();
            string strStatement;
            strStatement = "select * from tblPortfolio p join tblFeaturedItems f on p.ItemId = f.ItemId left join tblExpandText e on p.ItemExpandId = e.ExpandId where f.sectionId = @strSectionId";
            selectCommand = new SqlCommand(strStatement, connection);
            //selectCommand.CommandType = CommandType.StoredProcedure;
            selectCommand.Parameters.AddWithValue("@strSectionId", SectionId);
            myDA = selectCommand.ExecuteReader(CommandBehavior.CloseConnection);

            Dictionary<string, string> list = new Dictionary<string, string>();
            while (myDA.Read())
            {
                list.Add("ItemId", myDA["ItemId"].ToString());
                list.Add("ItemTitle", myDA["ItemTitle"].ToString());
                list.Add("ItemDate", myDA["ItemDate"].ToString());
                list.Add("ItemLanguages", myDA["ItemLanguages"].ToString());
                list.Add("ItemDescription", myDA["ItemDescription"].ToString());
                list.Add("ItemImageName", myDA["ItemImageName"].ToString());
                list.Add("ItemFolderName", myDA["ItemFolderName"].ToString());
                list.Add("ItemWebUrl", myDA["ItemWebUrl"].ToString());
                list.Add("ItemCodeUrl", myDA["ItemCodeUrl"].ToString());
                list.Add("ExpandText", myDA["ExpandText"].ToString());
            }
            connection.Close();
            return list;
        }
 private static Dictionary<string, string> GetProperties(LogInfo logInfo)
 {
     var prop = new Dictionary<string, string>();
     prop.AddIfNotNull("TypeKey", logInfo.LogTypeKey);
     prop.AddIfNotNull("ConfigID", logInfo.LogConfigID);
     prop.AddIfNotNull("FileID", logInfo.LogFileID);
     prop.AddIfNotNull("GUID", logInfo.LogGUID);
     prop.AddIfNotNull("PortalName", logInfo.LogPortalName);
     prop.AddIfNotNull("ServerName", logInfo.LogServerName);
     prop.AddIfNotNull("UserName", logInfo.LogUserName);
     prop.Add("CreateDate", logInfo.LogCreateDate.ToString(CultureInfo.InvariantCulture));
     prop.Add("EventID", logInfo.LogEventID.ToString());
     prop.Add("PortalID", logInfo.LogPortalID.ToString());
     prop.Add("UserID", logInfo.LogUserID.ToString());
     prop.AddIfNotNull("Exception.Message", logInfo.Exception.Message);
     prop.AddIfNotNull("Exception.Source", logInfo.Exception.Source);
     prop.AddIfNotNull("Exception.StackTrace", logInfo.Exception.StackTrace);
     prop.AddIfNotNull("Exception.InnerMessage", logInfo.Exception.InnerMessage);
     prop.AddIfNotNull("Exception.InnerStackTrace", logInfo.Exception.InnerStackTrace);
     if (logInfo.LogProperties != null)
     {
         prop.AddIfNotNull("Summary", logInfo.LogProperties.Summary);
         foreach (LogDetailInfo logProperty in logInfo.LogProperties)
         {
             prop.Add(logProperty.PropertyName, logProperty.PropertyValue);
         }
     }
     return prop;
 } 
Exemplo n.º 17
0
        public int insertloanCharge(String chargeName, double amount, String amountStatus, ArrayList loanTypeNo, int Status)
        {
            int id = 0;
             int resultInner = 0;
             DAL dal = new DAL(ConfigurationManager.ConnectionStrings["CMS"].ConnectionString);
             String sql = "EXEC insertCharges @Status, @ChargeName, @Amount, @AmountStatus, @isArchived";
             Dictionary<String, Object> parameters = new Dictionary<string, object>();
             parameters.Add("@Status", Status);
             parameters.Add("@ChargeName", chargeName);
             parameters.Add("@Amount", amount);
             parameters.Add("@AmountStatus", amountStatus);
             parameters.Add("@isArchived", 0);
             int result = Convert.ToInt32(dal.executeNonQuery(sql, parameters));

             String sqlSelect = "Select ChargeId from CHARGES where isArchived=0 and ChargeName= " + "'" + chargeName + "'";
             id = Convert.ToInt32(dal.executeScalar(sqlSelect));

             if (result != 0)
             {

                 foreach (int i in loanTypeNo)
                 {
                     String sqlInner = "INSERT INTO LOAN_TYPE_CHARGES VALUES (@LoanTypeId, @ChargeId)";
                     Dictionary<String, Object> parametersInner = new Dictionary<string, object>();
                     parametersInner.Add("@LoanTypeId", i);
                     parametersInner.Add("@ChargeId", id);
                     resultInner = Convert.ToInt32(dal.executeNonQuery(sqlInner, parametersInner));
                 }

             }

             return resultInner;
        }
Exemplo n.º 18
0
		public void FixtureSetup()
		{
			props = new Dictionary<string, string>();
			props.Add("expiration", 120.ToString());
			props.Add("priority", 4.ToString());
			provider = new SysCacheProvider();
		}
Exemplo n.º 19
0
 public File(Guid controllerID, String fileName)
 {
     Dictionary<string, object> parameters = new Dictionary<string,object>();
     parameters.Add("controllerID", controllerID);
     parameters.Add("fileName", fileName);
     this.DataManager.Load(parameters);
 }
Exemplo n.º 20
0
 private void ContextMenuClick(object userData, string[] options, int selected)
 {
     if (selected >= 0)
     {
         string key = this.dropDownMenuItems[selected];
         if (key != null)
         {
             int num;
             if (<>f__switch$map12 == null)
             {
                 Dictionary<string, int> dictionary = new Dictionary<string, int>(2);
                 dictionary.Add("Compare", 0);
                 dictionary.Add("Compare Binary", 1);
                 <>f__switch$map12 = dictionary;
             }
             if (<>f__switch$map12.TryGetValue(key, out num))
             {
                 if (num == 0)
                 {
                     this.DoShowDiff(false);
                 }
                 else if (num == 1)
                 {
                     this.DoShowDiff(true);
                 }
             }
         }
     }
 }
        public WebApiRaygunRequestMessage(HttpRequestMessage request)
        {
            HostName = request.RequestUri.Host;
            Url = request.RequestUri.AbsolutePath;
            HttpMethod = request.Method.ToString();
            Headers = new Dictionary<string, string>();

            foreach (var header in request.Headers)
            {
                Headers.Add(header.Key, string.Join(",", header.Value));
            }
            IPAddress = request.GetClientIpAddress();

            if (request.Content.Headers.ContentLength.HasValue && request.Content.Headers.ContentLength.Value > 0)
            {

                foreach (var header in request.Content.Headers)
                {
                    Headers.Add(header.Key, string.Join(",", header.Value));
                }

                try
                {
                    RawData = request.Content.ReadAsStringAsync().Result;
                }
                catch (Exception)
                {
                }
            }
        }
Exemplo n.º 22
0
        public void Insert()
        {
            TableBatchOperation batchOperation = new TableBatchOperation();
            Hashtable bank = new Hashtable();

            for (int i = id; i < id + 100 && i < Program._DATA_TABLE.Rows.Count; i++)
            {
                if (!bank.ContainsKey(Program._DATA_TABLE.Rows[i]["ID"].ToString().Trim()))
                {
                    try
                    {
                        DynamicTableEntity data = new DynamicTableEntity();
                        data.PartitionKey = "88888888";
                        data.RowKey = Program._DATA_TABLE.Rows[i]["ID"].ToString().Trim().PadLeft(6, '0');
                        Dictionary<string, EntityProperty> properties = new Dictionary<string, EntityProperty>();

                        properties.Add("Bank", new EntityProperty(Program._DATA_TABLE.Rows[i]["Bank"].ToString().Trim()));
                        properties.Add("BranchName", new EntityProperty(Program._DATA_TABLE.Rows[i]["BranchName"].ToString().ToLower().Trim()));
                        properties.Add("AccountNumber", new EntityProperty(Program._DATA_TABLE.Rows[i]["AccountNumber"].ToString().Trim()));
                        properties.Add("AccountName", new EntityProperty(Program._DATA_TABLE.Rows[i]["AccountName"].ToString().Trim()));
                        properties.Add("AccountType", new EntityProperty(int.Parse(Program._DATA_TABLE.Rows[i]["AccountType"].ToString().Trim())));

                        //BankEntity data = new BankEntity("88888888", Program._DATA_TABLE.Rows[i]["ID"].ToString().Trim().PadLeft(6, '0'));
                        //data.Bank = Program._DATA_TABLE.Rows[i]["Bank"].ToString().Trim();
                        //data.BranchName = Program._DATA_TABLE.Rows[i]["BranchName"].ToString().ToLower().Trim();
                        //data.AccountNumber = Program._DATA_TABLE.Rows[i]["AccountNumber"].ToString().Trim();
                        //data.AccountName = Program._DATA_TABLE.Rows[i]["AccountName"].ToString().Trim();
                        //data.AccountType = int.Parse(Program._DATA_TABLE.Rows[i]["AccountType"].ToString().Trim());
                        batchOperation.InsertOrMerge(data);
                        recBank++;
                        bank[Program._DATA_TABLE.Rows[i]["ID"].ToString().Trim()] = true;
                    }
                    catch { }
                }
            }

            try
            {
                if (Program._DATA_TABLE.Rows.Count > 0)
                {
                    if (Program._UPDATE)
                    {
                        Program._RECORD++;
                        Console.WriteLine("Update Record {0}-{1}\t\tTotal {2} Records", id + 1, id + 100, Program._RECORD * 100);
                        Program._CLOUD_TABLE.ExecuteBatch(batchOperation);
                    }
                    else
                    {
                        Program._RECORD++;
                        Console.WriteLine("Insert Record {0}-{1}\t\tTotal {2} Records", id + 1, id + 100, Program._RECORD * 100);
                        Program._CLOUD_TABLE.ExecuteBatch(batchOperation);
                    }
                }

            }
            catch (Exception e)
            {
                Program.WriteErrorLog("Record " + (id + 1) + "-" + (id + 100) + " Error \n" + e.Message + "\n" + e.StackTrace);
            }
        }
Exemplo n.º 23
0
        public void initialise (IBillingServiceCallback callback) {
            this.callback = callback;
            if (null == publicKey || publicKey.Equals ("[Your key]")) {
                callback.logError (UnibillError.GOOGLEPLAY_PUBLICKEY_NOTCONFIGURED, publicKey);
                callback.onSetupComplete (false);
                return;
            }

            var encoder = new Dictionary<string, object>();
            encoder.Add ("publicKey", this.publicKey);
            var productIds = new List<string>();
            List<object> products = new List<object>();
            foreach (var item in db.AllPurchasableItems) {
                Dictionary<string, object> product = new Dictionary<string, object>();
                var id = remapper.mapItemIdToPlatformSpecificId(item);
                productIds.Add(id);
                product.Add ("productId", id);
                product.Add ("consumable", item.PurchaseType == PurchaseType.Consumable);
                products.Add (product);
            }
            encoder.Add("products", products);

            var json = encoder.toJson();
            rawInterface.initialise(this, json, productIds.ToArray());
        }
Exemplo n.º 24
0
        public static Dictionary<string, object> GetBsonElementAttributeList(object obj)
        {
            var result = new Dictionary<string, object>();
            var type = obj.GetType();
            var properties = type.GetProperties();
            foreach (var item in properties)
            {
                var atributeList = System.Attribute.GetCustomAttributes(item);
                var atribute = atributeList.OfType<BsonElementAttribute>().FirstOrDefault();
                if (atribute != null)
                {
                    var name = atribute.ElementName;
                    if (item.PropertyType.Name == typeof (IList<MongoDBRef>).Name)
                    {
                        var list = (IList<MongoDBRef>) type.GetProperty(item.Name).GetValue(obj, null);
                        result.Add(name, list.Count == 0 ? new MongoDBRef[0] : list);
                    }
                    else
                    {
                        result.Add(name, type.GetProperty(item.Name).GetValue(obj, null));
                    }
                }

            }

            return result;
        }
Exemplo n.º 25
0
        public global::NHibernate.Cfg.Configuration GetCfg(string[] addAssemblies)
        {
            SessionFactoryImpl sessionFactoryImpl = SpringHelper.ApplicationContext["NHibernateSessionFactory"] as SessionFactoryImpl;
            IDictionary springObjectDic = getSpringObjectPropertyValue("NHibernateSessionFactory", "HibernateProperties") as IDictionary;
            IDictionary<string, string> dic = new Dictionary<string, string>();
            foreach (DictionaryEntry de in springObjectDic)
            {
                dic.Add(de.Key.ToString(), de.Value.ToString());
                //if (de.Key.ToString().Equals("hibernate.dialect"))
                //{
                //    dialectName = de.Value.ToString();
                //}
            }

            #region //真正抓取設定檔的內容
            ISession session = sessionFactoryImpl.OpenSession();
            string connectionStr = session.Connection.ConnectionString;
            #endregion

            dic.Add("connection.connection_string", connectionStr);
            Configuration cfg = new Configuration();
            cfg.AddProperties(dic);

            foreach (string assembly in addAssemblies)
            {
                cfg.AddAssembly(assembly);
            }

            return cfg;
        }
        public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            ExpandoObject expando = (ExpandoObject)obj;

            if (expando != null) {
                // Create the representation.
                Dictionary<string, object> result = new Dictionary<string, object>();
                foreach (KeyValuePair<string, object> item in expando) {
                    var value = item.Value ?? "";
                    if (value is DateTime)

                        result.Add(item.Key, ((DateTime)value).ToShortDateString());
                    else if (value is ExpandoObject) {
                        var ser = new JavaScriptSerializer();
                        ser.RegisterConverters(new []{new ExpandoObjectConverter()});
                        var res = ser.Serialize(value);
                        result.Add(item.Key, res);
                    } else {
                        var collection = value as ICollection;
                        if (collection != null) {
                            var ser = new JavaScriptSerializer();
                            var res = ser.Serialize(collection);
                            result.Add(item.Key, res);
                        } else
                            result.Add(item.Key, value.ToString());
                    }
                }
                return result;
            }
            return new Dictionary<string, object>();
        }
 public PermissionFlag(Guid moduleID, String flag)
 {
     Dictionary<string, object> parameters = new Dictionary<string,object>();
     parameters.Add("moduleID", moduleID);
     parameters.Add("flag", flag);
     this.DataManager.Load(parameters);
 }
        public void ParseVersionsProperlyTest()
        {
            var UserAgent = @"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)";

            var expected = new Dictionary<string, CLRVersion>();

            expected.Add(Constants.Version20Full, CLRVersions.Versions[Constants.Version20Full]);
            expected.Add(Constants.Version30Full, CLRVersions.Versions[Constants.Version30Full]);
            expected.Add(Constants.Version35SP1Full, CLRVersions.Versions[Constants.Version35SP1Full]);
            expected.Add(Constants.Version40Client, CLRVersions.Versions[Constants.Version40Client]);
            expected.Add(Constants.Version40Full, CLRVersions.Versions[Constants.Version40Full]);

            var CLRVersionFac = new CLRVersions(UserAgent);
            var actual = CLRVersionFac.GetInstalledVersions();

            CollectionAssert.AreEquivalent((ICollection)expected, (ICollection)actual);

            var expectedLatestVersion = CLRVersions.Versions[Constants.Version40Full];
            var actualLatestVersion = CLRVersionFac.GetLatestVersion();
            Assert.IsTrue(actualLatestVersion != null, "Version is not null");

            Assert.AreEqual(expectedLatestVersion.Major, actualLatestVersion.Major, "Major Versions Are the Same");
            Assert.AreEqual(expectedLatestVersion.Minor, actualLatestVersion.Minor, "Minor Versions Are the Same");
            Assert.AreEqual(expectedLatestVersion.Profile, actualLatestVersion.Profile, "Profile is the Same");
            Assert.AreEqual(expectedLatestVersion.ServicePack, actualLatestVersion.ServicePack, "Service Pack is the Same");
        }
Exemplo n.º 29
0
 //AndroidのmaybeReferenceAndEncode注意
 public object Encode()
 {
     Dictionary<string, object> dic = new Dictionary<string, object> ();
     dic.Add ("__op", "Add");
     dic.Add ("objects", NCMBUtility._maybeEncodeJSONObject (this.objects, true));
     return dic;
 }
Exemplo n.º 30
0
        //---------------------------------------------------------------------------------------------
        public void App()
        {
            target( AppSave );

            Dictionary<string, string> dicApp = new Dictionary<string, string>();
            dicApp.Add( "主页", "home" );
            dicApp.Add( "博客", "blog" );
            dicApp.Add( "相册", "photo" );
            dicApp.Add( "微博", "microblog" );
            dicApp.Add( "分享", "share" );
            dicApp.Add( "好友", "friend" );
            dicApp.Add( "访客", "visitor" );
            dicApp.Add( "论坛帖子", "forumpost" );
            dicApp.Add( "关于我", "about" );
            dicApp.Add( "留言", "feedback" );
            checkboxList( "initApp", dicApp, config.Instance.Site.UserInitApp );

            // app部署管理:按照分类归类,分类进行排序
            List<AppInstaller> list = cdb.findAll<AppInstaller>();
            bindList( "list", "app", list, bindAppAdminLink );

            // 基础组件
            List<Component> clist = cdb.findAll<Component>();
            IBlock cblock = getBlock( "clist" );
            foreach (Component c in clist) {
                cblock.Set( "c.Name", c.Name );
                cblock.Set( "c.StatusName", c.StatusName );
                cblock.Set( "c.AdminLink", to( EditComponent, c.Id ) );
                cblock.Next();
            }
        }