Esempio n. 1
0
        /// <summary>
        /// Initializes the converter. This method will be called when the application is starting and
        /// any converter is loaded.
        /// </summary>
        /// <param name="d"></param>
        public override void Initialize(System.Collections.Specialized.StringDictionary d)
        {
            if (d.ContainsKey("mimeType"))
            {
                mimeType = d["mimeType"];

                if (d.ContainsKey("quality"))
                {
                    long i = 0;
#if (NET20)
                    if (long.TryParse(d["quality"], out i))
                    {
                        quality = i;
                    }
#else
                    try
                    {
                        i       = long.Parse(d["quality"]);
                        quality = i;
                    }
                    catch (Exception)
                    {
                    }
#endif
                }
            }
        }
Esempio n. 2
0
 public static void startup(System.Collections.Specialized.StringDictionary args)
 {
     Program.logIt("OEControl::startup: ++");
     if (args.ContainsKey("start"))
     {
         bool own;
         System.Threading.EventWaitHandle evt = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.AutoReset, EVENT_NAME, out own);
         if (!own)
         {
             // OE app already running.
             Program.logIt("OEControl::startup: app already running");
         }
         else
         {
             OEControl.OE_App_3_0_2_0(evt);
         }
     }
     else if (args.ContainsKey("stop"))
     {
         try
         {
             System.Threading.EventWaitHandle evt = System.Threading.EventWaitHandle.OpenExisting(EVENT_NAME);
             evt.Set();
         }
         catch (Exception) { }
     }
     Program.logIt("OEControl::startup: --");
 }
Esempio n. 3
0
 static void handle_QueryISP_Command(System.Collections.Specialized.StringDictionary args)
 {
     if (args.ContainsKey("start-service"))
     {
         bool own;
         System.Threading.EventWaitHandle e = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset, eventName, out own);
         if (own)
         {
             AVIAGetPhoneSize.start(e);
         }
         else
         {
             // device monitor already started.
         }
     }
     else if (args.ContainsKey("kill-service"))
     {
         try
         {
             System.Threading.EventWaitHandle e = System.Threading.EventWaitHandle.OpenExisting(eventName);
             e.Set();
         }
         catch (Exception) { }
     }
 }
Esempio n. 4
0
 public virtual void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     this.SetDefaultValues();
     this.configurationTypeArgumentName = attributes[configurationTypeAttributeArgumentName];
     this.namespaceArgumentName         = attributes[namespaceAttributeArgumentName];
     this.configurationTypeSuffix       = attributes.ContainsKey(configurationTypeSuffixAttributeName) ? attributes[configurationTypeSuffixAttributeName] : configurationTypeSuffix;
     this.nodeTypeSuffix = attributes.ContainsKey(nodeTypeSuffixAttributeName) ? attributes[nodeTypeSuffixAttributeName] : nodeTypeSuffix;
 }
Esempio n. 5
0
 public override void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     this.SetDefaultValues();
     base.Configure(attributes);
     this.configurationNamespaceArgumentName = attributes[configurationNamespaceAttributeArgumentName];
     this.configurationTypeSuffix            = attributes.ContainsKey(configurationTypeSuffixAttributeName) ? attributes[configurationTypeSuffixAttributeName] : configurationTypeSuffix;
     this.configurationTypePrefix            = attributes.ContainsKey(configurationTypePrefixAttributeName) ? attributes[configurationTypePrefixAttributeName] : configurationTypePrefix;
 }
Esempio n. 6
0
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes.ContainsKey(ProjectTypeArgument))
            {
                projectArgument = attributes[ProjectArgument].ToString(CultureInfo.InvariantCulture);
            }

            if (attributes.ContainsKey(ProjectTypeArgument))
            {
                language = (LanguageType)Enum.Parse(typeof(LanguageType), attributes[ProjectTypeArgument]);
            }
        }
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes.ContainsKey("WebProjectArgumentName"))
            {
                webProjectArgumentName = attributes["WebProjectArgumentName"];
            }

            if (attributes.ContainsKey("Resource"))
            {
                resource = attributes["Resource"];
            }
        }
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes.ContainsKey(RegistryPathAttribute))
            {
                this.registryPath = attributes[RegistryPathAttribute];
            }

            if (attributes.ContainsKey(RegistryEntryAttribute))
            {
                this.registryEntry = attributes[RegistryEntryAttribute];
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Allows configuration of the provider with two attributes: <c>Expression</c> and <c>Stage</c>.
 /// </summary>
 /// <remarks>
 /// See <see cref="IAttributesConfigurable.Configure"/>.
 /// </remarks>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (!attributes.ContainsKey("Expression"))
     {
         throw new ArgumentNullException("Expression", Properties.Resources.ExpressionProvider_ExpressionMissing);
     }
     expression = attributes["Expression"];
     if (attributes.ContainsKey("Stage"))
     {
         stage = (Stage)Enum.Parse(typeof(Stage), attributes["Stage"]);
     }
 }
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes.ContainsKey(PathArgumentAttribute))
            {
                this.pathArgument = attributes[PathArgumentAttribute];
            }

            if (attributes.ContainsKey(FileAttribute))
            {
                this.file = attributes[FileAttribute];
            }
        }
        public new void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            base.Configure(attributes);

            if (attributes.ContainsKey("XPathNamespace"))
            {
                XPathNamespace = attributes["XPathNamespace"];
            }
            if (attributes.ContainsKey("XPath"))
            {
                XPath = attributes["XPath"];
            }
        }
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes != null)
     {
         if (attributes.ContainsKey("WebProjectExpression"))
         {
             _webProjectExpression = attributes["WebProjectExpression"];
         }
         if (attributes.ContainsKey("WebFolderExpression"))
         {
             _webFolderExpression = attributes["WebFolderExpression"];
         }
     }
 }
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes != null)
     {
         if (attributes.ContainsKey(FirstOperandAttribute))
         {
             _firstOperandExpression = attributes[FirstOperandAttribute];
         }
         if (attributes.ContainsKey(SecondOperandAttribute))
         {
             _secondOperandExpression = attributes[SecondOperandAttribute];
         }
     }
 }
Esempio n. 14
0
        public static int cmc_login(System.Collections.Specialized.StringDictionary args)
        {
            int ret = -1;

            Program.logIt("cmc_login: ++");
            string avia_dir = System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA");
            string tool     = System.IO.Path.Combine(avia_dir, "hydra", "hydralogin.exe");
            string xml_file = System.IO.Path.Combine(avia_dir, "hydra", "hydralogin.xml");

            utility.IniFile config = new utility.IniFile(System.IO.Path.Combine(avia_dir, "config.ini"));
            if (System.IO.File.Exists(tool) && args.ContainsKey("u") && args.ContainsKey("p"))
            {
                try
                {
                    System.IO.File.Delete(xml_file);
                }
                catch (Exception) { }
                Process p = new Process();
                p.StartInfo.FileName        = tool;
                p.StartInfo.Arguments       = $"-u={args["u"]} -p={args["p"]}";
                p.StartInfo.CreateNoWindow  = true;
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
                p.StartInfo.EnvironmentVariables.Add("APSTHOME", avia_dir);
                p.Start();
                p.WaitForExit();
                //ret = p.ExitCode;
                if (p.ExitCode == 0 && System.IO.File.Exists(xml_file))
                {
                    // parse hydralogin xml
                    XmlDocument xml = new XmlDocument();
                    try
                    {
                        xml.Load(xml_file);
                        if (xml.DocumentElement != null)
                        {
                            if (xml.DocumentElement["id"] != null)
                            {
                                config.WriteValue("config", "userid", xml.DocumentElement["id"].InnerText);
                                ret = 0;
                            }
                        }
                    }
                    catch (Exception) { }
                }
            }
            Program.logIt($"cmc_login: -- ret={ret}");
            return(ret);
        }
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey("SharePointVersions"))
     {
         sharePointVersions = attributes["SharePointVersions"];
     }
     if (attributes.ContainsKey("NotSandboxSupported"))
     {
         try
         {
             notSandboxSupported = Boolean.Parse(attributes["NotSandboxSupported"]);
         }
         catch { }
     }
 }
 /// <summary>
 /// Configures the component using the dictionary of attributes specified
 /// in the configuration file.
 /// </summary>
 /// <param name="attributes">The attributes in the configuration element.</param>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey("FolderName"))
     {
         folderName = attributes["FolderName"];
     }
 }
