// Load configuration from file
        // Call at startup.
        public static void Load()
        {
            m_Data = new System.Collections.Specialized.StringDictionary();

            string config_file_path = Path.Combine(Globals.calc_application_data_dir(), CONFIG_FILE_NAME);
            using (System.IO.StreamReader file = new System.IO.StreamReader(config_file_path))
            {
                string Line;
                while ((Line = file.ReadLine()) != null)
                {
                    Line = Line.Trim();
                    if (Line.Length == 0)
                        continue;

                    int EqPos = Line.IndexOf('=');
                    if (EqPos == -1)
                        throw new Exception("Error in configuration file: " + config_file_path);
                    string Key = Line.Substring(0, EqPos);
                    string Value = Line.Substring(EqPos + 1);
                    if (Key.Length == 0)
                        throw new Exception("Error in configuration file: " + config_file_path);
                    m_Data.Add(Key, Value);
                }
            }
        }
示例#2
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            btnSend.Enabled = false;
            System.Collections.Specialized.StringDictionary dictionary = new System.Collections.Specialized.StringDictionary();
            dictionary.Add("application", ApplicationName);
            dictionary.Add("version", Version);
            dictionary.Add("error", Ex.Message.Trim());
            dictionary.Add("inner_exception", Ex.InnerException == null ? "" : Ex.InnerException.Message.Trim());
            dictionary.Add("stacktrace", FormatForXml(Ex.StackTrace.Trim()));

            // Temporary error reporting mechanism

            ClipboardText = FormatErrorAsXml(dictionary);
            System.Threading.Thread t = new System.Threading.Thread(CopyToClipboardThreadSafe);
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();

            // end temp

            //if (Utility.SendHttpPost(SubmitUrl, dictionary))
            //{
            //    Cursor = Cursors.Default;
            //    lblBoldPleed.Text = "Successfully reported.";
            //    txtDescription.Visible = false;
            //    lblGeneralDescription.Visible = false;
            //    chkIgnore.Visible = false;
            //    btnDontSend.Text = "Close";
            //}
            //else
            //{
            //    Cursor = Cursors.Default;
            //    btnSend.Enabled = true;

            //    if (MessageBox.Show("Message could not be sent. Do you want to copy the message to your clipboard so that you can paste it into an email to [email protected]?", "Unsuccessful", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            //    {
            //        ClipboardText = FormatErrorAsXml(dictionary);
            //        System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(CopyToClipboardThreadSafe));
            //        t.SetApartmentState(System.Threading.ApartmentState.STA);
            //        t.Start();
            //    }
            //}
        }
 /// <summary>
 /// Toes the dictionary.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <returns></returns>
 public static System.Collections.Specialized.StringDictionary ToDictionary(this DataRow row)
 {
     DataColumnCollection columns = row.Table.Columns;
     System.Collections.Specialized.StringDictionary dic = new System.Collections.Specialized.StringDictionary();
     foreach (DataColumn dc in columns)
     {
         if(row.IsNull(dc) == false)
         {
             dic.Add(dc.ColumnName, row[dc].ToString());
         }
     }
     return dic;
 }
        //============================================================
        //	PUBLIC ROUTINES
        //============================================================
        #region Save()
        /// <summary>
        /// Saves the settings to disk.
        /// </summary>
        public void Save()
        {
            System.Collections.Specialized.StringDictionary dic = new System.Collections.Specialized.StringDictionary();
            Type settingsType = this.GetType();

            //------------------------------------------------------------
            //	Enumerate through settings properties
            //------------------------------------------------------------
            foreach (PropertyInfo propertyInformation in settingsType.GetProperties())
            {
                if (propertyInformation.Name != "Instance")
                {
                    //------------------------------------------------------------
                    //	Extract property value and its string representation
                    //------------------------------------------------------------
                    object propertyValue = propertyInformation.GetValue(this, null);

                    string valueAsString;
                    //------------------------------------------------------------
                    //	Format null/default property values as empty strings
                    //------------------------------------------------------------
                    if (propertyValue == null || propertyValue.Equals(Int32.MinValue) || propertyValue.Equals(Single.MinValue))
                    {
                        valueAsString = String.Empty;
                    }
                    else
                    {
                        valueAsString = propertyValue.ToString();
                    }
                    //------------------------------------------------------------
                    //	Write property name/value pair
                    //------------------------------------------------------------
                    dic.Add(propertyInformation.Name, valueAsString);
                }
            }

            Providers.TrainService.SaveSettings(dic);
            OnChanged();
        }
示例#5
0
        protected virtual void SetChecked(string checkedNames)
        {
            string[] keys = checkedNames.Split(_seperator);

            System.Collections.Specialized.StringDictionary maps = new System.Collections.Specialized.StringDictionary();

            foreach (string key in keys)
            {
                if (!maps.ContainsKey(key))
                {
                    maps.Add(key, string.Empty);
                }
            }

            _checkedNames = string.Empty;

            foreach (RadItem ri in base.Items)
            {
                RadCheckComboBoxItem chk = ri as RadCheckComboBoxItem;
                if (chk != null)
                {
                    // case insensitive
                    chk.IsChecked = maps.ContainsKey(chk.Name) ? true : false;
                }
            }

            _checkedNames = string.Empty;

            foreach (RadItem ri in base.Items)
            {
                RadCheckComboBoxItem chk = ri as RadCheckComboBoxItem;
                if (chk != null && chk.IsChecked)
                {
                    _checkedNames += chk.Name + _seperator;
                }
            }

            _checkedNames = _checkedNames.Trim(new char[] { _seperator, ' ' });
        }
示例#6
0
        private static void R_XML2Dic(XmlNode objNode, string sPrefix, ref System.Collections.Specialized.StringDictionary dicContents)
        {
            //recursive function to dump xml document into key_value pairs
            XmlNode objChildNode;
            string  sNodeName;

            foreach (XmlNode tempLoopVar_objChildNode in objNode.ChildNodes)
            {
                objChildNode = tempLoopVar_objChildNode;
                if (objChildNode.Name == "#text")
                {
                    sNodeName = sPrefix.Substring(0, sPrefix.Length - 1);
                    if (!dicContents.ContainsKey(sNodeName))
                    {
                        dicContents.Add(sNodeName, objChildNode.Value);
                    }
                }
                if (objChildNode.ChildNodes.Count > 0)
                {
                    R_XML2Dic(objChildNode, sPrefix + objChildNode.Name + "_", ref dicContents);
                }
            }
        }
示例#7
0
        private void SetChecked(string checkedNames)
        {
            string[] keys = checkedNames.Split(new char[] { ',' });

            System.Collections.Specialized.StringDictionary maps = new System.Collections.Specialized.StringDictionary();

            foreach (string key in keys)
            {
                if (!maps.ContainsKey(key))
                {
                    maps.Add(key, string.Empty);
                }
            }

            foreach (RadItem ri in base.Items)
            {
                RadCheckComboBoxItem chk = ri as RadCheckComboBoxItem;
                if (chk != null)
                {
                    // case insensitive
                    chk.IsChecked = maps.ContainsKey(chk.Name);
                }
            }
        }
示例#8
0
        public string Print2Html()
        {
            System.Collections.Specialized.StringDictionary data = new System.Collections.Specialized.StringDictionary();

            data.Add("COMPANYNAME", this.Company);
            data.Add("COMPANYCONTACTNAME", this.FirstName + " " + this.LastName);
            data.Add("COMPANYADDRESS", this.Address);

            data.Add("COMPANYCITY", this.City);
            data.Add("COMPANYICO", this.CompanyID);
            data.Add("COMPANYVAT", this.VatID);
            data.Add("INVOICENUMBER", this.InvoiceNumber);
            data.Add("DATECREATED", this.Created.ToLongDateString());
            data.Add("DUEDATE", this.Created.AddDays(7).ToLongDateString());
            data.Add("SUMPRICEVAT", this.GetItems(null).Sum(m => m.FinalPriceWithVat()).ToString("0.00 Kč"));
            data.Add("PRICESUM", this.GetItems(null).Sum(m => m.FinalPriceWithoutVat()).ToString("0.00 Kč"));
            data.Add("SUMVAT", this.GetItems(null).Sum(m => (m.FinalPriceWithVat() - m.FinalPriceWithoutVat())).ToString("0.00 Kč"));

            //items
            System.Text.StringBuilder sbItems = new System.Text.StringBuilder(1024);
            foreach (var item in this.GetItems(null))
            {
                System.Collections.Specialized.StringDictionary dataItem = new System.Collections.Specialized.StringDictionary();
                dataItem.Add("TEXT", item.Name);
                dataItem.Add("AMOUNT", item.Amount.ToString());
                dataItem.Add("PRICE", item.Price.ToString("0.00 Kč"));
                dataItem.Add("DISCOUNT", item.Discount.ToString("0.00 Kč"));
                dataItem.Add("TOTALPRICE", item.FinalPriceWithoutVat().ToString("0.00 Kč"));
                dataItem.Add("VAT", item.VAT.ToString());
                dataItem.Add("TOTALVAT", (item.FinalPriceWithVat() - item.FinalPriceWithoutVat()).ToString("0.00 Kč"));
                dataItem.Add("TOTALPRICEVAT", item.FinalPriceWithVat().ToString("0.00 Kč"));
                sbItems.AppendLine(
                    new Devmasters.Render.Template.SimpleTemplate(invoiceItemTemplate, dataItem).Render()
                    );
            }

            data.Add("ITEMS", sbItems.ToString());

            Devmasters.Render.Template.SimpleTemplate render = new Devmasters.Render.Template.SimpleTemplate(invoiceTemplate, data);
            return(render.Render());
        }
