Exemplo n.º 1
0
        /// <summary>
        /// Get Form Id From Url Method
        /// </summary>
        /// <returns>Number value</returns>
        public int GetFormIdFromUrl()
        {
            try
            {
                string url = Request.UrlReferrer != null?Request.UrlReferrer.ToString() : string.Empty;

                if (url.IndexOf('?') > -1)
                {
                    string querystring = url.Substring(url.IndexOf('?'));
                    System.Collections.Specialized.NameValueCollection parameters =
                        System.Web.HttpUtility.ParseQueryString(querystring);
                    if (parameters.HasKeys())
                    {
                        if (!string.IsNullOrEmpty(parameters.Get("id")))
                        {
                            return(Convert.ToInt32(parameters.Get("id")));
                        }
                    }
                }
            }
            catch
            {
            }
            return(0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves information from the query to generate a <see cref="User"/>
        /// </summary>
        /// <param name="nv">NameValueCollection from the http query</param>
        private static User CreateUserFromQuery(System.Collections.Specialized.NameValueCollection nv)
        {
            var u = new User();

            foreach (var k in nv.AllKeys)
            {
                var l = k.ToLower();
                switch (l)
                {
                case ("username"):
                    u.Username = nv.Get(k);
                    break;

                case ("password"):
                    u.Password = nv.Get(k);
                    break;

                case ("email"):
                    u.Email = nv.Get(k);
                    break;

                default:
                    break;
                }
            }
            return(u);
        }
Exemplo n.º 3
0
        public void Config_Load(System.Collections.Specialized.NameValueCollection coll)
        {
            if (coll.Get("txtExcelTemp") != null && !coll.Get("txtExcelTemp").Equals(""))
            {
                //txtExcelTemp.Text = coll.Get("txtExcelTemp");
            }

            //add system various
            lstVar.Items.Clear();
            for (int i = 0; i < nvcSysVar.Count; i++)
            {
                lstVar.Items.Add(nvcSysVar.GetKey(i) + VAR_SPLIT_STRING + nvcSysVar[i]);
            }
            //restore excel file(template) list
            if (coll["VarList"] != null)
            {
                //if is defined by system and not has values,then replace it
                string[] slist = coll["VarList"].Replace("\n", "").Split('\r');
                for (int i = 0; i < slist.Length; i++)
                {
                    string line = slist[i];
                    int    npos = line.IndexOf(VAR_SPLIT_STRING);
                    if (npos > 0)
                    {
                        string sName = line.Substring(0, npos);
                        for (int j = 0; j < lstVar.Items.Count; j++)
                        {
                            if (lstVar.Items[j].ToString().StartsWith(sName + VAR_SPLIT_STRING))
                            {
                                if (lstVar.Items[j].ToString().Equals(sName + VAR_SPLIT_STRING))
                                {
                                    lstVar.Items[j] = line;
                                }
                                line = "";
                                break;
                            }
                        }
                        if (!line.Equals(""))
                        {
                            lstVar.Items.Add(line);
                        }
                    }
                }
            }
            //restore excel file(table) list
            if (coll["TypeList"] != null)
            {
                lstType.Items.Clear();
                string[] slist = coll["TypeList"].Replace("\n", "").Split('\r');
                for (int i = 0; i < slist.Length; i++)
                {
                    string line = slist[i];
                    int    npos = line.IndexOf(VAR_SPLIT_STRING);
                    if (npos > 0)
                    {
                        lstType.Items.Add(line);
                    }
                }
            }
        }
Exemplo n.º 4
0
        // Sets the job tree item selections from a serialized settings string.
        //
        private void ApplyJobDefSetPrefs(string Text)
        {
            // deserialize node settings
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            System.IO.StreamWriter sw     = new System.IO.StreamWriter(stream);
            sw.Write(Text);
            sw.Flush();
            System.Runtime.Serialization.Formatters.Soap.SoapFormatter formatter =
                new System.Runtime.Serialization.Formatters.Soap.SoapFormatter();
            stream.Position = 0;
            System.Collections.Specialized.NameValueCollection CheckedNodes =
                (System.Collections.Specialized.NameValueCollection)formatter.Deserialize(stream);

            // apply node settings
            foreach (System.Windows.Forms.TreeNode Node in TreeView.Nodes)
            {
                string Value = CheckedNodes.Get(Node.FullPath);
                Node.Checked = CvtToChecked(Value);
                foreach (System.Windows.Forms.TreeNode Subnode in Node.Nodes)
                {
                    Value           = CheckedNodes.Get(Subnode.FullPath);
                    Subnode.Checked = CvtToChecked(Value);
                }
            }
        }
        protected override void OnStart(string[] args)
        {
            // create timer object
            timer          = new Timer(Double.Parse(appSettings.Get("lmadmin_interval")));
            timer.Elapsed += new ElapsedEventHandler(timer_elapsed);
            timer.Enabled  = true;

            // read last alert ID from persistent store
            string lastId = saver.getLastId();

            // create new lmadmin client
            client = new LmadminClient(this.ServiceName, lastId);

            // optionally create email notification sender
            if (appSettings.Get("send_email").ToLower().Equals("true"))
            {
                mailSender = new MailSender();
            }

            // make sure event source is registered
            if (!EventLog.SourceExists(this.ServiceName))
            {
                EventLog.CreateEventSource(this.ServiceName, "Application");
            }
        }
Exemplo n.º 6
0
        private async Task <bool> Authenticate(Action <string> sendUpdateMessage)
        {
            _state = Guid.NewGuid().ToString();

            System.Collections.Specialized.NameValueCollection nvc = new System.Collections.Specialized.NameValueCollection()
            {
                { "response_type", "code" },
                { "client_id", _webApiConfig.ClientId },
                { "scope", SPOTIFY_ACCESS_SCOPE },
                { "redirect_uri", RETURN_URL },
                { "state", _state }
            };

            sendUpdateMessage("Waiting for User-Log-In");

            HttpListener listener = new HttpListener();

            listener.Prefixes.Add(RETURN_URL);

            listener.Start();

            string url = WebHelper.GetQueryUrl(SPOTIFY_AUTH_URL, nvc);

            //Seems like you can just run an URL....
            //System.Diagnostics.Process.Start(BROWSER_DIRECTORY, url);
            System.Diagnostics.Process.Start(url);

            HttpListenerContext context = listener.GetContext();

            System.Collections.Specialized.NameValueCollection result = context.Request.QueryString;

            string responseString = "<script>close();</script>";

#pragma warning disable CS4014 // Da dieser Aufruf nicht abgewartet wird, wird die Ausführung der aktuellen Methode fortgesetzt, bevor der Aufruf abgeschlossen ist
            context.Response.OutputStream.WriteAsync(responseString.Select(x => (byte)x).ToArray(), 0, responseString.Length);
#pragma warning restore CS4014 // Da dieser Aufruf nicht abgewartet wird, wird die Ausführung der aktuellen Methode fortgesetzt, bevor der Aufruf abgeschlossen ist

            context.Response.Close();

            if (result.Get("state") != _state)
            {
                sendUpdateMessage("Failed to retrieve Access-Code!");
                return(false);
            }
            else
            {
                string formTemplate =
                    "grant_type=authorization_code&" +
                    "code={0}&" +
                    "redirect_uri={1}";

                string formBody = string.Format(formTemplate, result.Get("code"), RETURN_URL);

                sendUpdateMessage("Requiring AccessTokens...");

                return(await AquireTokens(formBody));
            }
        }
Exemplo n.º 7
0
 public static void GetMetaInfo(ref string url, ImageItem item)
 {
     if (IsValidGoogleImageLink(url))
     {
         Uri googleImageUri = new Uri(url);
         System.Collections.Specialized.NameValueCollection parameters = HttpUtility.ParseQueryString(googleImageUri.Query);
         url = HttpUtility.UrlDecode(parameters.Get("imgurl"));
         item.ContextLink = HttpUtility.UrlDecode(parameters.Get("imgrefurl"));
         item.Source      = item.ContextLink;
     }
 }
Exemplo n.º 8
0
 private static bool ReadStringValueFromConfig(System.Collections.Specialized.NameValueCollection configKeys, string key, ref string keyValue)
 {
     if (configKeys.Get(key) != null)
     {
         keyValue = (string)(configKeys.Get(key));
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 9
0
 private static bool ReadIntegerValueFromConfig(System.Collections.Specialized.NameValueCollection configKeys, string key, ref int keyValue)
 {
     if (configKeys.Get(key) != null)
     {
         keyValue = int.Parse(configKeys.Get(key), Common.GetNumberFormat());
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 10
0
 private void Hyperlink_Click(object sender, RoutedEventArgs e)
 {
     payload = App.MainWnd.UnconnectedGame_AddUnconnectedCheck(txtServiceAccountID.Text, DNtr.Visibility == Visibility.Visible ? "" : null, payload);
     if (payload == null || payload.Get("lblErrorMessage") == "")
     {
         payload = null;
         MessageBox.Show("發生未知錯誤", "系統訊息");
         return;
     }
     lblErrorMessage.Visibility = Visibility.Visible;
     lblErrorMessage.Content    = payload.Get("lblErrorMessage");
     payload.Remove("lblErrorMessage");
 }
Exemplo n.º 11
0
        /// <summary>
        /// prepares Remote post by populate all the necessary fields to generate PayUMoney post request.
        /// </summary>
        /// <param name="order">order details.</param>
        /// <param name="returnUrl">return url.</param>
        /// <returns>return remote post.</returns>
        private async Task <RemotePost> PrepareRemotePost(OrderViewModel order, string returnUrl)
        {
            string fname = string.Empty;
            string phone = string.Empty;
            string email = string.Empty;
            CustomerRegistrationRepository customerRegistrationRepository = new CustomerRegistrationRepository(ApplicationDomain.Instance);
            CustomerViewModel customerRegistrationInfo = await customerRegistrationRepository.RetrieveAsync(order.CustomerId);

            fname = customerRegistrationInfo.FirstName;
            phone = customerRegistrationInfo.Phone;
            email = customerRegistrationInfo.Email;

            decimal       paymentTotal = 0;
            StringBuilder productSubs  = new StringBuilder();
            StringBuilder prodQuants   = new StringBuilder();

            foreach (var subscriptionItem in order.Subscriptions)
            {
                productSubs.Append(":").Append(subscriptionItem.SubscriptionId);
                prodQuants.Append(":").Append(subscriptionItem.Quantity.ToString());
                paymentTotal += Math.Round(subscriptionItem.Quantity * subscriptionItem.SeatPrice, Resources.Culture.NumberFormat.CurrencyDecimalDigits);
            }

            productSubs.Remove(0, 1);
            prodQuants.Remove(0, 1);
            System.Collections.Specialized.NameValueCollection inputs = new System.Collections.Specialized.NameValueCollection();
            PaymentConfiguration payconfig = await this.GetAPaymentConfigAsync();

            inputs.Add("key", payconfig.ClientId);
            inputs.Add("txnid", this.GenerateTransactionId());
            inputs.Add("amount", paymentTotal.ToString());
            inputs.Add("productinfo", productSubs.ToString());
            inputs.Add("firstname", fname);
            inputs.Add("phone", phone);
            inputs.Add("email", email);
            inputs.Add("udf1", order.OperationType.ToString());
            inputs.Add("udf2", prodQuants.ToString());
            inputs.Add("surl", returnUrl + "&payment=success&PayerId=" + inputs.Get("txnid"));
            inputs.Add("furl", returnUrl + "&payment=failure&PayerId=" + inputs.Get("txnid"));
            inputs.Add("service_provider", Constant.PAYUPAISASERVICEPROVIDER);
            string hashString = inputs.Get("key") + "|" + inputs.Get("txnid") + "|" + inputs.Get("amount") + "|" + inputs.Get("productInfo") + "|" + inputs.Get("firstName") + "|" + inputs.Get("email") + "|" + inputs.Get("udf1") + "|" + inputs.Get("udf2") + "|||||||||" + payconfig.ClientSecret; // payconfig.ClientSecret;
            string hash       = this.GenerateHash512(hashString);

            inputs.Add("hash", hash);

            RemotePost myremotepost = new RemotePost();

            myremotepost.SetUrl(this.GetPaymentUrl(payconfig.AccountType));
            myremotepost.SetInputs(inputs);
            return(myremotepost);
        }
Exemplo n.º 12
0
            public LinkReceive(string queryString)
            {
                System.Collections.Specialized.NameValueCollection queryData = HttpUtility.ParseQueryString(queryString);

                if (!int.TryParse(queryData.Get("caseID"), out this.CaseID) || !byte.TryParse(queryData.Get("type"), out this.Type) || !byte.TryParse(queryData.Get("request"), out this.Request))
                {
                    throw new Exception("資料不完整!");
                }

                if (!string.IsNullOrEmpty(queryData.Get("returnWarehouseID")))
                {
                    this.ReturnWarehouseID = int.Parse(queryData.Get("returnWarehouseID"));
                }
            }
Exemplo n.º 13
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);


            string host = config.Get(HostKey);

            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException("host", "No host defined for the SMTP server in the configuration file.");
            }

            string port = config.Get(PortKey);
            int    portValue;

            if (!string.IsNullOrEmpty(port) && int.TryParse(port, out portValue))
            {
                client = new System.Net.Mail.SmtpClient(host, portValue);
            }
            else
            {
                client = new System.Net.Mail.SmtpClient(host);
            }

            string username = config.Get(UserNameKey);
            string password = config.Get(PasswordKey);

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                client.Credentials = new System.Net.NetworkCredential(username, password);
            }
            else
            {
                client.UseDefaultCredentials = true;
            }

            client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;

            bool   ssl       = false;
            string enableSSL = config.Get(EnableSSLKey);

            if (!string.IsNullOrEmpty(enableSSL))
            {
                bool.TryParse(enableSSL, out ssl);
            }

            client.EnableSsl = ssl;

            client.SendCompleted += OnSendCompleted;
        }
Exemplo n.º 14
0
        public LmadminClient(string serviceName, string lastId)
        {
            LmadminHost = appSettings.Get("lmadmin_host");
            LastId      = lastId;

            _alertTypes = appSettings["alert_types"].Split(',');
            // get the settings
            string port = appSettings.Get("lmadmin_port");
            string url  = "http://" + LmadminHost + ":" + port + "/soap";

            // connect to lmadmin and obtain session ID
            client       = new lmadmin_service.LicenseServerPortTypeClient("LicenseServer", url);
            _sessionId   = client.getSessionId(LMADMIN_USERNAME, LMADMIN_PASSWORD);
            _serviceName = serviceName;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Builds a single CSV row using the header as the template and putting the values in the right cells
        /// </summary>
        /// <param name="dbValues"></param>
        /// <returns></returns>
        static string buildCSVRow(System.Collections.Specialized.NameValueCollection dbValues, bool UseDefaultValues = true)
        {
            //Prepare the header template
            string sHeader = ConfigurationManager.AppSettings.Get("DBFieldNames");

            string[] arHeader = sHeader.Split(new char[] { ',' });

            //Prepare the data row template with placeholders
            string[] arRow = (string[])Array.CreateInstance(typeof(string), arHeader.Length);

            //Loop through the columns and write the values
            string sOutputString = "";

            for (int i = 0; i < arHeader.Length; i++)
            {
                string sColumn = arHeader[i];
                string sValue  = dbValues.Get(sColumn);
                if (sValue == null)
                {
                    sValue = "";
                }
                if (sOutputString != "")
                {
                    sOutputString += ",";                      //Add a ,-separator between values, but not for the very first value
                }
                sValue         = sValue.Replace("\"", "\"\""); //Replace all single " with "" for CSV " escaping
                sValue         = "\"" + sValue + "\"";         ///Wrap the value in "" even if it's empty
                sOutputString += sValue;                       // Append to output
            }

            return(sOutputString);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 给url增加params
        /// </summary>
        /// <param name="url"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string AddOrEditUrlParams(string url, string key, string value)
        {
            StringBuilder _url = new StringBuilder();

            if (url.Contains("?"))
            {
                string[] separateURL = url.Split('?');
                _url.Append(separateURL[0]);
                System.Collections.Specialized.NameValueCollection queryString = System.Web.HttpUtility.ParseQueryString(separateURL[1]);
                //不存在则添加
                if (queryString.Get(key) == null)
                {
                    queryString.Add(key, value);
                }
                else
                {
                    queryString[key] = value;
                }
                _url.Append("?" + queryString.ToString());
            }
            else
            {
                _url.Append(url + "?" + key + "=" + value);
            }
            return(_url.ToString());
        }
Exemplo n.º 17
0
        void Escape(System.IO.TextWriter writer, System.Collections.Specialized.NameValueCollection data, bool isHeader)
        {
            for (int i = 0, l = data.Count; i < l; i++)
            {
                if (isHeader == false)
                {
                    writer.Write('&');
                }
                isHeader = false;
                var value = data.Get(i);
                var key   = data.GetKey(i);

                if (String.IsNullOrEmpty(key))
                {
                    if (String.IsNullOrEmpty(value) == false)
                    {
                        writer.Write(Uri.EscapeDataString(value));
                    }
                }
                else
                {
                    writer.Write(Uri.EscapeDataString(data.GetKey(i)));
                    if (value != null)
                    {
                        writer.Write('=');
                        writer.Write(Uri.EscapeDataString(value));
                    }
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// POSTDATA字符串处理
        /// </summary>
        /// <param name="postData">post字符串</param>
        /// <param name="delkey">需要去除的键值对</param>
        /// <param name="nvc">键值对集合</param>
        /// <returns> </returns>
        public static string UrlFilter(string postData, string delkey, out System.Collections.Specialized.NameValueCollection nvc)
        {
            int questionMarkIndex = postData.IndexOf('?');

            if (questionMarkIndex == -1)
            {
                postData = "?" + postData;
            }
            ParseUrl(postData, out postData, out nvc);


            if (delkey != "" && nvc[delkey] != null)
            {
                nvc.Remove(delkey);
            }

            string result = "";

            for (int i = 0; i < nvc.Count; i++)
            {
                result += nvc.GetKey(i) + "=" + nvc.Get(i) + "&";
            }
            if (result.Length > 0)
            {
                result = result.Substring(0, result.Length - 1);
            }
            return(result);
        }
Exemplo n.º 19
0
        public void ProcessRequest(HttpContext context)
        {
            int ProjectID = 0;
            GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;

            string strOperation   = forms.Get("oper");
            string _search        = request["_search"];
            string textSearch     = request["txtSearch"] ?? "";
            int?   numberOfRows   = Convert.ToInt32(request["rows"]);
            int?   pageIndex      = Convert.ToInt32(request["page"]);
            string sortColumnName = request["sidx"];
            string sortOrderBy    = request["sord"];

            if (Convert.ToInt32(request["id"]) != 0)
            {
                long?id = Convert.ToInt32(request["id"]);
                //obj_StaffUserBusiness.Deleteuser(id);
            }
            ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int));
            var             ProjectList       = _GlobalAdminManager.GetAllProject(ProjectID, "GetAllProject", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, paramTotalRecords);
            string          output            = BuildJQGridResults(ProjectList, Convert.ToInt32(numberOfRows), Convert.ToInt32(pageIndex), Convert.ToInt32(paramTotalRecords.Value));

            response.Write(output);
        }
Exemplo n.º 20
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (String.IsNullOrEmpty(name))
            {
                name = "AsteriskCTIProvider";
            }
            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Asterisk CTI Provider");
            }
            base.Initialize(name, config);
            _applicationName = config["applicationName"];

            if (String.IsNullOrEmpty(_applicationName))
            {
                _applicationName = "/";
            }
            config.Remove("applicationName");

            if (config.Count > 0)
            {
                string attr = config.Get(0);
                if (!String.IsNullOrEmpty(attr))
                {
                    throw new ProviderException("Unrecognized atrtibute: " + attr);
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Ensures that the user in the Query is valid
        /// outputs the users UID once found.
        /// </summary>
        /// <returns><see langword="true"/>if valid</returns>
        private bool ValidateLogin(System.Collections.Specialized.NameValueCollection nv, out int UID)
        {
            var s = DB.FindSession(nv?.Get("sid"));

            UID = s?.UserId ?? default;
            return(s.IsExpired() == false);
        }
Exemplo n.º 22
0
        public List <SimpleReportViewModel> GetRegistoPesosSocio(string idSocio)
        {
            List <SimpleReportViewModel> ListaPesagens = new List <SimpleReportViewModel>();

            System.Collections.Specialized.NameValueCollection RegistosSocio = HelperFunctions.JSONDeserialize(RegistoPesos);


            string data = RegistosSocio.Get(idSocio);

            if (data == null)
            {
                return(ListaPesagens);
            }
            string[] splittedData = data.Split(',');
            foreach (string item in splittedData)
            {
                string[] subitem = item.Split("-");
                ListaPesagens.Add(new SimpleReportViewModel()
                {
                    Quantity = float.Parse(subitem[0], CultureInfo.InvariantCulture.NumberFormat), DimensionOne = subitem[1]
                });
            }

            return(ListaPesagens);
        }
Exemplo n.º 23
0
        /// <summary> Given a concatenation of message type and event (e.g. ADT_A04), and the
        /// version, finds the corresponding message structure (e.g. ADT_A01).  This
        /// is needed because some events share message structures, although it is not needed
        /// when the message structure is explicitly valued in MSH-9-3.
        /// If no mapping is found, returns the original name.
        /// </summary>
        /// <throws>  HL7Exception if there is an error retrieving the map, or if the given  </throws>
        /// <summary>      version is invalid
        /// </summary>
        public static System.String getMessageStructureForEvent(System.String name, System.String version)
        {
            System.String structure = null;

            if (!validVersion(version))
            {
                throw new HL7Exception("The version " + version + " is unknown");
            }

            //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.Properties' and 'System.Collections.Specialized.NameValueCollection' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
            System.Collections.Specialized.NameValueCollection p = null;
            try
            {
                //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.Properties' and 'System.Collections.Specialized.NameValueCollection' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
                p = (System.Collections.Specialized.NameValueCollection)MessageStructures[version];
            }
            catch (System.IO.IOException ioe)
            {
                throw new HL7Exception("Unable to access message strutures", ioe);
            }

            if (p == null)
            {
                throw new HL7Exception("No map found for version " + version);
            }

            structure = p.Get(name);

            if (structure == null)
            {
                structure = name;
            }

            return(structure);
        }
Exemplo n.º 24
0
        //! 解析了数据库的链接后,根据数据库的code名,找该库对应的要处理的数据类型列表
        public static void PraseTableTypeConfig()
        {
            int num = m_dataBaseConnects.Count;

            foreach (var curDB in m_dataBaseConnects)
            {
                //!!取出当前key值
                string keyString = curDB.Key;

                //! 数据库表类型对应的表名
                //!2\创建个map容器,key:value(表类型:数据库表名)
                Dictionary <string, string> tableTypes = new Dictionary <string, string>();

                // 获取同名对应的section配置文件中的值.
                System.Collections.Specialized.NameValueCollection appSettingSection =
                    (System.Collections.Specialized.NameValueCollection)ConfigurationManager.GetSection(keyString);
                if (appSettingSection == null)
                {
                    continue;
                }

                //!遍历table,存储起来
                int tableNum = appSettingSection.Count;
                for (int i = 0; i != tableNum; ++i)
                {
                    //!当前表名类型
                    string tableTypeName = appSettingSection.AllKeys[i];
                    string value         = appSettingSection.Get(tableTypeName);
                    tableTypes.Add(tableTypeName, value);
                }

                //! 存储
                m_dbTableTypes.Add(keyString, tableTypes);
            }
        }
Exemplo n.º 25
0
        /// <summary> Given a concatenation of message type and event (e.g. ADT_A04), and the
        /// version, finds the corresponding message structure (e.g. ADT_A01).  This
        /// is needed because some events share message structures, although it is not needed
        /// when the message structure is explicitly valued in MSH-9-3.
        /// If no mapping is found, returns the original name.
        /// </summary>
        /// <throws>  HL7Exception if there is an error retrieving the map, or if the given  </throws>
        /// <summary>      version is invalid
        /// </summary>
        public static System.String getMessageStructureForEvent(System.String name, System.String version)
        {
            System.String structure = null;

            if (!validVersion(version))
            {
                throw new NuGenHL7Exception("The version " + version + " is unknown");
            }

            System.Collections.Specialized.NameValueCollection p = null;
            try
            {
                p = (System.Collections.Specialized.NameValueCollection)MessageStructures[version];
            }
            catch (System.IO.IOException ioe)
            {
                throw new NuGenHL7Exception(ioe);
            }

            if (p == null)
            {
                throw new NuGenHL7Exception("No map found for version " + version);
            }

            structure = p.Get(name);

            if (structure == null)
            {
                structure = name;
            }

            return(structure);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 根据返回的通知url生成md5签名字符串
        /// </summary>
        /// <param name="nvc">NameValues集合</param>
        /// <param name="key">安全校验码</param>
        /// <returns>返回排序后的字符串(自动剔除末尾的sign)</returns>
        public static string GetSign(System.Collections.Specialized.NameValueCollection nvc, string key)
        {
            string    str  = "";
            ArrayList list = new ArrayList();

            foreach (var entry in nvc.AllKeys)
            {
                if (nvc.Get(entry) != "" && entry != "sign")
                {
                    list.Add(entry + "=" + nvc.Get(entry));
                }
            }
            list.Sort();
            for (int i = 0; i < list.Count; i++)
            {
                if (i == 0)
                {
                    str += list[i].ToString();
                }
                else
                {
                    str += "&" + list[i].ToString();
                }
            }

            return(md5(str + key));

            //string[] Sortedstr = BubbleSort(nvc.AllKeys);  //对参数进行排序
            //StringBuilder prestr = new StringBuilder();           //构造待md5摘要字符串
            //for (int i = 0; i < Sortedstr.Length; i++)
            //{
            //    if (nvc.Get(Sortedstr[i]) != "" && Sortedstr[i] != "sign")
            //    {
            //        if (i == Sortedstr.Length - 1)
            //        {
            //            prestr.Append(Sortedstr[i] + "=" + nvc.Get(Sortedstr[i]));
            //        }
            //        else
            //        {
            //            prestr.Append(Sortedstr[i] + "=" + nvc.Get(Sortedstr[i]) + "&");
            //        }
            //    }
            //}
            //prestr.Append(key);//追加key
            //return prestr.ToString();
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection attributes)
        {
            string enableHiding = attributes.Get("EnableHiding");

            _EnableHiding = (!string.IsNullOrEmpty(enableHiding) && enableHiding.Equals("true"));
            attributes.Remove("EnableHiding");
            base.Initialize(name, attributes);
        }
Exemplo n.º 28
0
        public void ProcessRequest(HttpContext context)
        {
            int?ProjectID = 0, UserID = 0;
            GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;

            string strOperation   = forms.Get("oper");
            string _search        = request["_search"];
            string textSearch     = request["txtSearch"] ?? "";
            int?   numberOfRows   = Convert.ToInt32(request["rows"]);
            int?   pageIndex      = Convert.ToInt32(request["page"]);
            string sortColumnName = request["sidx"];
            string sortOrderBy    = request["sord"];
            string filter         = request["filter"];

            if (request["UserID"] != "")
            {
                UserID = Convert.ToInt32(request["UserID"]);
                //obj_StaffUserBusiness.Deleteuser(id);
            }
            if (request["UserID"] != "")
            {
                UserID = Convert.ToInt32(request["UserID"]);
                //obj_StaffUserBusiness.Deleteuser(id);
            }
            DateTime        StartDate     = DateTime.UtcNow;
            DateTime        EndDate       = DateTime.UtcNow;
            eTracLoginModel ObjLoginModel = null;
            long            iUserID       = 0;

            if (context.Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(context.Session["eTrac"]);
                iUserID       = ObjLoginModel.UserId;
            }
            long            LocationID        = Convert.ToInt64(context.Session["eTrac_SelectedDasboardLocationID"]);
            ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int));
            var             WorkRequestList   = _GlobalAdminManager.GetAllWorkRequestAssignment(ProjectID, UserID, "GetWorkOrderWeekHistory", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, LocationID, iUserID, StartDate, EndDate, filter, "", paramTotalRecords);

            if (WorkRequestList.Count() > 0)
            {
                string output = BuildJQGridResults(WorkRequestList, Convert.ToInt32(numberOfRows), Convert.ToInt32(pageIndex), Convert.ToInt32(paramTotalRecords.Value));
                response.Write(output);
            }
            else
            {
                JQGridResults    result = new JQGridResults();
                List <JQGridRow> rows   = new List <JQGridRow>();
                result.rows    = rows.ToArray();
                result.page    = 0;
                result.total   = 0;
                result.records = 0;
                response.Write(new JavaScriptSerializer().Serialize(result));
            }
        }
Exemplo n.º 29
0
        public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
        {
            int i = 0;

            foreach (ListItemGroup group in Groups)
            {
                group.Selected = (postCollection.Get(FindControl(ClientID + "_" + i).UniqueID) != null);
                int j = 0;
                foreach (ListItem item in group.Items)
                {
                    item.Selected = (postCollection.Get(FindControl(ClientID + "_" + i + "_" + j).UniqueID) != null);
                    j++;
                }
                i++;
            }

            return(false);
        }
Exemplo n.º 30
0
        public T CreateInstance(System.Collections.Specialized.NameValueCollection nameValueCollection)
        {
            Contract.Requires(nameValueCollection != null);
            var values = (from name in nameValueCollection.AllKeys
                          let value = nameValueCollection.Get(name)
                                      select Tuple.Create(name, (object)value)).ToDictionary(a => a.Item1, a => a.Item2);

            return(CreateInstance(values));
        }
Exemplo n.º 31
0
		/// <summary> Gets selected fields from a message, as with String[] arg version but 
		/// using DatumPaths. 
		/// </summary>
		private static System.String[] getFields(System.String theMessageText, NuGenDatumPath[] thePaths)
		{
			System.String[] fields = new System.String[thePaths.Length];
			System.String encoding = ourParser.getEncoding(theMessageText);
			System.Collections.Specialized.NameValueCollection props = new System.Collections.Specialized.NameValueCollection();
			
			System.Collections.ArrayList mask = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			for (int i = 0; i < thePaths.Length; i++)
			{
				mask.Add(thePaths[i]);
			}
			
			if (encoding == null)
			{
				throw new NuGenHL7Exception("Message encoding is not recognized");
			}
			
			bool OK = false;
			if (encoding.Equals("VB"))
			{
				OK = NuGenER7.parseMessage(props, mask, theMessageText);
			}
			else if (encoding.Equals("XML"))
			{
				OK = NuGenXML.parseMessage(props, theMessageText, null);
			}
			
			if (!OK)
			{
				throw new NuGenHL7Exception("Parse failed");
			}
			
			for (int i = 0; i < fields.Length; i++)
			{
				fields[i] = props.Get(thePaths[i].ToString());
			}
			return fields;
		}
Exemplo n.º 32
0
		private static System.Collections.Specialized.NameValueCollection getClauses(System.String theQuery)
		{
			System.Collections.Specialized.NameValueCollection clauses = new System.Collections.Specialized.NameValueCollection();
			
			System.String[] split = splitFromEnd(theQuery, "where ");
			setClause(clauses, "where", split[1]);
			
			split = splitFromEnd(split[0], "loop ");
			setClause(clauses, "loop", split[1]);
			setClause(clauses, "select", split[0]);
			
			if ((clauses["where"] == null?"":clauses["where"]).IndexOf("loop ") >= 0)
			{
				throw new System.ArgumentException("The loop clause must precede the where clause");
			}
			if (clauses.Get("select") == null)
			{
				throw new System.ArgumentException("The query must begin with a select clause");
			}
			return clauses;
		}