Esempio n. 17
0
        public string ValidateTabName(string value)
        {
            string tabName = value.ToStringEx().Trim();

            //Can use all alphanumeric characters but not the following: \ / * ? : [ ]
            for (int i = 0; i < InvalidCharacters.Length; i++)
            {
                if (tabName.Contains(InvalidCharacters[i]))
                {
                    tabName = tabName.Replace(InvalidCharacters[i], '_');
                }
            }

            //Cannot exceed 31 characters
            tabName = tabName.MaxLength(31);

            //Be unique within the workbook
            int index = 0;

            while (_existingTabNames.ContainsKey(tabName))
            {
                index++;
                tabName = tabName.MaxLength(31, index.ToString());
            }

            _existingTabNames.Add(tabName, null);

            return(tabName);
        }
 /// <summary>
 /// Configures the component using the dictionary of attributes specified
 /// in the configuration file.
 /// </summary>
 /// <param name="attributes">The attributes in the configuration element.</param>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey(ConfigurationItemArgument))
     {
         configurationArgument = attributes[ConfigurationItemArgument];
     }
 }
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey(ValueExpressionAttribute))
     {
         _valueExpression = attributes[ValueExpressionAttribute];
     }
 }
Esempio n. 20
0
 /// <summary>
 /// Stores the set of user defined attributes
 /// </summary>
 /// <param name="attributes"></param>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey("FileExtension"))
     {
         fileExtension = attributes["FileExtension"];
     }
 }
 /// <summary>
 /// Configures the component using the dictionary of attributes specified
 /// in the configuration file.
 /// </summary>
 /// <param name="attributes">The attributes in the configuration element.</param>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey(ProjectTypeArgument))
     {
         language = (LanguageType)Enum.Parse(typeof(LanguageType), attributes[ProjectTypeArgument]);
     }
 }
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public virtual void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            if (attributes.ContainsKey(IsEnabledForPropertyAttribute))
            {
                propertyName = attributes[IsEnabledForPropertyAttribute];
            }
            if (attributes.ContainsKey(AppliesToTextAttribute))
            {
                appliesToText = attributes[AppliesToTextAttribute];
            }
        }
Esempio n. 23
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            System.Collections.Specialized.StringDictionary dic = new System.Collections.Specialized.StringDictionary();
            System.Collections.Generic.List <string>        col = new System.Collections.Generic.List <string>();

            foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures))
            {
                RegionInfo ri = new RegionInfo(ci.LCID);
                if (!dic.ContainsKey(ri.EnglishName))
                {
                    dic.Add(ri.EnglishName, ri.TwoLetterISORegionName.ToLowerInvariant());
                }

                if (!col.Contains(ri.EnglishName))
                {
                    col.Add(ri.EnglishName);
                }
            }

            col.Sort();

            this.Items.Add(new ListItem("[Not specified]", ""));
            foreach (string key in col)
            {
                this.Items.Add(new ListItem(key, dic[key]));
            }
        }
Esempio n. 24
0
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes != null && attributes.ContainsKey(FolderNameAttribute))
     {
         folderName = attributes[FolderNameAttribute];
     }
 }
Esempio n. 25
0
 /// <summary>
 /// Configures the component using the dictionary of attributes specified
 /// in the configuration file.
 /// </summary>
 /// <param name="attributes">The attributes in the configuration element.</param>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey(CodeElementTypeNameAttribute))
     {
         codeElementTypeName = attributes[CodeElementTypeNameAttribute];
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Configures the component using the dictionary of attributes specified
 /// in the configuration file.
 /// </summary>
 /// <param name="attributes">The attributes in the configuration element.</param>
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey(ArgumentAttribute))
     {
         this.argument = attributes[ArgumentAttribute];
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Parse the raw text of a Perforce form into a P4Form object
        /// </summary>
        /// <param name="formCommand">The form command.</param>
        /// <param name="formContents">Raw contents of the form spec.</param>
        /// <returns>
        /// A P4Form object.  The fields of the form can be read or updated.  If you update a filed, you can save it with Save_Form.
        /// </returns>
        /// <include file='CodeDocuments.xml' path='//Forms/remarks' />
        public P4Form Parse_Form(string formCommand, string formContents)
        {
            // logic stolen from P4Ruby.  Cache the spec defs, and load a form from the cached specdefs.

            // If we don't have a cached Spec def, we need to create a dummy form to get it in the cache
            if (!cachedSpecDefs.ContainsKey(formCommand))
            {
                string bogusSpec = "__p4net_bogus_spec__";
                P4Form outputForm;

                //
                // For specs of the following types we need the bogus spec name
                //
                if (formCommand == "branch" || formCommand == "label" || formCommand == "depot" || formCommand == "group")
                {
                    outputForm = Fetch_Form(formCommand, bogusSpec);
                }
                else
                {
                    outputForm = Fetch_Form(formCommand);
                }
            }

            return(P4Form.LoadFromSpec(formCommand, cachedSpecDefs[formCommand], formContents, m_ClientApi.Encoding));
        }
Esempio n. 28
0
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes.ContainsKey(StoreNameArgumentName))
            {
                storeNameArgument = attributes[StoreNameArgumentName];
            }

            if (attributes.ContainsKey(StoreLocationArgumentName))
            {
                storeLocationArgument = attributes[StoreLocationArgumentName];
            }

            if (attributes.ContainsKey(FindTypeArgumentName))
            {
                findTypeArgument = attributes[FindTypeArgumentName];
            }
        }
Esempio n. 29
0
 public void Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (!attributes.ContainsKey("Values"))
     {
         throw new ArgumentException("Attribute Values is missing in Converter");
     }
     this.values = attributes["Values"];
 }
Esempio n. 30
0
        /// <summary>
        /// Configures the component using the dictionary of attributes specified
        /// in the configuration file.
        /// </summary>
        /// <param name="attributes">The attributes in the configuration element.</param>
        public void Configure(System.Collections.Specialized.StringDictionary attributes)
        {
            if (attributes.ContainsKey("Title"))
            {
                title = attributes["Title"];
            }

            if (attributes.ContainsKey("Filter"))
            {
                filter = attributes["Filter"];
            }

            if (attributes.ContainsKey("InitialDirectory"))
            {
                initialDirectory = attributes["InitialDirectory"];
            }
        }