示例#9
0
        private void ShowErrorDialog(Exception ex, bool showStackTrace, bool internalError, ExceptionInfo info)
        {
            string stackTrace = ex.ToString();
            string message    = GetNestedMessages(ex);

            System.Collections.Specialized.StringDictionary additionalInfo =
                new System.Collections.Specialized.StringDictionary();

            IAnkhSolutionSettings ss = GetService <IAnkhSolutionSettings>();

            if (ss != null)
            {
                additionalInfo.Add("VS-Version", VSVersion.FullVersion.ToString());
            }

            if (info != null && info.CommandArgs != null)
            {
                additionalInfo.Add("Command", info.CommandArgs.Command.ToString());
            }

            IAnkhPackage pkg = GetService <IAnkhPackage>();

            if (pkg != null)
            {
                additionalInfo.Add("Ankh-Version", pkg.UIVersion.ToString());
            }

            additionalInfo.Add("SharpSvn-Version", SharpSvn.SvnClient.SharpSvnVersion.ToString());
            additionalInfo.Add("Svn-Version", SharpSvn.SvnClient.Version.ToString());
            additionalInfo.Add("OS-Version", Environment.OSVersion.Version.ToString());

            using (ErrorDialog dlg = new ErrorDialog())
            {
                dlg.ErrorMessage   = message;
                dlg.ShowStackTrace = showStackTrace;
                dlg.StackTrace     = stackTrace;
                dlg.InternalError  = internalError;

                if (dlg.ShowDialog(Context) == DialogResult.Retry)
                {
                    string subject = _errorReportSubject;

                    if (info != null && info.CommandArgs != null)
                    {
                        subject = string.Format("Error handling {0}", info.CommandArgs.Command);
                    }

                    SvnException sx = ex as SvnException;
                    SvnException ix;

                    while (sx != null &&
                           sx.SvnErrorCode == SvnErrorCode.SVN_ERR_BASE &&
                           (null != (ix = sx.InnerException as SvnException)))
                    {
                        sx = ix;
                    }

                    if (sx != null)
                    {
                        SvnException rc = sx.RootCause as SvnException;
                        if (rc == null || rc.SvnErrorCode == sx.SvnErrorCode)
                        {
                            subject += " (" + ErrorToString(sx) + ")";
                        }
                        else
                        {
                            subject += " (" + ErrorToString(sx) + "-" + ErrorToString(rc) + ")";
                        }
                    }

                    AnkhErrorMessage.SendByMail(_errorReportMailAddress,
                                                subject, ex, typeof(AnkhErrorHandler).Assembly, additionalInfo);
                }
            }
        }
示例#10
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
        }
示例#11
0
        public static int sendTransaction(System.Collections.Specialized.StringDictionary args)
        {
            int ret = -1;

            Program.logIt($"sendTransaction: ++ {args["json"]}");
            string avia_dir = System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA");
            string tool     = System.IO.Path.Combine(avia_dir, "hydra", "hydraTransaction.exe");

            utility.IniFile             ini  = new utility.IniFile(System.IO.Path.Combine(avia_dir, "AviaDevice.ini"));
            Dictionary <string, object> data = null;

            if (args.ContainsKey("json") && System.IO.File.Exists(args["json"]))
            {
                try
                {
                    var jss = new System.Web.Script.Serialization.JavaScriptSerializer();
                    data = jss.Deserialize <Dictionary <string, object> >(System.IO.File.ReadAllText(args["json"]));
                    string imei = ini.GetString("device", "imei", "");
                    if (!string.IsNullOrEmpty(imei))
                    {
                        data["Index"] = imei;
                    }
                }
                catch (Exception ex)
                {
                    Program.logIt($"sendTransaction: {ex.Message}");
                    ret = 1;
                }
            }
            if (data != null && System.IO.File.Exists(tool) && System.IO.File.Exists(System.IO.Path.Combine(avia_dir, "config.ini")))
            {
                utility.IniFile config = new utility.IniFile(System.IO.Path.Combine(avia_dir, "config.ini"));

                // save label.xml
                prepare_label_xml(config, data);

                string vzw_url = config.GetString("avia", "verizonurl", "");
                if (!string.IsNullOrEmpty(vzw_url))
                {
                    // send transaction to verizon interface.
                    if (!args.ContainsKey("verizonurl"))
                    {
                        args.Add("verizonurl", vzw_url);
                    }
                    sendTransactionToVerizon(args);
                }

                if (System.IO.File.Exists(tool))
                {
                    XmlWriterSettings settings = new XmlWriterSettings();
                    settings.Indent = true;
                    using (XmlWriter xmlWriter = XmlWriter.Create("test.xml", settings))
                    {
                        xmlWriter.WriteStartDocument();
                        xmlWriter.WriteStartElement("TransLog");
                        xmlWriter.WriteStartElement("FDEMT_TransactionRecord");
                        xmlWriter.WriteElementString("company", config.GetString("config", "companyid", "9"));
                        xmlWriter.WriteElementString("site", config.GetString("config", "siteid", "1"));
                        xmlWriter.WriteElementString("operator", config.GetString("config", "userid", "144"));
                        xmlWriter.WriteElementString("productid", config.GetString("config", "productid", "41"));
                        xmlWriter.WriteElementString("solutionid", config.GetString("config", "solutionid", "34"));
                        xmlWriter.WriteElementString("workstationName", System.Environment.MachineName);
                        xmlWriter.WriteElementString("sourcePhoneID", "PST_APE_UNIVERSAL_USB_FD");
                        xmlWriter.WriteElementString("sourceMake", "Apple");
                        xmlWriter.WriteElementString("sourceModel", data.ContainsKey("ModelName") ? data["ModelName"].ToString() : "");
                        xmlWriter.WriteElementString("esnNumber", data.ContainsKey("Index") ? data["Index"].ToString() : "1234567890");
                        xmlWriter.WriteElementString("StartTime", data.ContainsKey("InspectionTime") ? data["InspectionTime"].ToString() : DateTime.Now.ToString("G"));
                        xmlWriter.WriteElementString("CriteriaFileName", data.ContainsKey("CriteriaFileName") ? System.IO.Path.GetFileName(data["CriteriaFileName"].ToString()) : "");
                        int error_code = 1;
                        if (data.ContainsKey("Grade"))
                        {
                            error_code = 1;
                            string s  = data["Grade"].ToString();
                            string s1 = ini.GetString("override", "grade", s);
                            xmlWriter.WriteElementString("grade", s1);
                            if (string.IsNullOrEmpty(s1))
                            {
                                s1 = "D";
                            }
                            ini.WriteValue("device", "grade", s1);
                        }
                        else
                        {
                            error_code = 0;
                            ini.WriteValue("device", "grade", "D");
                        }
                        xmlWriter.WriteElementString("errorCode", error_code.ToString());
                        xmlWriter.WriteElementString("timeCreated", DateTime.Now.ToString("G"));
                        xmlWriter.WriteEndElement();
                        xmlWriter.WriteEndElement();
                        xmlWriter.WriteEndDocument();
                        xmlWriter.Flush();
                        xmlWriter.Close();
                    }

                    Process p = new Process();
                    p.StartInfo.FileName       = tool;
                    p.StartInfo.Arguments      = $"-add -config={config.Path} -xml=test.xml";
                    p.StartInfo.CreateNoWindow = true;
                    p.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                    p.Start();
                    p.WaitForExit();
                    ret = 0;
                }
            }
            if (args.ContainsKey("json"))
            {
                try
                {
                    System.IO.File.Delete(args["json"]);
                }
                catch (Exception) { }
            }
            Program.logIt($"sendTransaction: -- ret={ret}");
            return(ret);
        }
