Пример #1
0
 public static void WapTransactionLog4AInSert(WapTransactionLog4AEntity entity)
 {
     SqlHelper.ExecuteNonQuery(WebConfigurationManager.ConnectionStrings["ConnectionString139"].ConnectionString, "Wap_Transaction_Log_4A_Insert"
                               , entity.WapTransactionName
                               , entity.WapTransactionType
                               , entity.WapTransactionDetail
                               , entity.WapTransactionOn
                               , entity.WapTransactionMobile
                               , entity.WapTransactionOperator
                               , entity.WapTransactionAmount
                               , entity.ErrorCode
                               , entity.ErrorDetail
                               , entity.WapTransactionUserName
                               , entity.WapTransactionPassword
                               , entity.WapTransactionCpId
                               );
 }
Пример #2
0
        public static string exDebit(ChargingTransactionInfo info, string content, string servicename)
        {
            string success;
            string resp = string.Empty;

            try
            {
                CHARGING wsCgw = new CHARGING();
                log.Info("Call Deduct method: " + info.UserId + " | " + info.ServiceId + " | " + info.UserName + " | " + info.UserPass + " | " + info.CpId + " | " + content);
                content = TrimLength(content, 30);
                resp    = wsCgw.extDebit2(info.UserName, info.UserPass, info.CpId, info.UserId, info.ServiceId, REQUEST_TIMEOUT, content);
                log.Info("resp: " + resp);

                string[] arrResult = resp.Split(',');

                int    sResult = int.Parse(arrResult[0].Replace("Result:", ""));
                string sDetail = arrResult[1].Replace("Detail:", "");

                log.Info("Response Result (VNM Result Code): " + resp);
                log.Info("Action: " + content);
                log.Error(" ");
                log.Error(" ");

                if (sResult == Constant.E_OK)
                {
                    success = "1";
                }
                else
                {
                    success = resp;
                }
            }
            catch (Exception ex)
            {
                try
                {
                    Thread.Sleep(2000);

                    CHARGING wsCgw = new CHARGING();
                    log.Info("Call Deduct method: " + info.UserId + " | " + info.ServiceId + " | " + info.UserName + " | " + info.UserPass + " | " + info.CpId + " | " + content);
                    resp = wsCgw.extDebit2(info.UserName, info.UserPass, info.CpId, info.UserId, info.ServiceId, REQUEST_TIMEOUT, content);
                    log.Info("resp: " + resp);
                    string[] arrResult = resp.Split(',');
                    int      sResult   = int.Parse(arrResult[0].Replace("Result:", ""));
                    string   sDetail   = arrResult[1].Replace("Detail:", "");
                    log.Info("Response Result (VNM Result Code): " + resp);
                    log.Info("Action: " + content);
                    log.Error(" ");
                    log.Error(" ");

                    if (sResult == Constant.E_OK)
                    {
                        success = "1";
                    }
                    else
                    {
                        success = resp;
                    }
                }
                catch (Exception ex1)
                {
                    //throw ex;
                    log.Info("Error exDebit 3G: " + ex.Message);
                    log.Error(" ");
                    log.Error(" ");

                    AlertVnmCharging(info.UserId, "Loi ket noi Webservice VNM Charging 2G | Error:" + ex1.Message, "0", "0", "0", "0", 0, 0, 0, 0, 0, "0", "0");

                    success = resp;
                }
            }

            try
            {
                //Log Transaction 4A
                var entity = new WapTransactionLog4AEntity();
                entity.WapTransactionName     = servicename;
                entity.WapTransactionType     = 0;
                entity.WapTransactionDetail   = content;
                entity.WapTransactionOn       = DateTime.Now;
                entity.WapTransactionMobile   = info.UserId;
                entity.WapTransactionOperator = "Vietnamobile";
                entity.WapTransactionAmount   = ConvertUtility.ToInt32(info.ServiceId);
                entity.ErrorCode              = ConvertUtility.ToInt32(success);
                entity.ErrorDetail            = resp;
                entity.WapTransactionUserName = info.UserName;
                entity.WapTransactionPassword = info.UserPass;
                entity.WapTransactionCpId     = info.CpId;

                WapTransactionLog4AInSert(entity);
                //End Log Transaction 4A
            }
            catch (Exception ex)
            {
                //throw ex;
                log.Info("Error inSert log 4A " + ex.Message);
                log.Error(" ");
                log.Error(" ");
            }

            return(success);
        }