Esempio n. 31
0
        ICollection Messages_CreateDataSource()
        {
            // Messages Show begin
            Messages_sSQL = "";
            Messages_sCountSQL = "";

            string sWhere = "", sOrder = "";

            bool HasParam = false;

            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            if(Utility.GetParam("FormMessages_Sorting").Length>0&&!IsPostBack)
            {ViewState["SortColumn"]=Utility.GetParam("FormMessages_Sorting");
             ViewState["SortDir"]="ASC";}
            if(ViewState["SortColumn"]!=null) sOrder = " ORDER BY " + ViewState["SortColumn"].ToString()+" "+ViewState["SortDir"].ToString();

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();

            if(!Params.ContainsKey("s_topic")){
            string temp=Utility.GetParam("s_topic");
            Params.Add("s_topic",temp);}

            if(!Params.ContainsKey("s_topic")){
            string temp=Utility.GetParam("s_topic");
            Params.Add("s_topic",temp);}

              if (Params["s_topic"].Length>0) {
            HasParam = true;
            sWhere = "m.[message] like '%" + Params["s_topic"].Replace( "'", "''") +  "%'" + " or " + "m.[topic] like '%" + Params["s_topic"].Replace( "'", "''") +  "%'";
              }

              if(HasParam)
            sWhere = " WHERE (" + sWhere + ")";

            //-------------------------------
            // Build base SQL statement
            //-------------------------------

            Messages_sSQL = "select [m].[author] as m_author, " +
            "[m].[date_entered] as m_date_entered, " +
            "[m].[message] as m_message, " +
            "[m].[message_id] as m_message_id, " +
            "[m].[smiley_id] as m_smiley_id, " +
            "[m].[topic] as m_topic " +
            " from [messages] m ";

            //-------------------------------
            //-------------------------------

            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------

              Messages_sSQL = Messages_sSQL + sWhere + sOrder;
              if (Messages_sCountSQL.Length== 0) {
            int iTmpI = Messages_sSQL.ToLower().IndexOf("select ");
            int iTmpJ = Messages_sSQL.ToLower().LastIndexOf(" from ")-1;
            Messages_sCountSQL = Messages_sSQL.Replace(Messages_sSQL.Substring(iTmpI + 7, iTmpJ-6), " count(*) ");
            iTmpI = Messages_sCountSQL.ToLower().IndexOf(" order by");
            if (iTmpI > 1) Messages_sCountSQL = Messages_sCountSQL.Substring(0, iTmpI);
              }

            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(Messages_sSQL, Utility.Connection);
            DataSet ds = new DataSet();

            command.Fill(ds, (i_Messages_curpage - 1) * Messages_PAGENUM, Messages_PAGENUM,"Messages");
            OleDbCommand ccommand = new OleDbCommand(Messages_sCountSQL, Utility.Connection);
            int PageTemp=(int)ccommand.ExecuteScalar();
            Messages_Pager.MaxPage=(PageTemp%Messages_PAGENUM)>0?(int)(PageTemp/Messages_PAGENUM)+1:(int)(PageTemp/Messages_PAGENUM);
            bool AllowScroller=Messages_Pager.MaxPage==1?false:true;

            DataView Source;
            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0){
            Messages_no_records.Visible = true;
            AllowScroller=false;}
            else
            {Messages_no_records.Visible = false;
            AllowScroller=AllowScroller&&true;}

            Messages_Pager.Visible=AllowScroller;
            return Source;
            // Messages Show end
        }
Esempio n. 32
0
 public Fltr(int DId, int Id)
 {
     _did = DId;
     _id = Id;
     DataRow _row = SelectFilter(DId, _id);
     _uid = (int)_row["UId"];
     if (_row == null) return;
     _name = _row["Name"].ToString();
     _reptype = (ReportType)(byte)_row["ReportType"];
     string[] _state = _row["FilterState"].ToString().Split('&');
     System.Collections.Specialized.StringDictionary _sd = new System.Collections.Specialized.StringDictionary();
     for (int i = 0; i < _state.Length; i++)
     {
         if (_state[i].Length == 0) continue;
         string[] _item = _state[i].Split('=');
         if (_item.Length > 1) _sd.Add(_item[0], _item[1]);
         else _sd.Add(_item[0], string.Empty);
     }
     string[] expectedFormats = { "MM/dd/yyyy HH:mm:ss", "MM/dd/yyyyHH:mm:ss", "MM.dd.yyyy HH:mm:ss", "MM.dd.yyyyHH:mm:ss" };
     IFormatProvider culture = new CultureInfo("en-US", false);
     if (_sd.ContainsKey("ds") && _sd["ds"].Length > 0) _start = DateTime.ParseExact(HttpUtility.UrlDecode(_sd["ds"]), expectedFormats, culture, DateTimeStyles.None);
     if (_sd.ContainsKey("de") && _sd["de"].Length > 0) _end = DateTime.ParseExact(HttpUtility.UrlDecode(_sd["de"]), expectedFormats, culture, DateTimeStyles.None);
     if (_sd.ContainsKey("dr") && _sd["dr"].Length > 0) this.DateRange = ConvertStringToRange(HttpUtility.UrlDecode(_sd["dr"]));
     if (_sd.ContainsKey("ya") && _sd["ya"].Length > 0)
     {
         string _val = HttpUtility.UrlDecode(_sd["ya"]);
         if (_val.IndexOf(Grouping.Location.ToString()) >= 0)
         {
             _yaxis = Grouping.Location;
             _locationtype = int.Parse(_val.Split(',')[1]);
         }
         else if (_val.IndexOf(Grouping.Class.ToString()) >= 0)
         {
             _yaxis = Grouping.Class;
             string[] _arr = _val.Split(',');
             if (_arr.Length > 1) _classlevel = int.Parse(_arr[1]);
         }
         else _yaxis = (Grouping)Enum.Parse(typeof(Grouping), _val, true);
     }
     if (_sd.ContainsKey("sya") && _sd["sya"].Length > 0)
     {
         string _val = HttpUtility.UrlDecode(_sd["sya"]);
         if (_val.IndexOf(Grouping.Location.ToString()) >= 0)
         {
             _subyaxis = Grouping.Location;
             _sublocationtype = int.Parse(_val.Split(',')[1]);
         }
         else if (_val.IndexOf(Grouping.Class.ToString()) >= 0)
         {
             _subyaxis = Grouping.Class;
             string[] _arr = _val.Split(',');
             if (_arr.Length > 1) _subclasslevel = int.Parse(_arr[1]);
         }
         else _subyaxis = (Grouping)Enum.Parse(typeof(Grouping), _val, true);
     }
     if (_sd.ContainsKey("prt") && _sd["prt"].Length > 0) _priority = int.Parse(_sd["prt"]);
     if (_sd.ContainsKey("cls") && _sd["cls"].Length > 0) _class = int.Parse(_sd["cls"]);
     if (_sd.ContainsKey("ctg") && _sd["ctg"].Length > 0) _creationcategory = int.Parse(_sd["ctg"]);
     if (_sd.ContainsKey("stg") && _sd["stg"].Length > 0) _submissioncat = int.Parse(_sd["stg"]);
     if (_sd.ContainsKey("rtg") && _sd["rtg"].Length > 0) _resolutioncat = int.Parse(_sd["rtg"]);
     if (_sd.ContainsKey("lct") && _sd["lct"].Length > 0) _location = int.Parse(_sd["lct"]);
     if (_sd.ContainsKey("tch") && _sd["tch"].Length > 0) _technician = int.Parse(_sd["tch"]);
     if (_sd.ContainsKey("sby") && _sd["sby"].Length > 0) _submittedby = int.Parse(_sd["sby"]);
     if (_sd.ContainsKey("cby") && _sd["cby"].Length > 0) _closedby = int.Parse(_sd["cby"]);
     if (_sd.ContainsKey("acc") && _sd["acc"].Length > 0) _account = int.Parse(_sd["acc"]);
     if (_sd.ContainsKey("accl") && _sd["accl"].Length > 0) _accountLocation = int.Parse(_sd["accl"]);
     if (_sd.ContainsKey("accpl") && _sd["accpl"].Length > 0) _accountParentLocation = int.Parse(_sd["accpl"]);
     if (_sd.ContainsKey("tcht") && _sd["tcht"].Length > 0) technicianType = (TechnicianType)Enum.Parse(typeof(TechnicianType), HttpUtility.UrlDecode(_sd["tcht"]), true);
     if (_sd.ContainsKey("hcc") && _sd["hcc"].Length > 0) handledByCallCenter = (HandledByCallCenter)Enum.Parse(typeof(HandledByCallCenter), HttpUtility.UrlDecode(_sd["hcc"]), true);
     if (_sd.ContainsKey("lvl") && _sd["lvl"].Length > 0) _ticket_level = int.Parse(_sd["lvl"]);
     if (_sd.ContainsKey("sg") && _sd["sg"].Length > 0) _support_group = int.Parse(_sd["sg"]);
     if (_sd.ContainsKey("age") && _sd["age"].Length > 0) _age = int.Parse(_sd["age"]);
     if (_sd.ContainsKey("ager") && _sd["ager"].Length > 0) _age_equal = (EqualRange)Enum.Parse(typeof(EqualRange), HttpUtility.UrlDecode(_sd["ager"]), true);
     if (_sd.ContainsKey("ass") && _sd["ass"].Length > 0) _asset_filter = HttpUtility.UrlDecode(_sd["ass"]);
     if (_sd.ContainsKey("slaw") && _sd["slaw"].Length > 0) _sla_graph_width_id = int.Parse(_sd["slaw"]);
     if (_sd.ContainsKey("slag") && _sd["slag"].Length > 0) _sla_graph_view_id = int.Parse(_sd["slag"]);
 }