示例#12
0
        private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // �ۑ�
            System.Collections.Specialized.StringDictionary sd = new System.Collections.Specialized.StringDictionary();
            sd.Add("directory.destination", comboDestDir.Text);
            sd.Add("directory.source", comboBackupDir.Text);

            // ����B
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (String s in comboBackupDir.Items)
                sb.Append(s).Append("\t");
            sd.Add("directory.source.history", sb.ToString());
            sb.Length = 0;

            foreach (String s in comboDestDir.Items)
                sb.Append(s).Append("\t");
            sd.Add("directory.destination.history", sb.ToString());

            try
            {
                Misuzilla.Utilities.Setting.SaveSettings("mdumpfs.xml", sd);
            }
            catch (IOException ie)
            {
                MessageBox.Show(ie.ToString(), "mdumpfs", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <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;

              }
        }
示例#14
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
		
	}
示例#15
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
		
	}
示例#16
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"]);
            }
        }
示例#17
0
        public static bool ActivateViaInternet(string licenseNumber, string hardwareId, string email, bool fullLicense, out string message)
        {
            System.Collections.Specialized.StringDictionary dict = new System.Collections.Specialized.StringDictionary();

            if (fullLicense)
            {
                dict.Add("action", "getLicense");
                dict.Add("caller", "auto");
                dict.Add("serial", licenseNumber);
            }
            else
            {
                dict.Add("action", "getTrial");
                dict.Add("caller", "auto");
                dict.Add("email", email);
                dict.Add("product", "Visual NHibernate");
                dict.Add("trialNumber", hardwareId);
            }
            System.Net.WebResponse response;

            if (Slyce.Common.Utility.SendHttpPost(SlyceAuthorizer.ActivationUrl, dict, out response))
            {
                string errorString = RetrieveFromURL(response);

                if (string.IsNullOrWhiteSpace(errorString))
                {
                    message = "";
                    return true;
                }
                message = errorString;
                return false;
            }
            else
            {
                message = "Error occurred. Try again";
                return false;
            }
        }
示例#18
0
        /// <summary>
        /// run a command under the specify user's account.  Specify user to 'null'
        /// to run under the current authentication.  Also support for setting the
        /// DOS environment variables.
        /// </summary>
        /// <param name="command"></param>
        /// <param name="dosEnv"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public void Run(string command, Dictionary <String, String> dosEnv, UserAccount user)
        {
            log = new List <string>();

            try
            {
                using (Process p = new Process())
                {
                    // create a batch file ...
                    string batchFile = FileUtil.CreateTempFile("bat", new string[] { command });


                    // setup the command-lines ...
                    p.StartInfo.FileName = Environment.GetEnvironmentVariable("COMSPEC");
                    // use two doublequote to support spaces in filename/folder.
                    p.StartInfo.Arguments = String.Format("/c \"\"{0}\"\"", batchFile);
                    LogMessage("Filename/Arguments: " + p.StartInfo.FileName + " " + p.StartInfo.Arguments, false);

                    // runas user ...
                    {
                        string username;

                        if (user == null)
                        {
                            // use current auth, nothing to do!
                            username = String.Format("{1}\\{0}", Environment.UserName, Environment.UserDomainName);
                        }
                        else
                        {
                            p.StartInfo.UserName = user.Username;
                            p.StartInfo.Password = user.Password;
                            p.StartInfo.Domain   = user.Domain;
                            username             = user.Fullname;
                            //user.Password.Copy();
                        }
                        LogMessage("Run as : " + username, false);
                    }

                    // enable standard i/o/e redirection ...
                    if (enableStandardRedirection)
                    {
                        LogMessage("Enabling standard output/error redirection.", false);
                        p.StartInfo.UseShellExecute        = false;
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.RedirectStandardError  = true;
                        p.StartInfo.RedirectStandardInput  = true;

                        // do not show dos prompt ...
                        p.StartInfo.CreateNoWindow = true;
                    }

                    // set environment variables ...
                    if ((dosEnv != null) && (dosEnv.Count > 0))
                    {
                        System.Collections.Specialized.StringDictionary var = p.StartInfo.EnvironmentVariables;

                        foreach (KeyValuePair <String, String> kv in dosEnv)
                        {
                            if (var.ContainsKey(kv.Key))
                            {
                                var.Remove(kv.Key);
                            }

                            var.Add(kv.Key, kv.Value);
                        }
                    }

                    // start the process here ...
                    LogMessage("Executing command: " + command, false);
                    LogMessage("");
                    p.Start();

                    // handle standard i/o/e redirection ...
                    if (enableStandardRedirection)
                    {
                        // force Ctrl-Z to standard input, just in case the application prompts
                        // for input.  This will prevent an application from hanging.
                        p.StandardInput.Close();

                        ProcessRedirectStream(p.StandardOutput, "Standard Output");
                        ProcessRedirectStream(p.StandardError, "Standard Error");
                    }

                    // wait for the specify amount of time ...
                    if (ExecutionWaitAmount > 0)
                    {
                        // converts seconds --> milliseconds.
                        p.WaitForExit(ExecutionWaitAmount * 1000);
                    }

                    // check exit status ...
                    if (p.HasExited)
                    {
                        LogMessage("Application closed gracefully.");
                    }
                    else
                    {
                        #region Perform extra precautions
                        if (!p.HasExited)
                        {
                            LogMessage("Sending the close.");
                            p.CloseMainWindow();
                            Thread.Sleep(500);
                        }

                        if (!p.HasExited)
                        {
                            LogMessage("NOTE: Application not responding.  Sending the kill.");
                            p.Kill();
                            Thread.Sleep(500);
                        }

                        if (!p.HasExited)
                        {
                            LogMessage("WARNING: Unable to kill application.  (Application must be closed manually!)");
                        }
                        #endregion
                    }
                    LogMessage("");

                    ExitCode = p.ExitCode;

                    LogProcessInfo(p);

                    //return log.ToArray();
                }
            }
            catch (Exception ex)
            {
                LogMessage("Error: " + ex.ToString());
                throw;
            }
        }
示例#19
0
        /// <summary>
        /// Instantiates a client for a service endpoint, access key ID and secret access key.
        /// </summary>
        /// <param name="serviceEndpoint">The service endpoint receiving and processing mturk 
        /// requests. If null, defaults to the sandbox endpoint at
        /// <c>https://mechanicalturk.sandbox.amazonaws.com?Service=AWSMechanicalTurkRequester</c></param>
        /// <param name="accessKeyId">Required: The access key ID for the Amazon Web Services account</param>
        /// <param name="secretAccessKey">Required: The secret access key for the Amazon Web Services account</param>
        public MTurkConfig(string serviceEndpoint, string accessKeyId, string secretAccessKey)
        {
            System.Collections.Specialized.StringDictionary ctx = new System.Collections.Specialized.StringDictionary();
            ctx.Add("MechanicalTurk.ServiceEndpoint", serviceEndpoint);
            ctx.Add("MechanicalTurk.AccessKeyId", accessKeyId);
            ctx.Add("MechanicalTurk.SecretAccessKey", secretAccessKey);

            _context = ctx;
            Init();
        }
示例#20
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
        }
示例#21
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;
	}
