Ejemplo n.º 1
0
        public IHttpActionResult SecureListDocs()
        {
            var parms = new ParamCollection(Request.RequestUri.ParseQueryString());

            var osuId = parms.Get("osuId", 0);

            if (osuId == 0)
            {
                return(BadRequest("A valid OSUID is required."));
            }

            var timeToLive = parms.Get("timeToLive", DefaultTimeToLive);

            long startDocId   = 0;
            var  startDocHash = parms.Get("filter[startDocHash]", DefaultStartDocId);

            var filter = new DocListFilter
            {
                IndexKey       = parms.Get("filter[indexKey]", DefaultIndexKey),
                DocTypeGroup   = parms.Get("filter[docTypeGroup]", DefaultTypeGroup),
                DocType        = parms.Get("filter[docType]", DefaultDocType),
                StartDocId     = startDocId,
                PageSize       = parms.Get("filter[pageSize]", DefaultPageSize),
                KeywordsHasAll = parms.Get("filter[keywords][hasAll]", DefaultKeywords),
            };

            return(ListDocs <SecureDocumentAttributes>(filter, d => SecureDocumentResource(osuId, timeToLive, d)));
        }
Ejemplo n.º 2
0
        public override UpdateAction Where(TableFilter filter)
        {
            if (this.UpdateColumns.Count == 0)
            {
                throw new Exception("no update columns");
            }

            #region update columns
            string columnStr = string.Empty;
            foreach (var col in this.UpdateColumns)
            {
                var p = new DBParam(col.Key, col.Value);
                ParamCollection.Add(p);
                columnStr += string.Format(" {0} ={1},", col.Key, p.ParamName);
            }
            columnStr = columnStr.TrimEnd(',');
            #endregion

            #region where
            string filterCondition = string.Empty, where = string.Empty;
            if (filter != null)
            {
                filterCondition = filter.Build(base.ParamCollection);
                if (!string.IsNullOrWhiteSpace(filterCondition))
                {
                    where = string.Format(" where {0} ", filterCondition);
                }
            }
            #endregion

            base.MainSql = string.Format("update {0} set {1} {2}", base.TableCode, columnStr, where);
            return(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 小于条件解析
        /// </summary>
        /// <param name="condition">需要解析的条件对象</param>
        /// <returns>返回解析后的条件字符串</returns>
        protected override string LessThanParse(LessThanCondition condition)
        {
            StringBuilder conditionStr = new StringBuilder(" ");
            string        queryColName = condition.SearchColumn.CurrentSearcher.TableName + "." + condition.SearchColumn.ColumnName;

            if (string.IsNullOrEmpty(condition.SearchColumn.ConditionString))
            {
                conditionStr.Append(queryColName);
            }
            else
            {
                conditionStr.Append(condition.SearchColumn.ConditionString.Replace(SQLPlaceholder.ColName, queryColName));
            }

            conditionStr.Append(" < ");

            if (condition.ParamValue is SearchColumn)
            {
                SearchColumn tmpColumn    = (SearchColumn)condition.ParamValue;
                string       valueColName = tmpColumn.CurrentSearcher.TableName + "." + tmpColumn.ColumnName;
                conditionStr.Append(valueColName);
            }
            else
            {
                string paramName = "P" + Guid.NewGuid().ToString().ToLower().Replace("-", "");
                conditionStr.Append("@" + paramName);
                ParamCollection.Add(new DBParam(paramName, condition.ParamValue));
            }

            conditionStr.Append(" ");

            return(conditionStr.ToString());
        }
Ejemplo n.º 4
0
            public bool TryMatch(string path, out ParamCollection @params)
            {
                @params = new ParamCollection();
                var breaked = path.Split('/').Where(n => !string.IsNullOrWhiteSpace(n));
                int i       = 0;

                if (breaked.Count() != template_breaked.Count)
                {
                    @params = null;
                    return(false);
                }

                foreach (var b in breaked)
                {
                    TemplateNode template = template_breaked[i];

                    if (template.IsTemplate)
                    {
                        string key   = template.Key;
                        string value = b;
                        @params.Add(key, b);
                    }
                    else
                    {
                        if (template.Key != b)
                        {
                            @params = null;
                            return(false);
                        }
                    }
                    i++;
                }
                return(true);
            }
        private async Task <BuildContentOutput> DoBuildContentForMessageAsync(Message message, QueueInfo queueInfo)
        {
            ParamCollection contextParams = message.CustomData != null ? new ParamCollection(message.CustomData) : new ParamCollection();

            contextParams[Constants.EntityIdentifier] = message.EntityIdentifiers[0].ToString();

            BuildRequest buildRequest = new BuildRequest
            {
                ActionName   = message.ActionName,
                SharedObject = new Dictionary <string, object> {
                    { Constants.BuildMessage, message }
                },
                EntityIdentifier = message.EntityIdentifiers[0],
                ContextParams    = contextParams,
                TrackingId       = message.TrackingId.ToString(),
                IsIncremental    = message.IsIncremental,
                QueueInfo        = queueInfo,
            };

            string apiName = "Pipeline." + BuildActionMapper.GetPipelineName(buildRequest.ActionName);

            Dictionary <string, object> requestAbstraction = new Dictionary <string, object>
            {
                { "buildRequest", buildRequest.ToString() }
            };

            using (var scope = new BackendBuildApiTraceScope(apiName, BuildApiCategory.BuildBackend, requestAbstraction))
            {
                return(await scope.Run(
                           DoBuildContentForBuildRequestAsync(buildRequest),
                           Utility.ToJsonString,
                           GetBuildContentStatusCode));
            }
        }
Ejemplo n.º 6
0
 private ParamCollection Parse(ref string s, string pattern, bool remove, string tag, RegexOptions options)
 {
     ParamCollection cmd = new ParamCollection(Name);
     Regex rex = new Regex(pattern, options);
     Match m1 = rex.Match(s);
     while (m1.Success)
     {
         string param = m1.Groups[PARAM].Value;
         string arg = m1.Groups[ARGS].Value;
         if (param != null)
         {
             param = param.TrimEnd(' ');
             ArgCollection prm = cmd.Add(param, new ArgCollection(param, tag));
             if (arg != null)
             {
                 arg = arg.TrimEnd(' ');
                 if (!string.IsNullOrEmpty(arg))
                 {
                     prm.Add(arg);
                 }
             }
         }
         if (remove)
         {
             s = s.Remove(m1.Index, m1.Length).Trim();
             m1 = rex.Match(s);
         }
         else
         {
             m1 = rex.Match(s, m1.Index + m1.Length);
         }
     }
     return cmd;
 }
Ejemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="i_sIpAddr"></param>
        /// <param name="i_sSessionId"></param>
        /// <param name="i_sThreadId"></param>
        /// <param name="i_sVmcId"></param>
        /// <param name="i_sComponentName"></param>
        /// <param name="i_sPath"></param>
        /// <returns></returns>
        public bool Init(string i_sIpAddr, string i_sSessionId, string i_sThreadId, string i_sVmcId, string i_sComponentName, string i_sPath)
        {
            bool            bRet        = true;
            ParamCollection aInitParams = null;

            try
            {
                aInitParams = new ParamCollection();
                aInitParams.Add(new Param(eRequiredParams.IpAddress.ToString(), i_sIpAddr));
                aInitParams.Add(new Param(eRequiredParams.SessionId.ToString(), i_sSessionId));
                aInitParams.Add(new Param(eRequiredParams.ThreadId.ToString(), i_sThreadId));
                aInitParams.Add(new Param(eRequiredParams.VmcId.ToString(), i_sVmcId));
                aInitParams.Add(new Param(eRequiredParams.ComponentName.ToString(), i_sComponentName));
                aInitParams.Add(new Param(TsvAndStdoutLogger.eMoreParams.Path.ToString(), i_sPath));

                if (m_Logger == null)
                {
                    m_Logger = new TsvAndStdoutLogger();
                }
                bRet = m_Logger.Init(ref aInitParams);
            }
            catch (Exception exc)
            {
                bRet = false;
                Console.Error.WriteLine(DateTime.Now.ToString() + " " + "Caught exception in LegacyLogger.Init:  " + exc.ToString());
            }

            return(bRet);
        }         // Init
Ejemplo n.º 8
0
 public ParCollContainer(ParamCollection ParamCollection, string Message, List<string> ProjectBuildContext, string CurrentDir)
 {
     this.ParamCollection = ParamCollection;
     this.Message = Message;
     this.ProjectBuildContext = new List<string>(ProjectBuildContext);
     this.CurrentDir = CurrentDir;
 }
Ejemplo n.º 9
0
        public ActionResult DeleteConfirmed(int id)
        {
            ParamCollection paramcollection = db.ParamCollection.Single(p => p.id == id);

            db.ParamCollection.DeleteObject(paramcollection);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 10
0
 private static void showParam(ParamCollection pac)
 {
     foreach(var pa in pac)
     {
         var param = pa as ParamElement;
         Console.WriteLine($"param name:{param.Name}, value:{param.Value}");
     }
 }
Ejemplo n.º 11
0
        //
        // GET: /ParamCollection/Delete/5

        public ActionResult Delete(int id = 0)
        {
            ParamCollection paramcollection = db.ParamCollection.Single(p => p.id == id);

            if (paramcollection == null)
            {
                return(HttpNotFound());
            }
            return(View(paramcollection));
        }
Ejemplo n.º 12
0
        public ActionResult Create(ParamCollection paramcollection)
        {
            if (ModelState.IsValid)
            {
                db.ParamCollection.AddObject(paramcollection);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(paramcollection));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// NOT IN条件解析
        /// </summary>
        /// <param name="condition">需要解析的条件对象</param>
        /// <returns>返回解析后的条件字符串</returns>
        protected override string NotInParse(NotInCondition condition)
        {
            StringBuilder conditionStr = new StringBuilder(" ");
            string        queryColName = condition.SearchColumn.CurrentSearcher.TableName + "." + condition.SearchColumn.ColumnName;

            if (string.IsNullOrEmpty(condition.SearchColumn.ConditionString))
            {
                conditionStr.Append(queryColName);
            }
            else
            {
                conditionStr.Append(condition.SearchColumn.ConditionString.Replace(SQLPlaceholder.ColName, queryColName));
            }

            conditionStr.Append(" NOT IN ( ");

            string paramName = string.Empty;
            int    i         = 0;

            foreach (object pvalue in condition.ParamValueList)
            {
                if (i != 0)
                {
                    conditionStr.Append(",");
                }

                if (pvalue is SearchColumn)
                {
                    SearchColumn tmpColumn    = (SearchColumn)pvalue;
                    string       valueColName = tmpColumn.CurrentSearcher.TableName + "." + tmpColumn.ColumnName;
                    conditionStr.Append(valueColName);
                }
                else
                {
                    if (!string.IsNullOrEmpty(pvalue.ToString()))
                    {
                        paramName = "P" + Guid.NewGuid().ToString().ToLower().Replace("-", "");
                        conditionStr.Append("@" + paramName);

                        ParamCollection.Add(new DBParam(paramName, pvalue));
                    }
                    else
                    {
                        conditionStr.Append("''");
                    }
                }

                i++;
            }

            conditionStr.Append(") ");

            return(conditionStr.ToString());
        }
        //private static string GetPageSql(AnyDbConnection cnn, Select query, int pageIndex, int pageSize, int totalRowCount)
        //{
        //  return Qb.CreateRenderer(cnn.DatabaseProvider).RenderPage(pageIndex, pageSize, totalRowCount, query);
        //}

        //private static string GetRowCountSql(AnyDbConnection cnn, Select query)
        //{
        //  return Qb.CreateRenderer(cnn.DatabaseProvider).RenderRowCount(query);
        //}

        static DynamicParameters GetParameters(ParamCollection paramCollection)
        {
            DynamicParameters retVal = new DynamicParameters();

            for (int i = 0; i < paramCollection.Count; i++)
            {
                Param p = paramCollection[i];
                retVal.Add(p.Name, p.Value, p.DbType, p.Direction, p.Size, p.Precision, p.Scale);
            }
            return(retVal);
        }
Ejemplo n.º 15
0
 public ActionResult Edit(ParamCollection paramcollection)
 {
     if (ModelState.IsValid)
     {
         db.ParamCollection.Attach(paramcollection);
         db.ObjectStateManager.ChangeObjectState(paramcollection, System.Data.EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(paramcollection));
 }
Ejemplo n.º 16
0
        private void CheckIn()
        {
            using (var trans = DBFactory.GetDatabase().StartTransaction())
                using (var conn = trans.Connection)
                {
                    try
                    {
                        if (!GetCheckData())
                        {
                            return;
                        }

                        Waiting();

                        int rows = 0;
                        rows += DBFactory.GetDatabase().UpdateValue(DevicesCols.TableName, DevicesCols.CheckedOut, 0, DevicesCols.DeviceGuid, currentTrackingDevice.Guid, trans);

                        ParamCollection checkParams = new ParamCollection();

                        checkParams.Add(TrackablesCols.CheckType, CheckType.Checkin);
                        checkParams.Add(TrackablesCols.CheckoutTime, checkData.CheckoutTime);
                        checkParams.Add(TrackablesCols.DueBackDate, checkData.DueBackTime);
                        checkParams.Add(TrackablesCols.CheckinTime, checkData.CheckinTime);
                        checkParams.Add(TrackablesCols.CheckoutUser, checkData.CheckoutUser);
                        checkParams.Add(TrackablesCols.CheckinUser, checkData.CheckinUser);
                        checkParams.Add(TrackablesCols.UseLocation, checkData.UseLocation);
                        checkParams.Add(TrackablesCols.Notes, checkData.CheckinNotes);
                        checkParams.Add(TrackablesCols.DeviceGuid, checkData.Guid);
                        rows += DBFactory.GetDatabase().InsertFromParameters(TrackablesCols.TableName, checkParams.Parameters, trans);

                        if (rows == 2)
                        {
                            trans.Commit();
                            OtherFunctions.Message("Device Checked In!", MessageBoxButtons.OK, MessageBoxIcon.Information, "Success", this);
                        }
                        else
                        {
                            trans.Rollback();
                            OtherFunctions.Message("Unsuccessful! The number of affected rows was not what was expected.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Unexpected Result", this);
                        }
                        ParentForm.RefreshData();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                    }
                    finally
                    {
                        this.Dispose();
                    }
                }
        }
Ejemplo n.º 17
0
 public ActionResult Save(Bam.Net.Logging.Data.Param[] values)
 {
     try
     {
         ParamCollection saver = new ParamCollection();
         saver.AddRange(values);
         saver.Save();
         return(Json(new { Success = true, Message = "", Dao = "" }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            Program         Self = new Program();
            ParamCollection p    = ParamCollection.ApplicationParameters;

            Self.TestAssembly = (string)p["TestAssembly"].Value;
            Self.ReportFile   = (string)p["ReportFile"].Value;
            Self.ReportFormat = (string)p["ReportFormat"].Value;
            Self.ProjectName  = (string)p["ProjectName"].Value;
            Self.ChangeDirFromObjToBin();
            Self.GenerateReport();
            Console.WriteLine();
            Console.WriteLine(string.Format(@"file://{0}", Self.ReportFile));
            Console.WriteLine();
        }
Ejemplo n.º 19
0
        private string PreparePostBody(IEnumerable<ParamPair> customPostParams)
        {
            var parameters = new ParamCollection();

            if (null != customPostParams)
            {
                foreach (ParamPair item in customPostParams)
                {
                    parameters.Add(item.Name, item.Value);
                }
            }

            string postBody = ConstructPostBody(parameters);
            return postBody;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Combines the OAuth basic parameters and additional parameters.
        /// </summary>
        /// <returns></returns>
        private IEnumerable<ParamPair> CollectAllParams()
        {
            var parameters = new ParamCollection();

            parameters.Add(SinaConstants.OAuthToken,Token);

            if (null != Params)
            {
                foreach (var item in Params)
                {
                    parameters.Add(item.Name, item.Value);
                }
            }

            return parameters;
        }
Ejemplo n.º 21
0
        public IHttpActionResult ListDocs()
        {
            var parms = new ParamCollection(Request.RequestUri.ParseQueryString());

            var filter = new DocListFilter
            {
                IndexKey       = parms.Get("filter[indexKey]", DefaultIndexKey),
                DocTypeGroup   = parms.Get("filter[typeGroup]", DefaultTypeGroup),
                DocType        = parms.Get("filter[type]", DefaultDocType),
                StartDocId     = parms.Get("filter[startDocId]", DefaultStartDocId),
                PageSize       = parms.Get("filter[pageSize]", DefaultPageSize),
                KeywordsHasAll = parms.Get("filter[keywords][hasAll]", DefaultKeywords),
            };

            return(ListDocs <DocumentAttributes>(filter, d => DocumentResource(d)));
        }
Ejemplo n.º 22
0
 void InitField(ParamCollection parameters)
 {
     dataSourceName = parameters["dataSourceName"];
     if (String.IsNullOrEmpty(dataSourceName))
     {
         throw new Exception("没有指定类别导航控件的数据表名称");
     }
     ChannelName   = parameters["ChannelName"];
     ChannelID     = parameters["ChannelID"];
     FullUrl       = parameters["FullUrl"];
     TitleImage    = parameters["TitleImage"];
     ParentID      = parameters["ParentID"];
     ParentIDName  = parameters["ParentIDName"];
     LevelOneMax   = parameters["LevelOneMax"];
     LevelTwoMax   = parameters["LevelTwoMax"];
     LevelThreeMax = parameters["LevelThreeMax"];
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Combines the OAuth basic parameters and additional parameters.
        /// </summary>
        /// <returns></returns>
        private IEnumerable <ParamPair> CollectAllParams()
        {
            var parameters = new ParamCollection();

            OAuthAccessToken accessToken = this.accessToken ?? Environment.AccessToken;

            parameters.Add(Constants.OAuthToken, accessToken.Token);

            if (null != Params)
            {
                foreach (var item in Params)
                {
                    parameters.Add(item.Name, item.Value);
                }
            }

            return(parameters);
        }
Ejemplo n.º 24
0
        /// <summary>Получить коллекцию выходных параметров команды</summary>
        /// <param name="paramCollection">Коллекция параметров команды</param>
        /// <returns></returns>
        public static ParamCollection GetOutputParams(ParamCollection paramCollection)
        {
            if (paramCollection == null)
            {
                throw new ArgumentNullException("paramCollection");
            }
            ParamCollection retVal = new ParamCollection();

            for (int i = 0; i < paramCollection.Count; i++)
            {
                if (paramCollection[i].Direction == ParameterDirection.Input)
                {
                    continue;
                }
                retVal.Add(paramCollection[i]);
            }
            return(retVal);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 等于条件解析;如果条件值为NULL或空字符串时则判断字段的空字符串或NULL值
        /// </summary>
        /// <param name="condition">需要解析的条件对象</param>
        /// <returns>返回解析后的条件字符串</returns>
        protected override string EqualParse(EqualCondition condition)
        {
            StringBuilder conditionStr = new StringBuilder(" ");
            string        queryColName = condition.SearchColumn.CurrentSearcher.TableName + "." + condition.SearchColumn.ColumnName;

            if (string.IsNullOrEmpty(condition.SearchColumn.ConditionString))
            {
                conditionStr.Append(queryColName);
            }
            else
            {
                conditionStr.Append(condition.SearchColumn.ConditionString.Replace(SQLPlaceholder.ColName, queryColName));
            }

            conditionStr.Append(" = ");

            if (condition.ParamValue is SearchColumn)
            {
                SearchColumn tmpColumn    = (SearchColumn)condition.ParamValue;
                string       valueColName = tmpColumn.CurrentSearcher.TableName + "." + tmpColumn.ColumnName;
                conditionStr.Append(valueColName);
            }
            else
            {
                if (condition.ParamValue != null && !condition.ParamValue.ToString().Equals(string.Empty))
                {
                    string paramName = "P" + Guid.NewGuid().ToString().ToLower().Replace("-", "");
                    conditionStr.Append("@" + paramName);
                    ParamCollection.Add(new DBParam(paramName, condition.ParamValue));
                }
                else
                {
                    conditionStr.Insert(0, " (");
                    conditionStr.Append("'' ");
                    conditionStr.Append(" OR ");
                    conditionStr.Append(queryColName);
                    conditionStr.Append(" IS NULL) ");
                }
            }

            conditionStr.Append(" ");

            return(conditionStr.ToString());
        }
Ejemplo n.º 26
0
 void InitField(ParamCollection parameters)
 {
     xmlpath = parameters["data"];
     if (String.IsNullOrEmpty(xmlpath))
     {
         throw new Exception("没有指定联动控件的Xml路径");
     }
     xmlpath = HttpContext.Current.Server.MapPath(xmlpath);
     if (!File.Exists(xmlpath))
     {
         throw new Exception("不存在指定的数据联动文件");
     }
     //读取节点名称配置
     nodesName = parameters["NodesName"];
     SetNodesName(nodesName);
     //读取节点属性名配置
     attributesName = parameters["AttributesName"];
     SetAttributesName(attributesName);
 }
Ejemplo n.º 27
0
        /// <summary>
        ///   Prepares a post body string for an access-token-required request.
        /// </summary>
        /// <param name="uri"> The uri to identify the resource. </param>
        /// <param name="customPostParams"> Additional parameters (in addition to the OAuth parameters) to be included in the post body. </param>
        /// <returns> The url-encoded post body string. </returns>
        public static string PreparePostBody(IEnumerable<ParamPair> customPostParams)
        {
            var parameters = new ParamCollection();
            //OAuthAccessToken accessToken = Environment.AccessToken;

            //parameters.Add(Constants.OAuthToken, accessToken.Token);

            if (null != customPostParams)
            {
                foreach (ParamPair item in customPostParams)
                {
                    parameters.Add(item.Name, item.Value);
                }
            }

            string postBody = ConstructPostBody(parameters);

            return postBody;
        }
 public static void AddNewEmp(MunisEmployee empInfo)
 {
     try
     {
         if (!IsEmployeeInDB(empInfo.Number))
         {
             string          newGuid      = Guid.NewGuid().ToString();
             ParamCollection insertParams = new ParamCollection();
             insertParams.Add(EmployeesCols.Name, empInfo.Name);
             insertParams.Add(EmployeesCols.Number, empInfo.Number);
             insertParams.Add(EmployeesCols.Guid, newGuid);
             DBFactory.GetDatabase().InsertFromParameters(EmployeesCols.TableName, insertParams.Parameters);
         }
     }
     catch (Exception ex)
     {
         ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
     }
 }
Ejemplo n.º 29
0
 static void FillParameters(DbCommand cmd, ParamCollection parameters, ISqlOmRenderer render)
 {
     if (cmd.Parameters.Count > 0)
     {
         cmd.Parameters.Clear();
     }
     for (int i = 0; i < parameters.Count; i++)
     {
         DbParameter p = cmd.CreateParameter();
         p.DbType        = parameters[i].DbType;
         p.Direction     = parameters[i].Direction;
         p.ParameterName = render.CreateParameterName(parameters[i].Name);
         ((IDbDataParameter)p).Precision = parameters[i].Precision;
         ((IDbDataParameter)p).Scale     = parameters[i].Scale;
         p.Size       = parameters[i].Size;
         p.IsNullable = parameters[i].IsNullable;
         p.Value      = parameters[i].Value;
         cmd.Parameters.Add(p);
     }
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Initializes the parameters, but does not open the logger.  Init can be called multiple times.
        /// Remember to call base.Init() in your overriding member.
        /// </summary>
        /// <param name="i_Params"></param>
        /// <returns></returns>
        public virtual bool Init(ref ParamCollection i_Params)
        {
            bool                    bRet = true, bRes = true;
            string                  sParam = "", sThreadId = "";
            LoggerThreadInfo        ltiTmp = null;
            ThreadInfoDictSingleton oDict  = null;

            try
            {
                sParam    = eRequiredParams.ThreadId.ToString();
                sThreadId = i_Params.Find(param => param.GetName() == sParam).GetValue();
                oDict     = ThreadInfoDictSingleton.GetInstance();
                bRes      = oDict.TryGetValue(sThreadId, out ltiTmp);
                if (!bRes)
                {
                    ltiTmp = new LoggerThreadInfo();
                    oDict.Add(sThreadId, ltiTmp);
                    ltiTmp.m_sThreadId = sThreadId;
                }

                lock (ltiTmp)                           // Technically it shouldn't be necessary to lock, but it can't hurt
                {
                    // Pull the required params from the collection to the member variables, for easier access later.
                    sParam = eRequiredParams.IpAddress.ToString();
                    ltiTmp.m_sIpAddress = i_Params.Find(param => param.GetName() == sParam).GetValue();
                    sParam = eRequiredParams.SessionId.ToString();
                    ltiTmp.m_sSessionId = i_Params.Find(param => param.GetName() == sParam).GetValue();
                    sParam = eRequiredParams.ComponentName.ToString();
                    ltiTmp.m_sComponentName = i_Params.Find(param => param.GetName() == sParam).GetValue();
                    sParam          = eRequiredParams.VmcId.ToString();
                    ltiTmp.m_sVmcId = i_Params.Find(param => param.GetName() == sParam).GetValue();
                }
            }
            catch
            {
                bRet = false;                           // Unnecessary if throwing an exception
                throw(new ArgumentException("Logger.Init: A required parameter was not included in i_Params: " + sParam));
            }

            return(bRet);
        }         // Init
Ejemplo n.º 31
0
 void InitField(ParamCollection parameters)
 {
     dataSourceName = parameters["dataSourceName"];
     if (String.IsNullOrEmpty(dataSourceName))
     {
         throw new Exception("没有指定类别导航控件的Xml路径");
     }
     dataSourceName = HttpContext.Current.Server.MapPath(dataSourceName);
     if (!File.Exists(dataSourceName))
     {
         throw new Exception("不存在指定的类别导航文件");
     }
     ChannelName   = parameters["ChannelName"];
     ChannelID     = parameters["ChannelID"];
     FullUrl       = parameters["FullUrl"];
     TitleImage    = parameters["TitleImage"];
     ParentID      = parameters["ParentID"];
     ParentIDName  = parameters["ParentIDName"];
     LevelOneMax   = parameters["LevelOneMax"];
     LevelTwoMax   = parameters["LevelTwoMax"];
     LevelThreeMax = parameters["LevelThreeMax"];
 }
Ejemplo n.º 32
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="i_Params"></param>
        /// <returns></returns>
        public override bool Init(ref ParamCollection i_Params)
        {
            bool bRet = true;

            base.Init(ref i_Params);

            SetLastError(0, "");
            m_ParamCollection = i_Params;

            try
            {
                // Pull the additional params from the collection to the member variables, for easier access later.
                m_sPath = i_Params.Find(param => param.GetName() == eMoreParams.Path.ToString()).GetValue();
            }
            catch
            {
                bRet = false;                           // Unnecessary if throwing an exception
                SetLastError(-1, "TsvAndStdoutLogger.Init: The parameter 'Path' was not specified in i_Params.");
                throw (new ArgumentException(m_sLastError));
            }

            return(bRet);
        }         // Init
Ejemplo n.º 33
0
        /// <summary>
        /// 取得查询实体
        /// </summary>
        /// <returns></returns>
        IShowCategoryProvider GetProvider()
        {
            ParamCollection col = new ParamCollection();

            col.Add(new Param("dataSourceName", DataSourceName));
            col.Add(new Param("ChannelName", ChannelName));
            col.Add(new Param("ChannelID", ChannelID));
            col.Add(new Param("FullUrl", FullUrl));
            col.Add(new Param("TitleImage", TitleImage));
            col.Add(new Param("ParentID", ParentID));
            col.Add(new Param("ParentIDName", ParentIDName));
            col.Add(new Param("LevelOneMax", LevelOneMax.ToString()));
            col.Add(new Param("ParentID", LevelTwoMax.ToString()));
            col.Add(new Param("ParentID", LevelThreeMax.ToString()));

            if (!String.IsNullOrEmpty(DataSourceType) && DataSourceType == "xml")
            {
                return(new XmlShowCategoryProvider(col));
            }
            else
            {
                return(new DbShowCategoryProvider(col));
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Gets a collection of OAuth basic parameters(key/value pair).
        /// <remarks>Not include 'oauth_token' and'oauth_verifier' parameters.</remarks>
        /// </summary>
        /// <returns>The collection contains OAuth basic parameters.</returns>
        public static ParamCollection GetOAuthBasicParams()
        {
            var parameters = new ParamCollection();

            parameters.Add(Constants.OAuthConsumerKey, Environment.AppKey);

            parameters.Add(Constants.OAuthSignatureMethod, Environment.OAuthSignatureMethod);

            var timestamp = RFC3986Encoder.ToUnixTime(DateTime.Now);
            parameters.Add(Constants.OAuthTimestamp, timestamp.ToString(CultureInfo.InvariantCulture));

            var nonce = GenerateNonce();
            parameters.Add(Constants.OAuthNonce, nonce);

            parameters.Add(Constants.OAuthVersion, Environment.OAuthVersion);

            return parameters;
        }
Ejemplo n.º 35
0
 public XmlCascadeDataProvider(ParamCollection parameters)
 {
     InitField(parameters);
 }
Ejemplo n.º 36
0
 protected string Match(ref Regex rex, ref ParamCollection result, ref Match m, string s, string group, string tag)
 {
     string file_name = m.Groups[group].Value.Trim();
     result.Add(file_name, new ArgCollection(file_name, tag));
     s = s.Remove(m.Index, m.Length).Trim();
     m = rex.Match(s);
     return s;
 }
Ejemplo n.º 37
0
 public XmlShowCategoryProvider(ParamCollection parameters)
 {
     InitField(parameters);
 }