Esempio n. 33
0
        ICollection Items_CreateDataSource()
        {
            // Items Show begin
            Items_sSQL = "";
            Items_sCountSQL = "";

            string sWhere = "", sOrder = "";

            bool HasParam = false;

            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            if(Utility.GetParam("FormItems_Sorting").Length>0&&!IsPostBack)
            {ViewState["SortColumn"]=Utility.GetParam("FormItems_Sorting");
             ViewState["SortDir"]="ASC";}
            if(ViewState["SortColumn"]!=null) sOrder = " ORDER BY " + ViewState["SortColumn"].ToString()+" "+ViewState["SortDir"].ToString();

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();

            if(!Params.ContainsKey("category_id")){
            string temp=Utility.GetParam("category_id");
            if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
            Params.Add("category_id",temp);}

            if(!Params.ContainsKey("is_recommended")){
            string temp=Utility.GetParam("is_recommended");
            if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
            Params.Add("is_recommended",temp);}

              if (Params["category_id"].Length>0) {
            HasParam = true;
            sWhere +="i.[category_id]=" + Params["category_id"];
              }
              if (Params["is_recommended"].Length>0) {
            if (sWhere.Length >0) sWhere +=" and ";
            HasParam = true;
            sWhere +="i.[is_recommended]=" + Params["is_recommended"];
              }

              if(HasParam)
            sWhere = " AND (" + sWhere + ")";

            //-------------------------------
            // Build base SQL statement
            //-------------------------------

            Items_sSQL = "select [i].[author] as i_author, " +
            "[i].[category_id] as i_category_id, " +
            "[i].[is_recommended] as i_is_recommended, " +
            "[i].[item_id] as i_item_id, " +
            "[i].[name] as i_name, " +
            "[i].[price] as i_price, " +
            "[c].[category_id] as c_category_id, " +
            "[c].[name] as c_name " +
            " from [items] i, [categories] c" +
            " where [c].[category_id]=i.[category_id]  ";

            //-------------------------------
            //-------------------------------

            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------

              Items_sSQL = Items_sSQL + sWhere + sOrder;
              if (Items_sCountSQL.Length== 0) {
            int iTmpI = Items_sSQL.ToLower().IndexOf("select ");
            int iTmpJ = Items_sSQL.ToLower().LastIndexOf(" from ")-1;
            Items_sCountSQL = Items_sSQL.Replace(Items_sSQL.Substring(iTmpI + 7, iTmpJ-6), " count(*) ");
            iTmpI = Items_sCountSQL.ToLower().IndexOf(" order by");
            if (iTmpI > 1) Items_sCountSQL = Items_sCountSQL.Substring(0, iTmpI);
              }

            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(Items_sSQL, Utility.Connection);
            DataSet ds = new DataSet();

            command.Fill(ds, (i_Items_curpage - 1) * Items_PAGENUM, Items_PAGENUM,"Items");
            OleDbCommand ccommand = new OleDbCommand(Items_sCountSQL, Utility.Connection);
            int PageTemp=(int)ccommand.ExecuteScalar();
            Items_Pager.MaxPage=(PageTemp%Items_PAGENUM)>0?(int)(PageTemp/Items_PAGENUM)+1:(int)(PageTemp/Items_PAGENUM);
            bool AllowScroller=Items_Pager.MaxPage==1?false:true;

            DataView Source;
            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0){
            Items_no_records.Visible = true;
            AllowScroller=false;}
            else
            {Items_no_records.Visible = false;
            AllowScroller=AllowScroller&&true;}

            Items_Pager.Visible=AllowScroller;
            return Source;
            // Items Show end
        }
Esempio n. 34
0
        ICollection original_CreateDataSource()
        {
            // original Show begin
            original_sSQL = "";
            original_sCountSQL = "";

            string sWhere = "", sOrder = "";

            bool HasParam = false;

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();

            if(!Params.ContainsKey("mid")){
            string temp=Utility.GetParam("mid");
            if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
            Params.Add("mid",temp);}

              if (Params["mid"].Length>0) {
            HasParam = true;
            sWhere +="m.[message_id]=" + Params["mid"];
              }

              if(HasParam)
            sWhere = " WHERE (" + sWhere + ")";

            //-------------------------------
            // Build base SQL statement
            //-------------------------------

            original_sSQL = "select [m].[author] as m_author, " +
            "[m].[date_entered] as m_date_entered, " +
            "[m].[message] as m_message, " +
            "[m].[message_id] as m_message_id, " +
            "[m].[topic] as m_topic " +
            " from [messages] m ";

            //-------------------------------
            //-------------------------------

            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------

              original_sSQL = original_sSQL + sWhere + sOrder;
            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(original_sSQL, Utility.Connection);
            DataSet ds = new DataSet();

            command.Fill(ds, 0, original_PAGENUM, "original");
            DataView Source;
            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0){
            original_no_records.Visible = true;
            }
            else
            {original_no_records.Visible = false;
            }

            return Source;
            // original Show end
        }
        /// <summary>
        ///    Arguments Parser Class.
        ///      --  Parses Command Line Arguments passed to a Command Line application.
        ///      --  Accepts the string array of arguments that was captured by the application
        ///          at startup.
        ///      --  Parameters should be prefixed with one of the following characters ("-",
        ///          "--", "/", ":").
        ///      --  Calling Syntax:  PDX.BTS.DataMaintenanceUtilites.ArgumentParser commandLine = new PDX.BTS.DataMaintenanceUtilities.ArgumentParser(args);
        ///            -  Returns a String Array of the Parameters with the parameter names as
        ///               the array indices.
        ///            -  For example in the resulting array, the value for the Parameter
        ///               "DataPath" (passed as /DataPath=C:\) will be obtained with -
        ///               commandLine["DataPath"].
        ///            -  For Boolean arguments.  To determine if the parameter was passed is -
        ///               "Usage" (passed as /Usage) will be determined by testing -
        ///               if (commandLine["Usage"] == "true")
        /// </summary>
        // Constructor Method
        public ArgumentParser(string[] Args)
        {
            System.Text.RegularExpressions.Regex splitter         = null;
              System.Text.RegularExpressions.Regex remover          = null;
              string                               currentParameter = null;
              string[]                             parameterParts   = null;

              try
              {
            //  Instantiate a String Dictionary Object to hold the parameters that are found.
            _parsedParameters = new System.Collections.Specialized.StringDictionary();

            //  Set the Set of values that will be searched to find the parameter start
            //  identifiers ("-", "--", "/", or ":").
            splitter = new System.Text.RegularExpressions.Regex(@"^-{1,2}|^/|=|:",
                                  System.Text.RegularExpressions.RegexOptions.IgnoreCase |
                                  System.Text.RegularExpressions.RegexOptions.Compiled);

            //  Set the Set of values that will be removed from the Parameters strings ("'", ".*").
            remover = new System.Text.RegularExpressions.Regex(@"^['""]?(.*?)['""]?$",
                                  System.Text.RegularExpressions.RegexOptions.IgnoreCase |
                                  System.Text.RegularExpressions.RegexOptions.Compiled);

            // Valid parameters forms:  {-,/,--}param{ ,=,:}((",')value(",'))
            // Examples:  -param1 value1 --param2 /param3:"Test-:-work"
            //           /param4=happy -param5 '--=nice=--'
            foreach (string currentTextString in Args)
            {
              // Look for new parameters (-,/ or --) and a possible enclosed value (=,:)
              parameterParts = splitter.Split(currentTextString, 3);

              //  Populate the String Dictionary Object with the values in the current parameter.
              switch (parameterParts.Length)
              {
            // Found a value (for the last parameter found (space separator))
            case 1:
              if (currentParameter != null)
              {
                if (!_parsedParameters.ContainsKey(currentParameter))
                {
                  parameterParts[0] = remover.Replace(parameterParts[0], "$1");
                  _parsedParameters.Add(currentParameter, parameterParts[0]);
                }
                currentParameter = null;
              }
              // else Error: no parameter waiting for a value (skipped)
              break;
            // Found just a parameter
            case 2:
              // The last parameter is still waiting.  With no value, set it to true.
              if (currentParameter != null)
              {
                if (!_parsedParameters.ContainsKey(currentParameter))
                {
                  _parsedParameters.Add(currentParameter, "true");
                }
              }
              currentParameter = parameterParts[1];
              //  Exit this case.
              break;
            // Parameter with enclosed value
            case 3:
              // The last parameter is still waiting.  With no value, set it to true.
              if (currentParameter != null)
              {
                if (!_parsedParameters.ContainsKey(currentParameter))
                {
                  _parsedParameters.Add(currentParameter, "true");
                }
              }
              currentParameter = parameterParts[1];
              // Remove possible enclosing characters (",')
              if (!_parsedParameters.ContainsKey(currentParameter))
              {
                parameterParts[2] = remover.Replace(parameterParts[2], "$1");
                _parsedParameters.Add(currentParameter, parameterParts[2]);
              }
              currentParameter = null;
              //  Exit this case.
              break;
              }
            }

            // In case a parameter is still waiting
            if (currentParameter != null)
            {
              if (!_parsedParameters.ContainsKey(currentParameter))
              {
            _parsedParameters.Add(currentParameter, "true");
              }

            }

              }
              catch
              {
            //  Exit the method.
            return;

              }
        }
