Esempio n. 1
0
        private static string GetValue(DataRow dr, string key, out bool isnumberic)
        {
            isnumberic = false;
            try
            {
                if (key.StartsWith("P_"))
                {
                    string[] parts = key.Replace("P_", "").Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length == 2)
                    {
                        //return StringUti.Divide(dr[parts[0]].ToString(), dr[parts[1]].ToString(), true);
                        string data = StringUti.Divide(GetValueNeedToAdd(dr, parts[0], out isnumberic), GetValueNeedToAdd(dr, parts[1], out isnumberic), true);
                        isnumberic = false;
                        return(data);
                    }
                    else
                    {
                        return(string.Empty);
                    }
                }
                else if (key.StartsWith("F1_"))
                {
                    string[] parts = key.Replace("F1_", "").Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length == 2)
                    {
                        isnumberic = true;
                        //return StringUti.Divide(dr[parts[0]].ToString(), dr[parts[1]].ToString(), false);
                        return(StringUti.Divide(GetValueNeedToAdd(dr, parts[0], out isnumberic), GetValueNeedToAdd(dr, parts[1], out isnumberic), false));
                    }
                    else
                    {
                        return(string.Empty);
                    }
                }
                else
                {
                    string rate = GetValueNeedToAdd(dr, key, out isnumberic);
                    if (isnumberic && (key.ToLower().Contains("rate") || key.ToLower().Contains("contribute")) && !key.ToLower().Contains("onsale_stocksalerate"))
                    {
                        isnumberic = false;
                        return((double.Parse(rate) * 100).ToString("f2") + (key.Contains("-") ? "" : "%"));
                    }
                    else
                    {
                        return(isnumberic ? double.Parse(rate).ToString("f2") : rate);
                    }

                    //return GetValueNeedToAdd(dr, key, out isnumberic);
                }
            }
            catch (Exception ex)
            {
                LogUtil.WriteLog(ex);
                return(string.Empty);
            }
        }
Esempio n. 2
0
 public static string ToUnicodeString(this string src)
 {
     return(StringUti.ToUnicode(src));
 }