示例#22
0
        private void GridBind()
        {
            string sWhere   = "";
            bool   HasParam = false;

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

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

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

            if (Params["paID"].Length > 0)
            {
                HasParam = true;
                sWhere  += "H.[paID]=" + Params["paID"];
            }

            if (Params["search"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "H.[hoRoom] like '%" + Params["search"].Replace("'", "''") + "%'";
            }

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

            DataView MyDv;

            String  strsql;
            DataSet myDs;

            strsql = "select [h].[hoID] as ID," +
                     "[h].*," +
                     "[I].[Name] as IndoorName," +
                     "[c].[Name] as CellName," +
                     "[s].[Name] as sunnyName " +
                     " from ((([House] h inner join [bm_Indoor] I on [h].[indoorID]=[I].[ID]) " +
                     " inner join [bm_cell] c on [h].[cellID]=[c].[ID])" +
                     " inner join [bm_Sunny] s on [h].[sunnyID]=[s].[ID])";
            //strsql="select top 10 meterReading.mrID,meterReading.mrYear from MeterReading order by sales DESC";
            if (!HasParam)
            {
                sWhere = " where hoID=-1";
            }
            strsql += sWhere;
            myDs    = Utility.ExecuteSql4Ds(strsql);
            MyDv    = myDs.Tables[0].DefaultView;

            if (!object.Equals(ViewState["Sort"], null))
            {
                MyDv.Sort = ViewState["Sort"].ToString();
            }
            DataGrid1.DataSource = MyDv;
            if (!object.Equals(ViewState["Page"], null))
            {
                DataGrid1.CurrentPageIndex = int.Parse(ViewState["Page"].ToString());
            }
            try
            {
                DataGrid1.DataBind();
            }
            catch
            {
                DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1;
                DataGrid1.DataBind();
            }
        }
示例#23
0
        /// <summary>
        /// evaluates the commandline arguments and constructs the Named and Indexed parameter list
        /// </summary>
        /// <param name="args">commandline arguments</param>
        public Arguments(IEnumerable <string> args)
        {
            Regex spliter = new Regex(@"^-{1,2}|^/|=",
                                      RegexOptions.IgnoreCase | RegexOptions.Compiled);

            Regex remover = new Regex(@"^['""]?(.*?)['""]?$",
                                      RegexOptions.IgnoreCase | RegexOptions.Compiled);

            string parameter = null;

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

                switch (parts.Length)
                {
                // Found a value (for the last parameter found (space separator))
                case 1:
                    if (parameter != null)
                    {
                        if (!m_NamedParameters.ContainsKey(parameter))
                        {
                            parts[0] =
                                remover.Replace(parts[0], "$1");

                            m_NamedParameters.Add(parameter, parts[0]);
                        }
                        parameter = null;
                    }
                    else
                    {
                        m_IndexedParameters.Add(argument);
                    }
                    // 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 (parameter != null)
                    {
                        if (!m_NamedParameters.ContainsKey(parameter))
                        {
                            m_NamedParameters.Add(parameter, "true");
                        }
                    }
                    parameter = parts[1];
                    break;

                // Parameter with enclosed value
                case 3:
                    // The last parameter is still waiting.
                    // With no value, set it to true.
                    if (parameter != null)
                    {
                        if (!m_NamedParameters.ContainsKey(parameter))
                        {
                            m_NamedParameters.Add(parameter, "true");
                        }
                    }

                    parameter = parts[1];

                    // Remove possible enclosing characters (",')
                    if (!m_NamedParameters.ContainsKey(parameter))
                    {
                        parts[2] = remover.Replace(parts[2], "$1");
                        m_NamedParameters.Add(parameter, parts[2]);
                    }

                    parameter = null;
                    break;
                }
            }
            // In case a parameter is still waiting
            if (parameter != null)
            {
                if (!m_NamedParameters.ContainsKey(parameter))
                {
                    m_NamedParameters.Add(parameter, "true");
                }
            }
        }
示例#24
0
        private void GridBind()
        {
            string sWhere   = "";
            bool   HasParam = false;

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

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

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

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


            DataView MyDv;

            String  strsql;
            DataSet myDs;

            strsql = "select   " +
                     "[m].[name], " +
                     "[m].[memo], " +
                     "[m].[member_id] as ID, " +
                     "[m].[member_login] as m_member_login, " +
                     "[s].[Name] as m_security_level_id " +
                     " from ([members] m inner join [bm_sLevel] s on [m].[security_level_id]=[s].[id])";
            //strsql="select top 10 meterReading.mrID,meterReading.mrYear from MeterReading order by sales DESC";

            strsql += sWhere;

            myDs = Utility.ExecuteSql4Ds(strsql);
            MyDv = myDs.Tables[0].DefaultView;

            if (!object.Equals(ViewState["Sort"], null))
            {
                MyDv.Sort = ViewState["Sort"].ToString();
            }
            DataGrid1.DataSource = MyDv;
            if (!object.Equals(ViewState["Page"], null))
            {
                DataGrid1.CurrentPageIndex = int.Parse(ViewState["Page"].ToString());
            }
            try
            {
                DataGrid1.DataBind();
            }
            catch
            {
                DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1;
                DataGrid1.DataBind();
            }
        }
示例#25
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
		
	}
示例#26
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;
            }
        }
示例#27
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;
        }