Esempio n. 36
0
        ICollection replies_CreateDataSource()
        {
            // replies Show begin
            replies_sSQL = "";
            replies_sCountSQL = "";

            string sWhere = "", sOrder = "";

            bool HasParam = false;

            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            sOrder = " order by m.date_entered Desc";
            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();

            if(!Params.ContainsKey("mid")){
            string temp=Utility.GetParam("mid");
            if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
            Params.Add("mid",temp);}

              if (Params["mid"].Length>0) {
            HasParam = true;
            sWhere +="m.[message_parent_id]=" + Params["mid"];
              }

              if(HasParam)
            sWhere = " WHERE (" + sWhere + ")";

            //-------------------------------
            // Build base SQL statement
            //-------------------------------

            replies_sSQL = "select [m].[author] as m_author, " +
            "[m].[date_entered] as m_date_entered, " +
            "[m].[message] as m_message, " +
            "[m].[message_parent_id] as m_message_parent_id, " +
            "[m].[smiley_id] as m_smiley_id, " +
            "[m].[topic] as m_topic " +
            " from [messages] m ";

            //-------------------------------
            //-------------------------------

            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------

              replies_sSQL = replies_sSQL + sWhere + sOrder;
              if (replies_sCountSQL.Length== 0) {
            int iTmpI = replies_sSQL.ToLower().IndexOf("select ");
            int iTmpJ = replies_sSQL.ToLower().LastIndexOf(" from ")-1;
            replies_sCountSQL = replies_sSQL.Replace(replies_sSQL.Substring(iTmpI + 7, iTmpJ-6), " count(*) ");
            iTmpI = replies_sCountSQL.ToLower().IndexOf(" order by");
            if (iTmpI > 1) replies_sCountSQL = replies_sCountSQL.Substring(0, iTmpI);
              }

            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(replies_sSQL, Utility.Connection);
            DataSet ds = new DataSet();

            command.Fill(ds, (i_replies_curpage - 1) * replies_PAGENUM, replies_PAGENUM,"replies");
            OleDbCommand ccommand = new OleDbCommand(replies_sCountSQL, Utility.Connection);
            int PageTemp=(int)ccommand.ExecuteScalar();
            replies_Pager.MaxPage=(PageTemp%replies_PAGENUM)>0?(int)(PageTemp/replies_PAGENUM)+1:(int)(PageTemp/replies_PAGENUM);
            bool AllowScroller=replies_Pager.MaxPage==1?false:true;

            DataView Source;
            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0){
            replies_no_records.Visible = true;
            AllowScroller=false;}
            else
            {replies_no_records.Visible = false;
            AllowScroller=AllowScroller&&true;}

            replies_Pager.Visible=AllowScroller;
            return Source;
            // replies Show end
        }
Esempio n. 37
0
        ICollection Orders_CreateDataSource()
        {
            // Orders Show begin
            Orders_sSQL = "";
            Orders_sCountSQL = "";

            string sWhere = "", sOrder = "";

            bool HasParam = false;

            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            sOrder = " order by o.order_id Asc";
            if(Utility.GetParam("FormOrders_Sorting").Length>0&&!IsPostBack)
            {ViewState["SortColumn"]=Utility.GetParam("FormOrders_Sorting");
             ViewState["SortDir"]="ASC";}
            if(ViewState["SortColumn"]!=null) sOrder = "ORDER BY @SortColumn @SortDir";

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();

            if(!Params.ContainsKey("item_id")){
            string temp=Utility.GetParam("item_id");
            if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
            Params.Add("item_id",temp);}

            if(!Params.ContainsKey("member_id")){
            string temp=Utility.GetParam("member_id");
            if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
            Params.Add("member_id",temp);}

              if (Params["item_id"].Length>0) {
            HasParam = true;
            sWhere +="o.[item_id]=" + Params["item_id"];
              }
              if (Params["member_id"].Length>0) {
            if (sWhere.Length >0) sWhere +=" and ";
            HasParam = true;
            sWhere +="o.[member_id]=" + Params["member_id"];
              }

              if(HasParam)
            sWhere = " AND (" + sWhere + ")";

            //-------------------------------
            // Build base SQL statement
            //-------------------------------

            Orders_sSQL = "select [o].[item_id] as o_item_id, " +
            "[o].[member_id] as o_member_id, " +
            "[o].[order_id] as o_order_id, " +
            "[o].[quantity] as o_quantity, " +
            "[i].[item_id] as i_item_id, " +
            "[i].[name] as i_name, " +
            "[m].[member_id] as m_member_id, " +
            "[m].[member_login] as m_member_login " +
            " from [orders] o, [items] i, [members] m" +
            " where [i].[item_id]=o.[item_id] and [m].[member_id]=o.[member_id]  ";

            //-------------------------------
            //-------------------------------

            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------

              Orders_sSQL = Orders_sSQL + sWhere + sOrder;
              if (Orders_sCountSQL.Length== 0) {
            int iTmpI = Orders_sSQL.ToLower().IndexOf("select ");
            int iTmpJ = Orders_sSQL.ToLower().LastIndexOf(" from ")-1;
            Orders_sCountSQL = Orders_sSQL.Replace(Orders_sSQL.Substring(iTmpI + 7, iTmpJ-6), " count(*) ");
            iTmpI = Orders_sCountSQL.ToLower().IndexOf(" order by");
            if (iTmpI > 1) Orders_sCountSQL = Orders_sCountSQL.Substring(0, iTmpI);
              }

            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(Orders_sSQL, Utility.Connection);
                    command.SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("@SortColumn", viewstate["SortColumn"]));
                    command.SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("@SortDir", viewstate["SortDir"]));

            DataSet ds = new DataSet();

            command.Fill(ds, (i_Orders_curpage - 1) * Orders_PAGENUM, Orders_PAGENUM,"Orders");
            OleDbCommand ccommand = new OleDbCommand(Orders_sCountSQL, Utility.Connection);
            int PageTemp=(int)ccommand.ExecuteScalar();
            Orders_Pager.MaxPage=(PageTemp%Orders_PAGENUM)>0?(int)(PageTemp/Orders_PAGENUM)+1:(int)(PageTemp/Orders_PAGENUM);
            bool AllowScroller=Orders_Pager.MaxPage==1?false:true;

            DataView Source;
            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0){
            Orders_no_records.Visible = true;
            AllowScroller=false;}
            else
            {Orders_no_records.Visible = false;
            AllowScroller=AllowScroller&&true;}

            Orders_Pager.Visible=AllowScroller;
            return Source;
            // Orders Show end
        }
