Пример #1
0
        /// <summary>
        /// 呼叫Gash Web Service 取得 玩家擁有gash+專用點數  //edit 2009/11/10
        /// </summary>
        /// <param name="tmpGash">Gash帳號</param>
        /// <returns>(成功:玩家的點數 失敗:-1)</returns>
        public static int GetUserGashPoint(string tmpGash, string str_Region)
        {
            string ServiceCode = (string)ConfigurationManager.AppSettings["PayServiceCode"]??"";
            string ServiceRegion = (string) ConfigurationManager.AppSettings["PayServiceRegion"] ?? "";
            string x = string.Empty;
            try
            {
                ServiceAccount Gash_sp = new ServiceAccount();
                MainAccount sp = new MainAccount();
                switch (str_Region.ToUpper())
                {
                    case "TW":
                        Gash_sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_ServiceAccount"] ?? "");
                        sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_MainAccount"] ?? "");
                        break;
                    case "HK":
                        Gash_sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_ServiceAccount_HK"] ?? "");
                        sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_MainAccount_HK"] ?? "");
                        ServiceRegion = (string) ConfigurationManager.AppSettings["PayServiceRegion_HK"] ?? "";
                        break;
                    default:
                        Gash_sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_ServiceAccount"] ?? "");
                        sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_MainAccount"] ?? "");
                        break;
                }

                if (tmpGash.Length <= 0)
                { return -1; }
                else
                {
                    string myresult = Gash_sp.ServiceAccount_GetRemainingPoints(ServiceCode, ServiceRegion, tmpGash);
                    Gash_sp.Dispose();

                    if (myresult.Length > 0)
                    {
                        if (myresult.Substring(0, 2).ToString() == "1;")
                        {
                            x = myresult.Substring(2, myresult.Length - 2);
                            return System.Int32.Parse(x);
                        }
                        else if (myresult == "-1;Check_ServiceAccount_Failed")
                        {

                            myresult = sp.MainAccount_GetRemainingPoints(tmpGash);
                            if (myresult.Length > 0)
                            {
                                if (myresult.Substring(0, 2).ToString() == "1;")
                                {
                                    x = myresult.Substring(2, myresult.Length - 2);
                                    return System.Int32.Parse(x);
                                }
                                else
                                    return -1;
                            }
                            else
                                return -1;

                        }
                        else
                            return -1;
                    }
                    else
                        return -1;
                }
            }
            catch
            {
                return -1;
            }
        }
Пример #2
0
        //****由遊戲帳號找出gash帳號****   by  joda
        public static string GetMainAccountID(string strGame_ID, string Str_ServiceCode, string Str_Region)
        {
            string strgash = "";
            ServiceAccount ws = new ServiceAccount();

            try
            {
                //strgash = Str_ServiceCode + ";" + Str_Region + ";" + strGame_ID;
                strgash = ws.ServiceAccount_GetMainAccountID(Str_ServiceCode, Str_Region, strGame_ID);
                if (strgash.Split(";".ToCharArray())[0] != "1")
                {
                    strgash = "0";
                }
                else
                {
                    strgash = strgash.Split(";".ToCharArray())[1].ToString();
                }
            }
            catch (Exception ex)
            {
                strgash = "-1";
            }

            ws.Dispose();
            return strgash;
        }