示例#28
0
        ICollection Issues_CreateDataSource()
        {
            // Issues Show begin
            Issues_sSQL      = "";
            Issues_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            if (Utility.GetParam("FormIssues_Sorting").Length > 0 && !IsPostBack)
            {
                ViewState["SortColumn"] = Utility.GetParam("FormIssues_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("assigned_to"))
            {
                string temp = Utility.GetParam("assigned_to");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, CCUtility.FIELD_TYPE_Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("assigned_to", temp);
            }

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

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

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

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

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

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

            if (Params["assigned_to"].Length > 0)
            {
                HasParam = true;
                sWhere  += "i.[assigned_to]=" + Params["assigned_to"];
            }
            if (Params["issue_name"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[issue_name] like '%" + Params["issue_name"].Replace("'", "''") + "%'";
            }
            if (Params["notstatus_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[status_id]<>" + Params["notstatus_id"];
            }
            if (Params["notqastatus_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[qastatus_id]<>" + Params["notqastatus_id"];
            }
            if (Params["priority_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[priority_id]=" + Params["priority_id"];
            }
            if (Params["status_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[status_id]=" + Params["status_id"];
            }
            if (Params["qastatus_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[qastatus_id]=" + Params["qastatus_id"];
            }


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

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


            Issues_sSQL = "select [i].[assigned_to] as i_assigned_to, " +
                          "[i].[date_modified] as i_date_modified, " +
                          "[i].[date_resolved] as i_date_resolved, " +
                          "[i].[date_submitted] as i_date_submitted, " +
                          "[i].[issue_id] as i_issue_id, " +
                          "[i].[issue_name] as i_issue_name, " +
                          "[i].[dev_issue_number] as i_dev_issue_number, " +
                          "[i].[priority_id] as i_priority_id, " +
                          "[i].[status_id] as i_status_id, " +
                          "[s].[status_id] as s_status_id, " +
                          "[s].[status] as s_status, " +
                          "[i].[qastatus_id] as i_qastatus_id, " +
                          "[qs].[qastatus_id] as qs_qastatus_id, " +
                          "[qs].[qastatus] as qs_qastatus, " +
                          "[u].[user_id] as u_user_id, " +
                          "[u].[user_name] as u_user_name " +
                          " from ((([issues] i left join [statuses] s on [s].[status_id]=i.[status_id]) left join [qastatuses] qs on [qs].[qastatus_id]=i.[qastatus_id]) inner join [users] u on [u].[user_id]=i.[assigned_to]) ";

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

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

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



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


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

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

            command.Fill(ds, (i_Issues_curpage - 1) * Issues_PAGENUM, Issues_PAGENUM, "Issues");
            OleDbCommand ccommand = new OleDbCommand(Issues_sCountSQL, Utility.Connection);
            int          PageTemp = (int)ccommand.ExecuteScalar();

            Issues_Pager.MaxPage = (PageTemp % Issues_PAGENUM) > 0?(int)(PageTemp / Issues_PAGENUM) + 1:(int)(PageTemp / Issues_PAGENUM);
            bool AllowScroller = Issues_Pager.MaxPage == 1?false:true;

            DataView Source;

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

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

            Issues_Pager.Visible = AllowScroller;
            return(Source);
            // Issues Show end
        }
示例#29
0
        private void WizardPageLogin_Commit(object sender, AeroWizard.WizardPageConfirmEventArgs e)
        {
            //Point p = System.Windows.Forms.Cursor.Position;
            //Point p1 = new Point();
            //p1.X = p.X - this.DesktopLocation.X ;
            //p1.Y = p.Y - this.DesktopLocation.Y ;
            //Program.logIt($"position: {p1} on N {theRect}: {theRect.Contains(p1)}");

            if (wizardPageLogin.Tag == null)
            {
                this.Enabled   = false;
                Cursor.Current = Cursors.WaitCursor;
                e.Cancel       = true;
                // start log in process
                Task t = Task.Run(() =>
                {
                    try
                    {
                        // log in
                        string dir = System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "hydra");
                        System.IO.File.Delete(System.IO.Path.Combine(dir, "HydraLogin.xml"));
                        string exe   = System.IO.Path.Combine(dir, "HydraLogin.exe");
                        string param = $"-u={textBoxUsername.Text} -p={textBoxPassword.Text}";
                        if (System.IO.File.Exists(exe))
                        {
                            System.Collections.Specialized.StringDictionary envs = new System.Collections.Specialized.StringDictionary();
                            envs.Add("APSTHOME", System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA"));
                            //Tuple<int, string[]> res = Program.run_exe(@"c:\windows\system32\notepad.exe", param, envs);
                            Tuple <int, string[]> res = Program.run_exe(exe, param, envs);
                            if (res.Item1 == 0)
                            {
                                // login success, run OE
                                //Task tt = Task.Run(() =>
                                //{
                                //    string exe1 = System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "iLauncher.exe");
                                //    string param1 = $"-desktop=test -exe=\"{System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "AviaToolset.exe")}\" -args=\"-oecontrol -start\"";
                                //    Process p = new Process();
                                //    p.StartInfo.FileName = exe1;
                                //    p.StartInfo.Arguments = param1;
                                //    p.StartInfo.UseShellExecute = false;
                                //    p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                                //    p.StartInfo.CreateNoWindow = true;
                                //    p.Start();
                                //});
                                if (System.IO.File.Exists(System.IO.Path.Combine(dir, "HydraLogin.xml")))
                                {
                                    utility.IniFile config = new utility.IniFile(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "config.ini"));
                                    // load xml
                                    try
                                    {
                                        XmlDocument doc = new XmlDocument();
                                        doc.Load(System.IO.Path.Combine(dir, "HydraLogin.xml"));
                                        string uid = doc.DocumentElement?["id"]?.InnerText;
                                        config.WriteValue("config", "uid", uid);
                                        //tt.Wait();
                                        wizardControl1.Invoke(new Action(() =>
                                        {
                                            wizardControl1.NextPage();
                                        }));
                                        // clear ini device section
                                        utility.IniFile ini = new utility.IniFile(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("FDHOME"), "AVIA", "aviaDevice.ini"));
                                        ini.DeleteSection("device");
                                        // OE Control start
                                        OEControl.start();
                                    }
                                    catch (Exception) { }
                                }
                            }
                            else
                            {
                                wizardControl1.Invoke(new Action(() =>
                                {
                                    labelLoginStatus.Text    = $"Fail to login, error code: {res.Item1}";
                                    labelLoginStatus.Visible = true;
                                }));
                            }
                        }
                    }
                    catch (Exception) { }
                    finally
                    {
                        this.Invoke(new Action(() =>
                        {
                            this.Enabled        = true;
                            wizardPageLogin.Tag = null;
                        }));
                        //wizardPageLogin.Tag = null;
                    }
                });
                wizardPageLogin.Tag = t;
            }
            else
            {
                wizardPageLogin.Tag = null;
            }
        }
示例#30
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
        }
示例#31
0
        /// <summary>
        /// An item was added.
        /// </summary>
        public override void ItemAdded(SPItemEventProperties properties)
        {
            base.ItemAdded(properties);

            if (properties.ListTitle == SOURCE_LIST)
            {
                try
                {
                    SPListItem theItem         = properties.ListItem;
                    SPWeb      theSite         = properties.OpenWeb();
                    SPList     theRoomList     = theSite.Lists[ROOM_LIST];
                    SPList     theResourceList = theSite.Lists[RESOURCE_LIST];

                    string        roomNotificationMail      = this.CheckForRoomNotification(theRoomList, theItem["Sala reserva"]);
                    List <string> resourceNotificationMails = this.CheckForResourceNotification(theResourceList, theItem["Recurso reserva"]);

                    #region Room notification
                    if (!string.IsNullOrWhiteSpace(roomNotificationMail))
                    {
                        /*if (!SPUtility.IsEmailServerSet(properties.Web))
                         * {
                         *  throw new SPException("Outgoing E-Mail Settings are not configured!");
                         * }
                         * else
                         * {*/
                        string room    = this.SubstringFormat(theItem["Sala reserva"]);
                        string area    = this.SubstringFormat(theItem["Área reserva"]);
                        string user    = theItem["Usuario reserva"].ToString();
                        string subject = theItem.Title;
                        string begin   = Convert.ToDateTime(theItem["Hora de inicio"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        string end     = Convert.ToDateTime(theItem["Hora de finalización"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        string creator = this.SubstringFormat(theItem["Creado por"]);
                        string created = Convert.ToDateTime(theItem["Creado"].ToString()).ToString("dd/MM/yyyy HH:mm");

                        System.Collections.Specialized.StringDictionary headers =
                            new System.Collections.Specialized.StringDictionary();
                        headers.Add("to", roomNotificationMail);
                        headers.Add("cc", "");
                        headers.Add("bcc", "");
                        headers.Add("from", "*****@*****.**");
                        headers.Add("subject", "Notificación automática, Sistema de Reserva de Salas BISA");
                        headers.Add("content-type", "text/html");
                        string bodyText = string.Format(
                            "<table border='0' cellspacing='0' cellpadding='0' style='width:99%;border-collapse:collapse;'>" +
                            "<tr><td style='border:solid #E8EAEC 1.0pt;background:#F8F8F9;padding:12.0pt 7.5pt 15.0pt 7.5pt'>" +
                            "<p style='font-size:15.0pt;font-family:Verdana,sans-serif;'>" +
                            "Sistema de Reserva de Salas: Reserva \"{0}\"</p></td></tr>" +
                            "<tr><td style='border:none;border-bottom:solid #9CA3AD 1.0pt;padding:4.0pt 7.5pt 4.0pt 7.5pt'>" +
                            "<p style='font-size:10.0pt;font-family:Tahoma,sans-serif'>" +
                            "Esta es una notificación automática generada por el <b>Sistema de Reserva de Salas</b> " +
                            "con el propósito de informar que se hizo la reserva siguiente:</p>" +
                            "<p>- Sala reservada: <b>{0}</b></p>" +
                            "<p>- Área solicitante: <b>{1}</b></p>" +
                            "<p>- Usuario solicitante: <b>{2}</b></p>" +
                            "<p>- Motivo: <b>{3}</b></p>" +
                            "<p>- Periodo: desde <b>{4}</b> hasta <b>{5}</b></p>" +
                            "<p style='font-size:8.0pt;font-family:Tahoma,sans-serif;'>" +
                            "Reserva creada por {6} en fecha {7}</p></td></tr></table>",
                            room, area, user, subject, begin, end, creator, created);

                        SPUtility.SendEmail(properties.Web, headers, bodyText);
                        /*}*/
                    }
                    #endregion

                    #region Resource notification
                    if (resourceNotificationMails.Count > 0)
                    {
                        /*if (!SPUtility.IsEmailServerSet(properties.Web))
                         * {
                         *  throw new SPException("Outgoing E-Mail Settings are not configured!");
                         * }
                         * else
                         * {*/
                        string room      = this.SubstringFormat(theItem["Sala reserva"]);
                        string area      = this.SubstringFormat(theItem["Área reserva"]);
                        string user      = theItem["Usuario reserva"].ToString();
                        string subject   = theItem.Title;
                        string begin     = Convert.ToDateTime(theItem["Hora de inicio"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        string end       = Convert.ToDateTime(theItem["Hora de finalización"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        string resources = this.GetFormatedResources(theItem["Recurso reserva"].ToString());
                        string creator   = this.SubstringFormat(theItem["Creado por"]);
                        string created   = Convert.ToDateTime(theItem["Creado"].ToString()).ToString("dd/MM/yyyy HH:mm");

                        foreach (string resourceNotificationMail in resourceNotificationMails)
                        {
                            System.Collections.Specialized.StringDictionary headers =
                                new System.Collections.Specialized.StringDictionary();
                            headers.Add("to", resourceNotificationMail);
                            headers.Add("cc", "");
                            headers.Add("bcc", "");
                            headers.Add("from", "*****@*****.**");
                            headers.Add("subject", "Notificación automática, Sistema de Reserva de Salas BISA");
                            headers.Add("content-type", "text/html");
                            string bodyText = string.Format(
                                "<table border='0' cellspacing='0' cellpadding='0' style='width:99%;border-collapse:collapse;'>" +
                                "<tr><td style='border:solid #E8EAEC 1.0pt;background:#F8F8F9;padding:12.0pt 7.5pt 15.0pt 7.5pt'>" +
                                "<p style='font-size:15.0pt;font-family:Verdana,sans-serif;'>" +
                                "Sistema de Reserva de Salas: Reserva \"{0}\"</p></td></tr>" +
                                "<tr><td style='border:none;border-bottom:solid #9CA3AD 1.0pt;padding:4.0pt 7.5pt 4.0pt 7.5pt'>" +
                                "<p style='font-size:10.0pt;font-family:Tahoma,sans-serif'>" +
                                "Esta es una notificación automática generada por el <b>Sistema de Reserva de Salas</b> " +
                                "con el propósito de informar que se hizo la reserva siguiente:</p>" +
                                "<p>- Sala reservada: <b>{0}</b></p>" +
                                "<p>- Área solicitante: <b>{1}</b></p>" +
                                "<p>- Usuario solicitante: <b>{2}</b></p>" +
                                "<p>- Motivo: <b>{3}</b></p>" +
                                "<p>- Periodo: desde <b>{4}</b> hasta <b>{5}</b></p>" +
                                "<p>- Recursos a usar: <b>{6}</b></p>" +
                                "<p style='font-size:8.0pt;font-family:Tahoma,sans-serif;'>" +
                                "Reserva creada por {7} en fecha {8}</p></td></tr></table>",
                                room, area, user, subject, begin, end, resources, creator, created);

                            SPUtility.SendEmail(properties.Web, headers, bodyText);
                        }
                        /*}*/
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    properties.ErrorMessage = ex.Message;
                    properties.Status       = SPEventReceiverStatus.Continue;
                }
            }
        }
示例#32
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
        }
示例#33
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
		
	}
示例#34
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
        }
        private void GridBind()
        {
            string sWhere   = "";
            bool   HasParam = false;

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

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

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

            if (Params["Master"].Length > 0)
            {
                HasParam = true;
                sWhere  += "[c].[Master] like '%" + Params["Master"].Replace("'", "''") + "%'";
            }

            if (Params["search"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "[c].[theNO]='" + Params["search"].Replace("'", "''") + "'";
            }

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

            DataView MyDv;

            String  strsql;
            DataSet myDs;

            strsql = "select c.* from carbarn c";             //+
            //" from carbarn  ";
            //strsql="select top 10 meterReading.mrID,meterReading.mrYear from MeterReading order by sales DESC";

            strsql += sWhere;
            myDs    = Utility.ExecuteSql4Ds(strsql);
            MyDv    = myDs.Tables[0].DefaultView;

            if (!object.Equals(ViewState["Sort"], null))
            {
                MyDv.Sort = ViewState["Sort"].ToString();
            }
            DataGrid1.DataSource = MyDv;
            if (!object.Equals(ViewState["Page"], null))
            {
                DataGrid1.CurrentPageIndex = int.Parse(ViewState["Page"].ToString());
            }
            try
            {
                DataGrid1.DataBind();
            }
            catch
            {
                DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1;
                DataGrid1.DataBind();
            }
        }
示例#36
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
        }
示例#37
0
        /// <summary>
        /// Преобразовать строку форматирования к стандартному виду.
        /// Пример:
        /// "Результат: {*, }"
        /// с parameterscount=3 дает
        /// "Результат: {0}, {1}, {2}".
        /// </summary>
        /// <param name="format">Формат для преобразования.</param>
        /// <param name="parameterscount">Количество параметров.</param>
        /// <returns>Преобразованная строка.</returns>
        public static string transfertformat(string format, int parameterscount)
        {
            string key = parameterscount + "," + format;

            if (formats.ContainsKey(key))
            {
                return(formats[key]);
            }

            if (formats.ContainsKey(format))
            {
                return(format);
            }

            lock (formats)
            {
                if (formats.ContainsKey(key))
                {
                    return(formats[key]);
                }

                if (formats.ContainsKey(format))
                {
                    return(format);
                }


                int index = format.IndexOf("{* ");
                if (index == -1)
                {
                    formats.Add(format, string.Empty);
                    return(format);
                }

                string pref = format.Substring(0, index);
                string and  = string.Empty;
                index += 3;
                while (format[index] != '}')
                {
                    and += format[index++].ToString(CultureInfo.InvariantCulture);
                }
                and = " " + and + " ";
                string suf = format.Substring(index + 1);
                int    ni  = 0;
                while (format.IndexOf("{" + ni + "}") >= 0)
                {
                    ni++;
                }
                string newformat = pref;
                if (parameterscount > ni)
                {
                    int i = ni;
                    for (; i < parameterscount - 1; i++)
                    {
                        newformat += "{" + i + "}" + and;
                    }
                    newformat += "{" + i + "}";
                }

                newformat += suf;
                formats.Add(key, newformat);

                return(newformat);
            }
        }
        /// <summary>
        /// Saves the settings to disk.
        /// </summary>
        public void Save()
        {
            System.Collections.Specialized.StringDictionary dic = new System.Collections.Specialized.StringDictionary();
            Type settingsType = this.GetType();

            //------------------------------------------------------------
            //	Enumerate through settings properties
            //------------------------------------------------------------
            foreach (PropertyInfo propertyInformation in settingsType.GetProperties())
            {
                if (propertyInformation.Name != "Instance")
                {
                    //------------------------------------------------------------
                    //	Extract property value and its string representation
                    //------------------------------------------------------------
                    object propertyValue = propertyInformation.GetValue(this, null);

                    string valueAsString;
                    //------------------------------------------------------------
                    //	Format null/default property values as empty strings
                    //------------------------------------------------------------
                    if (propertyValue == null || propertyValue.Equals(Int32.MinValue) || propertyValue.Equals(Single.MinValue))
                    {
                        valueAsString = String.Empty;
                    }
                    else
                    {
                        valueAsString = propertyValue.ToString();
                    }
                    //------------------------------------------------------------
                    //	Write property name/value pair
                    //------------------------------------------------------------
                    dic.Add(propertyInformation.Name, valueAsString);
                }
            }

            Providers.TrainService.SaveSettings(dic);
            OnChanged();
        }
示例#39
0
        ICollection Files_CreateDataSource()
        {
            // Files Show begin
            Files_sSQL      = "";
            Files_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            if (Utility.GetParam("FormFiles_Sorting").Length > 0 && !IsPostBack)
            {
                ViewState["SortColumn"] = Utility.GetParam("FormFiles_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("issue_id"))
            {
                string temp = Utility.GetParam("issue_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, CCUtility.FIELD_TYPE_Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("issue_id", temp);
            }

            if (Params["issue_id"].Length > 0)
            {
                HasParam = true;
                sWhere  += "f.[issue_id]=" + Params["issue_id"];
            }


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

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


            Files_sSQL = "select [f].[date_uploaded] as f_date_uploaded, " +
                         "[f].[file_id] as f_file_id, " +
                         "[f].[file_name] as f_file_name, " +
                         "[f].[issue_id] as f_issue_id, " +
                         "[f].[uploaded_by] as f_uploaded_by, " +
                         "[u].[user_id] as u_user_id, " +
                         "[u].[user_name] as u_user_name " +
                         " from [files] f, [users] u" +
                         " where [u].[user_id]=f.[uploaded_by]  ";

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

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

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



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


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

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

            command.Fill(ds, (i_Files_curpage - 1) * Files_PAGENUM, Files_PAGENUM, "Files");
            OleDbCommand ccommand = new OleDbCommand(Files_sCountSQL, Utility.Connection);
            int          PageTemp = (int)ccommand.ExecuteScalar();

            Files_Pager.MaxPage = (PageTemp % Files_PAGENUM) > 0?(int)(PageTemp / Files_PAGENUM) + 1:(int)(PageTemp / Files_PAGENUM);
            bool AllowScroller = Files_Pager.MaxPage == 1?false:true;

            DataView Source;

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

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

            Files_Pager.Visible = AllowScroller;
            return(Source);
            // Files Show end
        }
示例#40
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
        }
示例#41
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
        }
示例#42
0
        ICollection Responses_CreateDataSource()
        {
            // Responses Show begin
            Responses_sSQL      = "";
            Responses_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool bReq     = true;
            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            sOrder = " order by r.date_response Asc";
            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary();


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

            if (Params["issue_id"].Length > 0)
            {
                HasParam = true;
                sWhere  += "r.[issue_id]=" + Params["issue_id"];
            }
            else
            {
                bReq = false;
            }


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

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


            Responses_sSQL = "select [r].[assigned_to] as r_assigned_to, " +
                             "[r].[date_response] as r_date_response, " +
                             "[r].[issue_id] as r_issue_id, " +
                             "[r].[priority_id] as r_priority_id, " +
                             "[r].[response] as r_response, " +
                             "[r].[response_id] as r_response_id, " +
                             "[r].[status_id] as r_status_id, " +
                             "[r].[user_id] as r_user_id, " +
                             "[u].[user_id] as u_user_id, " +
                             "[u].[user_name] as u_user_name, " +
                             "[u1].[user_id] as u1_user_id, " +
                             "[u1].[user_name] as u1_user_name, " +
                             "[p].[priority_id] as p_priority_id, " +
                             "[p].[priority_desc] as p_priority_desc, " +
                             "[s].[status_id] as s_status_id, " +
                             "[s].[status] as s_status " +
                             " from [responses] r, [users] u, [users] u1, [priorities] p, [statuses] s" +
                             " where [u].[user_id]=r.[user_id] and [u1].[user_id]=r.[assigned_to] and [p].[priority_id]=r.[priority_id] and [s].[status_id]=r.[status_id]  ";

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

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

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



            Responses_sSQL = Responses_sSQL + sWhere + sOrder;
            //-------------------------------

            if (!bReq)
            {
                Responses_no_records.Visible = true;

                return(null);
            }
            OleDbDataAdapter command = new OleDbDataAdapter(Responses_sSQL, Utility.Connection);
            DataSet          ds      = new DataSet();

            command.Fill(ds, 0, Responses_PAGENUM, "Responses");
            DataView Source;

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

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


            return(Source);
            // Responses Show end
        }
示例#43
0
        ICollection Members_CreateDataSource()
        {
            // Members Show begin
            Members_sSQL      = "";
            Members_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            sOrder = " order by m.member_login Asc";
            if (Utility.GetParam("FormMembers_Sorting").Length > 0 && !IsPostBack)
            {
                ViewState["SortColumn"] = Utility.GetParam("FormMembers_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("name"))
            {
                string temp = Utility.GetParam("name");
                Params.Add("name", temp);
            }

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

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

            if (Params["name"].Length > 0)
            {
                HasParam = true;
                sWhere   = "m.[member_login] like '%" + Params["name"].Replace("'", "''") + "%'" + " or " + "m.[first_name] like '%" + Params["name"].Replace("'", "''") + "%'" + " or " + "m.[last_name] like '%" + Params["name"].Replace("'", "''") + "%'";
            }


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

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


            Members_sSQL = "select [m].[first_name] as m_first_name, " +
                           "[m].[last_name] as m_last_name, " +
                           "[m].[member_id] as m_member_id, " +
                           "[m].[member_level] as m_member_level, " +
                           "[m].[member_login] as m_member_login " +
                           " from [members] m ";

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


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

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



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


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

            OleDbDataAdapter command = new OleDbDataAdapter(Members_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_Members_curpage - 1) * Members_PAGENUM, Members_PAGENUM, "Members");
            OleDbCommand ccommand = new OleDbCommand(Members_sCountSQL, Utility.Connection);
            int          PageTemp = (int)ccommand.ExecuteScalar();

            Members_Pager.MaxPage = (PageTemp % Members_PAGENUM) > 0?(int)(PageTemp / Members_PAGENUM) + 1:(int)(PageTemp / Members_PAGENUM);
            bool AllowScroller = Members_Pager.MaxPage == 1?false:true;

            DataView Source;

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

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

            Members_Pager.Visible = AllowScroller;
            return(Source);
            // Members Show end
        }
示例#44
0
        public void Save()
        {
            System.Collections.Specialized.StringDictionary dic = new System.Collections.Specialized.StringDictionary();
                    Type settingsType = this.GetType();
                    foreach (PropertyInfo propertyInformation in settingsType.GetProperties())
                    {
                        try
                        {
                            // Except this all hs to be persisted, this contains the current object
                            if (propertyInformation.Name != "Instance")
                            {
                                object propertyValue = propertyInformation.GetValue(this, null);
                                string valueAsString = propertyValue.ToString();
                                //	Format null/default property values as empty strings
                                if (propertyValue.Equals(null))
                                {
                                    valueAsString = String.Empty;
                                }
                                if (propertyValue.Equals(Int32.MinValue))
                                {
                                    valueAsString = String.Empty;
                                }
                                if (propertyValue.Equals(Single.MinValue))
                                {
                                    valueAsString = String.Empty;
                                }
                                dic.Add(propertyInformation.Name, valueAsString);
                            }
                        }
                        catch { }
                    }

                    StaticService.SaveSettings(dic);
                    OnChanged();
        }
示例#45
0
        /// <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;
            }
        } //  ArgumentParser()
        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 = "";
            }

            //-------------------------------
            // 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
        }
示例#47
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
        }
示例#48
0
 /// <summary>
 /// Parse a rfc 2822 header field with parameters
 /// </summary>
 /// <param name="field">field name</param>
 /// <param name="fieldbody">field body to parse</param>
 /// <returns>A <see cref="System.Collections.Specialized.StringDictionary" /> from the parsed field body</returns>
 public static System.Collections.Specialized.StringDictionary parseHeaderFieldBody( System.String field, System.String fieldbody )
 {
     if ( fieldbody==null )
         return null;
     // FIXME: rewrite parseHeaderFieldBody to being regexp based.
     fieldbody = anmar.SharpMimeTools.SharpMimeTools.uncommentString (fieldbody);
     System.Collections.Specialized.StringDictionary fieldbodycol = new System.Collections.Specialized.StringDictionary ();
     System.String[] words = fieldbody.Split(new Char[]{';'});
     if ( words.Length>0 ) {
         fieldbodycol.Add (field.ToLower(), words[0].ToLower());
         for (int i=1; i<words.Length; i++ ) {
             System.String[] param = words[i].Trim(new Char[]{' ', '\t'}).Split(new Char[]{'='}, 2);
             if ( param.Length==2 ) {
                 param[0] = param[0].Trim(new Char[]{' ', '\t'});
                 param[1] = param[1].Trim(new Char[]{' ', '\t'});
                 if ( param[1].StartsWith("\"") && !param[1].EndsWith("\"")) {
                     do {
                         param[1] += ";" + words[++i];
                     } while  ( !words[i].EndsWith("\"") && i<words.Length);
                 }
                 fieldbodycol.Add ( param[0], anmar.SharpMimeTools.SharpMimeTools.parserfc2047Header (param[1].TrimEnd(';').Trim('\"')) );
             }
         }
     }
     return fieldbodycol;
 }
示例#49
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
        }
示例#50
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"]);
 }
示例#51
0
        private void ShowErrorDialog(Exception ex, bool showStackTrace, bool internalError, ExceptionInfo info)
        {
            string stackTrace = ex.ToString();
            string message = GetNestedMessages(ex);
            System.Collections.Specialized.StringDictionary additionalInfo =
                new System.Collections.Specialized.StringDictionary();

            IAnkhSolutionSettings ss = GetService<IAnkhSolutionSettings>();
            if (ss != null)
                additionalInfo.Add("VS-Version", ss.VisualStudioVersion.ToString());

            if (info != null && info.CommandArgs != null)
                additionalInfo.Add("Command", info.CommandArgs.Command.ToString());

            IAnkhPackage pkg = GetService<IAnkhPackage>();
            if (pkg != null)
                additionalInfo.Add("Ankh-Version", pkg.UIVersion.ToString());

            additionalInfo.Add("SharpSvn-Version", SharpSvn.SvnClient.SharpSvnVersion.ToString());
            additionalInfo.Add("Svn-Version", SharpSvn.SvnClient.Version.ToString());
            additionalInfo.Add("OS-Version", Environment.OSVersion.Version.ToString());

            using (ErrorDialog dlg = new ErrorDialog())
            {
                dlg.ErrorMessage = message;
                dlg.ShowStackTrace = showStackTrace;
                dlg.StackTrace = stackTrace;
                dlg.InternalError = internalError;

                if (dlg.ShowDialog(Context) == DialogResult.Retry)
                {
                    string subject = _errorReportSubject;

                    if (info != null && info.CommandArgs != null)
                        subject = string.Format("Error handling {0}", info.CommandArgs.Command);

                    SvnException sx = ex as SvnException;
                    SvnException ix;

                    while (sx != null
                           && sx.SvnErrorCode == SvnErrorCode.SVN_ERR_BASE
                           && (null != (ix = sx.InnerException as SvnException)))
                    {
                        sx = ix;
                    }

                    if (sx != null)
                    {
                        SvnException rc = sx.RootCause as SvnException;
                        if (rc == null || rc.SvnErrorCode == sx.SvnErrorCode)
                            subject += " (" + ErrorToString(sx) + ")";
                        else
                            subject += " (" + ErrorToString(sx) + "-" + ErrorToString(rc) + ")";
                    }

                    AnkhErrorMessage.SendByMail(_errorReportMailAddress,
                        subject, ex, typeof(AnkhErrorHandler).Assembly, additionalInfo);
                }
            }
        }
示例#52
0
        ICollection Issues_CreateDataSource()
        {
            // Issues Show begin
            Issues_sSQL      = "";
            Issues_sCountSQL = "";

            string sWhere = "", sOrder = "";

            bool HasParam = false;

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

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

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

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

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

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

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

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

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

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

            //**************************
            if (!Params.ContainsKey("bug_version_id"))
            {
                string temp = Utility.GetParam("bug_version_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, CCUtility.FIELD_TYPE_Number, true);
                }
                else
                {
                    temp = "";
                }
                Params.Add("bug_version_id", temp);
            }
            if (!Params.ContainsKey("release_version_id"))
            {
                string temp = Utility.GetParam("release_version_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, CCUtility.FIELD_TYPE_Number, true);
                }
                else
                {
                    temp = "";
                }
                Params.Add("release_version_id", temp);
            }
            if (!Params.ContainsKey("dev_nr"))
            {
                string temp = Utility.GetParam("dev_nr");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, CCUtility.FIELD_TYPE_Number, true);
                }
                else
                {
                    temp = "";
                }
                Params.Add("dev_nr", temp);
            }
            //**************************

            if (Params["assigned_by"].Length > 0)
            {
                HasParam = true;
                sWhere  += "i.[user_id] IN (" + Params["assigned_by"] + ")";
            }
            if (Params["assigned_to"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[assigned_to] IN (" + Params["assigned_to"] + ")";
            }
            if (Params["qaassigned_to"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "[qaassigned_to] IN (" + Params["qaassigned_to"] + ")";
            }
            if (Params["category_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[category_id] IN (" + Params["category_id"] + ")";
            }
            if (Params["issue_name"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;

                bool     bHasKeys = false;
                string[] Keys     = Params["issue_name"].Split(' ');
                foreach (string key in Keys)
                {
                    if (key.Equals(" ") == false)
                    {
                        if (bHasKeys == true)
                        {
                            sWhere += " and ";
                        }
                        sWhere += "(";
                        sWhere += "i.[issue_desc] like '%" + key.Replace("'", "''") + "%'";
                        sWhere += " OR ";
                        sWhere += "i.[issue_name] like '%" + key.Replace("'", "''") + "%'";
                        sWhere += " OR ";
                        sWhere += "i.[dev_issue_number] like '%" + key.Replace("'", "''") + "%'";
                        sWhere += " OR ";
                        int iId = 0;
                        try
                        {
                            iId = Convert.ToInt32(key);
                        }
                        catch (Exception e)
                        {
                            e.ToString();
                            iId = 0;
                        }
                        sWhere  += "i.[issue_id] = " + iId.ToString();
                        sWhere  += ")";
                        bHasKeys = true;
                    }
                }


                //      sWhere +="[issue_desc] like '%" + Params["issue_name"].Replace( "'", "''") +  "%'";
            }
            if (Params["notstatus_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[status_id]<>" + Params["notstatus_id"];
            }
            if (Params["priority_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[priority_id] IN (" + Params["priority_id"] + ")";
            }
            if (Params["status_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[status_id] IN (" + Params["status_id"] + ")";
            }
            if (Params["qastatus_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[qastatus_id] IN (" + Params["qastatus_id"] + ")";
            }

            //**********************************
            if (Params["bug_version_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += " [bugversion] IN (" + Params["bug_version_id"] + ")";
            }
            if (Params["release_version_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += " i.[version] IN (" + Params["release_version_id"] + ")";
            }
            if (Params["dev_nr"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                if (Params["dev_nr"].ToString() == "0")
                {
                    sWhere += " i.[dev_issue_number] is null";
                }
                else
                {
                    sWhere += " i.[dev_issue_number] is not null";
                }
            }
            //**********************************

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

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

            Issues_sSQL = "select " +
                          "[i].[assigned_to] as i_assigned_to, " +
                          "[i].[qaassigned_to] as i_qaassigned_to, " +
                          "[i].[date_modified] as i_date_modified, " +
                          "[i].[date_submitted] as i_date_submitted, " +
                          "[i].[issue_desc] as i_issue_desc, " +
                          "[i].[issue_id] as i_issue_id, " +
                          "[i].[issue_name] as i_issue_name, " +
                          "[i].[dev_issue_number] as i_dev_issue_number, " +
                          "[i].[modified_by] as i_modified_by, " +
                          "[i].[priority_id] as i_priority_id, " +
                          "[i].[status_id] as i_status_id, " +
                          "[i].[user_id] as i_user_id, " +
                          "[i].[bugversion] as i_bugversion, " +
                          "[i].[version] as i_version, " +
                          "[i].[steps_to_recreate] as i_steps_to_recreate, " +
                          "[s].[status_id] as s_dev_status_id, " +
                          "[s].[status] as s_dev_status, " +
                          "[qa].[qastatus_id] as qa_qastatus_id, " +
                          "[qa].[qastatus] as qa_qastatus, " +
                          "[p].[priority_id] as p_priority_id, " +
                          "[p].[priority_desc] as p_priority_desc, " +
                          "[c].[category_id] as c_category_id, " +
                          "[c].[category] as c_category, " +
                          "[u1].[user_id] as u1_user_id_submitted_by, " +
                          "[u1].[user_name] as u1_user_name_submitted_by, " +
                          "[u2].[user_id] as u2_user_id_owner, " +
                          "[u2].[user_name] as u2_user_name_owner, " +
                          "[u3].[user_id] as u3_user_id_qaowner, " +
                          "[u3].[user_name] as u3_user_name_qaowner, " +
                          "[u4].[user_id] as u4_user_id_last_updated_by, " +
                          "[u4].[user_name] as u4_user_name_last_updated_by, " +
                          "[v].[version] as v_version, " +
                          "[bv].[version] as bv_version " +
                          " from (((((((((([issues] i left join [statuses] s on [s].[status_id]=i.[status_id]) left join [qastatuses] qa on [qa].[qastatus_id]=i.[qastatus_id]) left join [priorities] p on [p].[priority_id]=i.[priority_id]) left join [users] u1 on [u1].[user_id]=i.[user_id]) left join [users] u2 on [u2].[user_id]=i.[assigned_to]) left join [users] u3 on [u3].[user_id]=i.[qaassigned_to]) left join [users] u4 on [u4].[user_id]=i.[modified_by]) left join [versions] v on [v].[version_id]=[i].[version]) left join [versions] bv on [bv].[version_id]=[i].[bugversion]) left join [categories] c on [c].[category_id]=i.[category_id]) ";

            //-------------------------------
            //-------------------------------
            Issues_Open(ref sWhere, ref sOrder);
            //-------------------------------

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

            Issues_sSQL = Issues_sSQL + sWhere + sOrder;
            //-------------------------------

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

            command.Fill(ds, 0, Issues_PAGENUM, "Issues");
            DataView Source;

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

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

            return(Source);
            // Issues Show end
        }
        }   // End Constructor

        public CommandLineArguments(string[] Args
                                    , System.Collections.Generic.Dictionary <string, string> defaultValues)
        {
            Parameters = new System.Collections.Specialized.StringDictionary();
            System.Text.RegularExpressions.Regex Spliter =
                new System.Text.RegularExpressions.Regex(@"^-{1,2}|^/|=|:",
                                                         System.Text.RegularExpressions.RegexOptions.IgnoreCase
                                                         | System.Text.RegularExpressions.RegexOptions.Compiled
                                                         );

            System.Text.RegularExpressions.Regex Remover =
                new System.Text.RegularExpressions.Regex(@"^['""]?(.*?)['""]?$",
                                                         System.Text.RegularExpressions.RegexOptions.IgnoreCase
                                                         | System.Text.RegularExpressions.RegexOptions.Compiled
                                                         );

            string Parameter = null;

            string[] Parts;

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

                switch (Parts.Length)
                {
                // Found a value (for the last parameter
                // found (space separator))
                case 1:
                    if (Parameter != null)
                    {
                        if (!Parameters.ContainsKey(Parameter))
                        {
                            Parts[0] =
                                Remover.Replace(Parts[0], "$1");

                            Parameters.Add(Parameter, Parts[0]);
                        }
                        Parameter = 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 (Parameter != null)
                    {
                        if (!Parameters.ContainsKey(Parameter))
                        {
                            Parameters.Add(Parameter, "true");
                        }
                    }
                    Parameter = Parts[1];
                    break;

                // Parameter with enclosed value
                case 3:
                    // The last parameter is still waiting.
                    // With no value, set it to true.
                    if (Parameter != null)
                    {
                        if (!Parameters.ContainsKey(Parameter))
                        {
                            Parameters.Add(Parameter, "true");
                        }
                    }     // End if(Parameter != null)

                    Parameter = Parts[1];

                    // Remove possible enclosing characters (",')
                    if (!Parameters.ContainsKey(Parameter))
                    {
                        Parts[2] = Remover.Replace(Parts[2], "$1");
                        Parameters.Add(Parameter, Parts[2]);
                    }     // End if(!Parameters.ContainsKey(Parameter))

                    Parameter = null;
                    break;
                } // End switch(Parts.Length)
            }     // Next Txt

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

            // Add default values
            if (defaultValues != null)
            {
                foreach (System.Collections.Generic.KeyValuePair <string, string> kvp in defaultValues)
                {
                    if (!this.Parameters.ContainsKey(kvp.Key))
                    {
                        this.Parameters[kvp.Key] = kvp.Value;
                    }
                } // Next kvp
            }     // End if (defaultValues != null)
        }         // End Constructor