Esempio n. 38
0
        /*
        [System.Runtime.InteropServices.DllImport("User32.Dll")]
        public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

        public const int EM_LINEINDEX = 0xBB;
        public const int EM_LINEFROMCHAR = 0xC9;
        */
        /*
        public static void shell_execute(IWin32Window error_parent, string path)
        {
            try
            {
                System.Diagnostics.Process p = new System.Diagnostics.Process();
                p.StartInfo.UseShellExecute = true;
                p.StartInfo.FileName = path;
                p.Start();
            }
            catch (Exception ex)
            {
                Lib.ShowError(ex);
            }
        }
        */
        /* Intelligent search for a file or directory by name, on the hard disk.
         * Can throw exceptions on some errors, while silently ignore other.
         *
         * targetName - name of the target like "fxc.exe" or path suffix like @"bin\x86\fxc.exe".
         * interestingDirNames - case-insensitive strings with parts of
         *     directory names that make these directories particularly
         *     interesting, while not very common.
         *     Example: { "microsoft", "dx", "directx", "sdk" }
         * startDirs - paths to directories to start search from. For example,
         *     path to Program Files or hard disk root directories.
         *
         * Returns path to found target or null if not found in given time.
         */
        public static string IntelligentSearch(string targetName, bool targetIsDirectory, string[] interestingDirNames, string[] startDirs, TimeSpan timeout)
        {
            DateTime endTime = DateTime.Now + timeout;

            // Paths to process
            LinkedList<string> PathQueue = new LinkedList<string>();
            // Path already processed in form Key=Path, Value="1"
            System.Collections.Specialized.StringDictionary Processed = new System.Collections.Specialized.StringDictionary();

            foreach (string startDir in startDirs)
                PathQueue.AddLast(startDir);

            // Processing loop - berform breadth first search (BFS) algorithm
            while (PathQueue.Count > 0)
            {
                // Get directory to process
                string Dir = PathQueue.First.Value;
                PathQueue.RemoveFirst();
                // Already processed
                if (Processed.ContainsKey(Dir))
                    continue;
                // Add to processed
                Processed.Add(Dir, "1");

                try
                {
                    string targetPath = Path.Combine(Dir, targetName);
                    if (targetIsDirectory)
                    {
                        if (Directory.Exists(targetPath))
                            return targetPath;
                    }
                    else
                    {
                        if (File.Exists(targetPath))
                            return targetPath;
                    }

                    foreach (string SubDir in Directory.GetDirectories(Dir))
                    {
                        bool dirIsInteresting = false;
                        if (interestingDirNames != null && interestingDirNames.Length > 0)
                        {
                            string subDirName = Path.GetFileName(SubDir);
                            foreach (string interestingName in interestingDirNames)
                            {
                                if (subDirName.IndexOf(interestingName, StringComparison.InvariantCultureIgnoreCase) != -1)
                                {
                                    dirIsInteresting = true;
                                    break;
                                }
                            }
                        }

                        if (dirIsInteresting)
                            PathQueue.AddFirst(SubDir);
                        else
                            PathQueue.AddLast(SubDir);
                    }
                }
                catch (Exception) { }

                if (DateTime.Now > endTime)
                    return null;
            }

            return null;
        }
Esempio n. 39
0
ICollection Results_CreateDataSource() {

       
       // Results Show begin
	Results_sSQL = "";
	Results_sCountSQL = "";

	string sWhere = "", sOrder = "";

	
	bool HasParam = false;
	
	
	//-------------------------------
	// Build ORDER BY statement
	//-------------------------------
	sOrder = " order by i.name Asc";
	//-------------------------------
	// Build WHERE statement
	//-------------------------------
	System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
	
	
	if(!Params.ContainsKey("author")){
	string temp=Utility.GetParam("author");
	Params.Add("author",temp);}
	
	if(!Params.ContainsKey("category_id")){
	string temp=Utility.GetParam("category_id");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("category_id",temp);}
	
	if(!Params.ContainsKey("name")){
	string temp=Utility.GetParam("name");
	Params.Add("name",temp);}
	
	if(!Params.ContainsKey("pricemax")){
	string temp=Utility.GetParam("pricemax");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("pricemax",temp);}
	
	if(!Params.ContainsKey("pricemin")){
	string temp=Utility.GetParam("pricemin");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("pricemin",temp);}
	
	  if (Params["author"].Length>0) {
	    HasParam = true;
	    sWhere +="i.[author] like '%" + Params["author"].Replace( "'", "''") +  "%'";
	  }
	  if (Params["category_id"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[category_id]=" + Params["category_id"];
	  }
	  if (Params["name"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[name] like '%" + Params["name"].Replace( "'", "''") +  "%'";
	  }
	  if (Params["pricemax"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[price]<" + Params["pricemax"];
	  }
	  if (Params["pricemin"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[price]>" + Params["pricemin"];
	  }

	
	  if(HasParam)
	    sWhere = " AND (" + sWhere + ")";

	//-------------------------------
	// Build base SQL statement
	//-------------------------------


	Results_sSQL = "select [i].[author] as i_author, " +
    "[i].[category_id] as i_category_id, " +
    "[i].[image_url] as i_image_url, " +
    "[i].[item_id] as i_item_id, " +
    "[i].[name] as i_name, " +
    "[i].[price] as i_price, " +
    "[c].[category_id] as c_category_id, " +
    "[c].[name] as c_name " +
    " from [items] i, [categories] c" +
    " where [c].[category_id]=i.[category_id]  ";
	
	//-------------------------------
	//-------------------------------
	

	//-------------------------------

	//-------------------------------
	// Assemble full SQL statement
	//-------------------------------



	  Results_sSQL = Results_sSQL + sWhere + sOrder;
	  if (Results_sCountSQL.Length== 0) {
	    int iTmpI = Results_sSQL.ToLower().IndexOf("select ");
	    int iTmpJ = Results_sSQL.ToLower().LastIndexOf(" from ")-1;
	    Results_sCountSQL = Results_sSQL.Replace(Results_sSQL.Substring(iTmpI + 7, iTmpJ-6), " count(*) ");
	    iTmpI = Results_sCountSQL.ToLower().IndexOf(" order by");
	    if (iTmpI > 1) Results_sCountSQL = Results_sCountSQL.Substring(0, iTmpI);
	  }
	  
	  
	//-------------------------------
	
	OleDbDataAdapter command = new OleDbDataAdapter(Results_sSQL, Utility.Connection);
	DataSet ds = new DataSet();
	
	command.Fill(ds, (i_Results_curpage - 1) * Results_PAGENUM, Results_PAGENUM,"Results");
	OleDbCommand ccommand = new OleDbCommand(Results_sCountSQL, Utility.Connection);
	int PageTemp=(int)ccommand.ExecuteScalar();
	Results_Pager.MaxPage=(PageTemp%Results_PAGENUM)>0?(int)(PageTemp/Results_PAGENUM)+1:(int)(PageTemp/Results_PAGENUM);
	bool AllowScroller=Results_Pager.MaxPage==1?false:true;
	
	DataView Source;
        Source = new DataView(ds.Tables[0]);

		if (ds.Tables[0].Rows.Count == 0){
			Results_no_records.Visible = true;
			AllowScroller=false;}
		else
			{Results_no_records.Visible = false;
			AllowScroller=AllowScroller&&true;}
		
		Results_Pager.Visible=AllowScroller;
		return Source;
		// Results Show end
		
	}
Esempio n. 40
0
ICollection Total_CreateDataSource() {

       
       // Total Show begin
	Total_sSQL = "";
	Total_sCountSQL = "";

	string sWhere = "", sOrder = "";

	
	bool bReq = true;
	bool HasParam = false;
	
	
	//-------------------------------
	// Build WHERE statement
	//-------------------------------
	System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
	
	
	if(!Params.ContainsKey("UserID")){
	object Temp=Session["UserID"];
	string temp;
	if(Temp==null)temp=""; else temp=Temp.ToString();
	
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("UserID",temp);}
	
	  if (Params["UserID"].Length>0) {
	    HasParam = true;
	    sWhere +="[member_id]=" + Params["UserID"];
	  }else{bReq = false;
	  }

	
	  if(HasParam)
	    sWhere = " AND (" + sWhere + ")";

	//-------------------------------
	// Build base SQL statement
	//-------------------------------


	Total_sSQL = "SELECT member_id, sum(quantity*price) as sub_total FROM items, orders WHERE orders.item_id=items.item_id";
  sOrder = " GROUP BY member_id";
	
	//-------------------------------
	//-------------------------------
	

	//-------------------------------

	//-------------------------------
	// Assemble full SQL statement
	//-------------------------------



	  Total_sSQL = Total_sSQL + sWhere + sOrder;
	//-------------------------------
	
	if(!bReq){
		Total_no_records.Visible = true;
		
		return null;
	}
	OleDbDataAdapter command = new OleDbDataAdapter(Total_sSQL, Utility.Connection);
	DataSet ds = new DataSet();
	 	
	command.Fill(ds, 0, Total_PAGENUM, "Total");
	DataView Source;
        Source = new DataView(ds.Tables[0]);

		if (ds.Tables[0].Rows.Count == 0){
			Total_no_records.Visible = true;
			}
		else
			{Total_no_records.Visible = false;
			}
		
		
		return Source;
		// Total Show end
		
	}
Esempio n. 41
0
ICollection Total_CreateDataSource() {

       
       // Total Show begin
	Total_sSQL = "";
	Total_sCountSQL = "";

	string sWhere = "", sOrder = "";

	
	bool HasParam = false;
	
	
	//-------------------------------
	// Build WHERE statement
	//-------------------------------
	System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
	
	
	if(!Params.ContainsKey("author")){
	string temp=Utility.GetParam("author");
	Params.Add("author",temp);}
	
	if(!Params.ContainsKey("category_id")){
	string temp=Utility.GetParam("category_id");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("category_id",temp);}
	
	if(!Params.ContainsKey("name")){
	string temp=Utility.GetParam("name");
	Params.Add("name",temp);}
	
	if(!Params.ContainsKey("pricemax")){
	string temp=Utility.GetParam("pricemax");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("pricemax",temp);}
	
	if(!Params.ContainsKey("pricemin")){
	string temp=Utility.GetParam("pricemin");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("pricemin",temp);}
	
	  if (Params["author"].Length>0) {
	    HasParam = true;
	    sWhere +="i.[author] like '%" + Params["author"].Replace( "'", "''") +  "%'";
	  }
	  if (Params["category_id"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[category_id]=" + Params["category_id"];
	  }
	  if (Params["name"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[name] like '%" + Params["name"].Replace( "'", "''") +  "%'";
	  }
	  if (Params["pricemax"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[price]<=" + Params["pricemax"];
	  }
	  if (Params["pricemin"].Length>0) {
	    if (sWhere.Length >0) sWhere +=" and ";
	    HasParam = true;
	    sWhere +="i.[price]>=" + Params["pricemin"];
	  }

	
	  if(HasParam)
	    sWhere = " WHERE (" + sWhere + ")";

	//-------------------------------
	// Build base SQL statement
	//-------------------------------


	Total_sSQL = "select [i].[author] as i_author, " +
    "[i].[category_id] as i_category_id, " +
    "[i].[item_id] as i_item_id, " +
    "[i].[name] as i_name, " +
    "[i].[price] as i_price " +
    " from [items] i ";
	
	//-------------------------------
	//-------------------------------
	
Total_Open(ref sWhere, ref sOrder);
	//-------------------------------

	//-------------------------------
	// Assemble full SQL statement
	//-------------------------------



	  Total_sSQL = Total_sSQL + sWhere + sOrder;
	//-------------------------------
	
	OleDbDataAdapter command = new OleDbDataAdapter(Total_sSQL, Utility.Connection);
	DataSet ds = new DataSet();
	 	
	command.Fill(ds, 0, Total_PAGENUM, "Total");
	DataView Source;
        Source = new DataView(ds.Tables[0]);

		if (ds.Tables[0].Rows.Count == 0){
			Total_no_records.Visible = true;
			}
		else
			{Total_no_records.Visible = false;
			}
		
		
		return Source;
		// Total Show end
		
	}
Esempio n. 42
0
static void FillBeitraegeImZeitraum (SqlConnection WPMediaConnection, DataSet BeitraegeImZeitraumDataSet,
			String SenderName, DateTime GlobalFrom, DateTime GlobalTo)
	{
	if ((GlobalFrom == DateTime.MinValue)
		&& (GlobalTo == DateTime.MaxValue))
		{
		FillAndAddNewTableToDataSetAccordingToSqlStatement
			(WPMediaConnection, BeitraegeImZeitraumDataSet, "BeitraegeImZeitraum", String.Format
			(SQL_BEITRAEGE_IM_ZEITRAUM_OHNE_TIMINGS));
		return;

		}

	String From = GlobalFrom.ToString (WMB.Basics.ISO_DATE_TIME_FORMAT);
	String To = GlobalTo.ToString (WMB.Basics.ISO_DATE_TIME_FORMAT);
	if (SenderName == "")
		{
		FillAndAddNewTableToDataSetAccordingToSqlStatement
			(WPMediaConnection, BeitraegeImZeitraumDataSet, "BeitraegeImZeitraum", String.Format
			(SQL_BEITRAEGE_IM_ZEITRAUM_ALLE_SENDER,
			From, To));
		return;
		}

	String SenderGuidString = SetSenderData (WPMediaConnection, SenderName);
	if (String.IsNullOrEmpty (SenderGuidString))

		{
		return;
		}
	FillAndAddNewTableToDataSetAccordingToSqlStatement
		(WPMediaConnection, BeitraegeImZeitraumDataSet, "BeitraegeImZeitraum", String.Format
		(SQL_BEITRAEGE_IM_ZEITRAUM_EIN_SENDER,
		From, To, SenderGuidString));


	DataTable SendungsZuordnungen = CreateAndFillNewTableAccordingToSqlStatement
		(WPMediaConnection, String.Format("Select * from BeitraegeZuSendernZugeordnet where SenderID = '{0}'", SenderGuidString));

	Char [] OptionDelimitter = new Char [] { ';' };
	Char [] OptionContentDelimitter = new Char [] { ':' };
	Char [] TrimCharacters = new Char [] { '(', ')' };
	ArrayList BackGroundIDs = new ArrayList ();

	foreach (DataRow BeitragRow in BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].Rows)
		{
		String BeitragID = BeitragRow ["BeitragID"].ToString ();
		DataRow [] SendungsZuordnungenGefunden = SendungsZuordnungen.
					Select ("BeitragID = '" + BeitragID + "'");
		if (SendungsZuordnungenGefunden.Length != 0)
			{
			String [] OptionsStrings = BeitragRow ["BeitragProperties"].
							ToString ().Split (OptionDelimitter);
			foreach (String OptionString in OptionsStrings)
				{
				String [] SingleOption = OptionString.Trim (TrimCharacters).Split (OptionContentDelimitter);
				if (SingleOption.Length == 2)
					{
					if (SingleOption [0] == CVM.DataHandling.OPTION_BACKGROUND_BEITRAG)
						{
						if (!String.IsNullOrEmpty (SingleOption [1]))
							{
							String [] Elements = SingleOption [1].Split ('|');
							if (Elements.Length == 2)
								BackGroundIDs.Add (Elements [1]);
							}
						}
					}
				}
			}
		}



	foreach (DataRow BeitragRow in BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].Rows)
		{
		String BeitragID = BeitragRow ["BeitragID"].ToString ();
		String Name = BeitragRow ["Name"].ToString ();
		bool IsABackGroundBeitrag = false;
		foreach (String BackGroundID in BackGroundIDs)
			{
			if (BackGroundID == BeitragID)
				{
				IsABackGroundBeitrag = true;
				break;
				}
			}
		if (IsABackGroundBeitrag)
			continue;
		DataRow [] SendungsZuordnungenGefunden = SendungsZuordnungen.
					Select ("BeitragID = '" + BeitragID + "'");
		if (SendungsZuordnungenGefunden.Length == 0)
			{
			if (( BeitragRow ["Name"].ToString () != CVM.CommonValues.NAME_FOR_BEITRAG_PREVIEW_BEITRAG )
				&& ( BeitragRow ["Name"].ToString () != CVM.CommonValues.NAME_FOR_BEITRAG_POSTVIEW_BEITRAG )
				&& ( BeitragRow ["Name"].ToString () != WPMediaManagement.ManagedProgrammData.BLOCK_PREVIEW ))
				BeitragRow.Delete ();
			}
		else
			continue;
		}
	BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].AcceptChanges ();
	int CountBeforeUnique = BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].Rows.Count;
	System.Collections.Specialized.StringDictionary UniqueBeitraege
			= new System.Collections.Specialized.StringDictionary ();

	foreach (DataRow BeitragRow in BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].Rows)
		{
		String BeitragID = BeitragRow ["BeitragID"].ToString ();
		if (UniqueBeitraege.ContainsKey (BeitragID) == true)
			{
			BeitragRow.Delete ();
			}
		else
			{
			UniqueBeitraege.Add (BeitragID, "");
			}
		}

	BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].AcceptChanges ();
	int CountAfterUnique = BeitraegeImZeitraumDataSet.Tables ["BeitraegeImZeitraum"].Rows.Count;
	}
Esempio n. 43
0
        // On error or failure, returns null.
        private static string locate_fxc_on_disk()
        {
            try
            {
                long EndTime = DateTime.Now.Ticks + MAX_LOCATE_TIME;

                // Paths to process
                System.Collections.Generic.LinkedList<string> PathQueue = new System.Collections.Generic.LinkedList<string>();
                // Path already processed in form Key=Path, Value="1"
                System.Collections.Specialized.StringDictionary Processed = new System.Collections.Specialized.StringDictionary();

                // Add default paths
                // - Program files
                PathQueue.AddLast(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
                // - Hard disks
                foreach (DriveInfo Drive in DriveInfo.GetDrives())
                    if (Drive.DriveType == DriveType.Fixed)
                        PathQueue.AddLast(Drive.RootDirectory.Name);

                // Processing loop - berform breadth first search (BFS) algorithm
                while (PathQueue.Count > 0)
                {
                    // Get directory to process
                    string Dir = PathQueue.First.Value;
                    PathQueue.RemoveFirst();
                    // Already processed
                    if (Processed.ContainsKey(Dir))
                        continue;
                    // Add to processed
                    Processed.Add(Dir, "1");

                    try
                    {
                        // Look for fxc.exe file
                        string[] FxcFiles = Directory.GetFiles(Dir, "fxc.exe");
                        if (FxcFiles.Length > 0)
                            return FxcFiles[0];

                        // Look for subdirectories
                        foreach (string SubDir in Directory.GetDirectories(Dir))
                        {
                            // Interesting directory - add at the beginning of the queue
                            if (DirectoryIsInteresting(SubDir))
                                PathQueue.AddFirst(SubDir);
                            // Not interesting - add at the end of the queue
                            else
                                PathQueue.AddLast(SubDir);
                        }
                    }
                    catch (Exception ) { }

                    // Time out
                    if (DateTime.Now.Ticks >= EndTime)
                        return null;
                }

                // Not found
                return null;
            }
            catch (Exception )
            {
                return null;
            }
        }
Esempio n. 44
0
ICollection Orders_CreateDataSource() {

       
       // Orders Show begin
	Orders_sSQL = "";
	Orders_sCountSQL = "";

	string sWhere = "", sOrder = "";

	
	bool bReq = true;
	bool HasParam = false;
	
	
	//-------------------------------
	// Build ORDER BY statement
	//-------------------------------
	if(Utility.GetParam("FormOrders_Sorting").Length>0&&!IsPostBack)
	{ViewState["SortColumn"]=Utility.GetParam("FormOrders_Sorting");
	 ViewState["SortDir"]="ASC";}
	if(ViewState["SortColumn"]!=null) sOrder = " ORDER BY " + ViewState["SortColumn"].ToString()+" "+ViewState["SortDir"].ToString();
	
	//-------------------------------
	// Build WHERE statement
	//-------------------------------
	System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
	
	
	if(!Params.ContainsKey("member_id")){
	string temp=Utility.GetParam("member_id");
	if (Utility.IsNumeric(null,temp) && temp.Length>0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number);} else {temp = "";}
	Params.Add("member_id",temp);}
	
	  if (Params["member_id"].Length>0) {
	    HasParam = true;
	    sWhere +="o.[member_id]=" + Params["member_id"];
	  }else{bReq = false;
	  }

	
	  if(HasParam)
	    sWhere = " AND (" + sWhere + ")";

	//-------------------------------
	// Build base SQL statement
	//-------------------------------


	Orders_sSQL = "select [o].[item_id] as o_item_id, " +
    "[o].[member_id] as o_member_id, " +
    "[o].[order_id] as o_order_id, " +
    "[o].[quantity] as o_quantity, " +
    "[i].[item_id] as i_item_id, " +
    "[i].[name] as i_name " +
    " from [orders] o, [items] i" +
    " where [i].[item_id]=o.[item_id]  ";
	
	//-------------------------------
	//-------------------------------
	

	//-------------------------------

	//-------------------------------
	// Assemble full SQL statement
	//-------------------------------



	  Orders_sSQL = Orders_sSQL + sWhere + sOrder;
	//-------------------------------
	
	if(!bReq){
		Orders_no_records.Visible = true;
		
		return null;
	}
	OleDbDataAdapter command = new OleDbDataAdapter(Orders_sSQL, Utility.Connection);
	DataSet ds = new DataSet();
	 	
	command.Fill(ds, 0, Orders_PAGENUM, "Orders");
	DataView Source;
        Source = new DataView(ds.Tables[0]);

		if (ds.Tables[0].Rows.Count == 0){
			Orders_no_records.Visible = true;
			}
		else
			{Orders_no_records.Visible = false;
			}
		
		
		return Source;
		// Orders Show end
		
	}