Пример #1
0
        public HttpResponseMessage ActivePhoneAgency(PayloadApi p)
        {
            LogClass.SaveCustomerLog("ActivePhoneAgency: " + JsonConvert.SerializeObject(p));
            ResultApi result = new ResultApi();

            try
            {
                var publisherInfo = publisher.CheckPublickey(p, version);
                if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                {
                    ManagerModel managerModel = new ManagerModel();
                    var          data         = JsonConvert.DeserializeObject <ActivePhoneAgency>(publisherInfo.data.ToString());
                    string       msg          = "";
                    string       otp          = "";
                    result.status = managerModel.AgencyModel.ActivePhoneAgency(data, ref msg, ref otp);
                    result.msg    = msg;
                    if (result.status == 2)
                    {
                        SMS.SendMessage(data.phone, "Ma OTP xac thuc kich hoat sdt la " + otp + ", hieu luc 3 phut");
                    }
                }
                else
                {
                    result = publisherInfo;
                }
            }
            catch (Exception ex)
            {
                LogClass.SaveError("ERROR ActivePhoneAgency: " + ex, ex, true);
                result.status = (int)ERROR_CODDE.ERROR_EX;
                result.msg    = ex.Message;
            }
            return(Request.CreateResponse(result));
        }
Пример #2
0
        public HttpResponseMessage UpdateDisplay_Agency(PayloadApi p)
        {
            LogClass.SaveCustomerLog("UpdateDisplay_Agency: " + JsonConvert.SerializeObject(p));
            ResultApi result = new ResultApi();

            try
            {
                var publisherInfo = publisher.CheckPublickey(p, version);
                if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                {
                    ManagerModel managerModel = new ManagerModel();
                    var          data         = JsonConvert.DeserializeObject <UpdateDisplayAgencyEntity>(publisherInfo.data.ToString());
                    string       msg          = "";
                    result.status = managerModel.AgencyModel.UpdateDisplay_Agency(data, ref msg);
                    result.msg    = msg;
                }
                else
                {
                    result = publisherInfo;
                }
            }
            catch (Exception ex)
            {
                LogClass.SaveError("ERROR UpdateDisplay_Agency: " + ex.Message, ex, true);
                result.status = (int)ERROR_CODDE.ERROR_EX;
                result.msg    = ex.Message;
            }
            return(Request.CreateResponse(result));
        }
Пример #3
0
        public HttpResponseMessage TransferMoneyToUser(PayloadApi p)
        {
            LogClass.SaveCustomerLog("TransferMoneyToUser: "******"";
                    string       otp          = "";
                    string       phone        = "";
                    result.status = managerModel.AgencyModel.TransferMoneyToUser(data, ref msg, ref otp, ref phone);
                    result.msg    = msg;
                    if (result.status == 2)
                    {
                        SMS.SendMessage(phone, "Ma OTP xac thuc GD la " + otp + ", hieu luc 3 phut.Chi tiet GD: Chuyen khoan cho user so tien " + UtilClass.formatMoney((int)data.amount) + " VND.");
                    }
                }
                else
                {
                    result = publisherInfo;
                }
            }
            catch (Exception ex)
            {
                LogClass.SaveError("ERROR TransferMoneyToUser: " + ex, ex, true);
                result.status = (int)ERROR_CODDE.ERROR_EX;
                result.msg    = ex.Message;
            }
            return(Request.CreateResponse(result));
        }
Пример #4
0
        public HttpResponseMessage FindGameAccount(PayloadApi p)
        {
            LogClass.SaveCustomerLog("FindGameAccount: " + JsonConvert.SerializeObject(p));
            ResultApi result = new ResultApi();

            try
            {
                var publisherInfo = publisher.CheckPublickey(p, version);
                if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                {
                    ManagerModel managerModel = new ManagerModel();
                    var          data         = JsonConvert.DeserializeObject <FindAgencyEntity>(publisherInfo.data.ToString());
                    result.data = managerModel.AgencyModel.FindGameAccount(data.param, data.topN);
                }
                else
                {
                    result = publisherInfo;
                }
            }
            catch (Exception ex)
            {
                LogClass.SaveError("ERROR FindGameAccount: " + ex.Message, ex, true);
                result.status = (int)ERROR_CODDE.ERROR_EX;
                result.msg    = ex.Message;
            }
            return(Request.CreateResponse(result));
        }
Пример #5
0
        public HttpResponseMessage ResetPasswordAgency(PayloadApi p)
        {
            LogClass.SaveCustomerLog("ResetPasswordAgency: " + JsonConvert.SerializeObject(p));
            ResultApi result = new ResultApi();

            try
            {
                var publisherInfo = publisher.CheckPublickey(p, version);
                if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                {
                    ManagerModel managerModel = new ManagerModel();
                    var          data         = JsonConvert.DeserializeObject <ResetPasswordAgencyEntity>(publisherInfo.data.ToString());
                    string       msg          = "";
                    string       passwordNew  = "";
                    result.status = managerModel.AgencyModel.RessetPasswordAgency(data.phone, data.otp, ref msg, ref passwordNew);
                    result.msg    = msg;
                    if (result.status == 1)
                    {
                        SMS.SendMessage(data.phone, passwordNew + " la mat khau moi cua Ban.");
                    }
                }
                else
                {
                    result = publisherInfo;
                }
            }
            catch (Exception ex)
            {
                LogClass.SaveError("ERROR ResetPasswordAgency: " + ex.Message, ex, true);
                result.status = (int)ERROR_CODDE.ERROR_EX;
                result.msg    = ex.Message;
            }
            return(Request.CreateResponse(result));
        }
Пример #6
0
        public HttpResponseMessage GetAgencyInfo(PayloadApi p)
        {
            LogClass.SaveCustomerLog("GetAgencyInfo: " + JsonConvert.SerializeObject(p));
            ResultApi result = new ResultApi();

            try
            {
                var publisherInfo = publisher.CheckPublickey(p, version);
                if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                {
                    ManagerModel managerModel = new ManagerModel();
                    var          data         = JsonConvert.DeserializeObject <getAgencyInfoEntity>(publisherInfo.data.ToString());
                    int          code         = -1;
                    string       msg          = "";
                    var          d            = managerModel.AgencyModel.GetAgencyByID(data.uwinID, ref code, ref msg);
                    LogClass.SaveCustomerLog("AgencyInfo: " + JsonConvert.SerializeObject(d));
                    result.status = (int)ERROR_CODDE.SUCCESS;
                    result.data   = Encryptor.EncryptString(JsonConvert.SerializeObject(d), publisherInfo.secreckey);
                }
                else
                {
                    result = publisherInfo;
                }
            }
            catch (Exception ex)
            {
                LogClass.SaveError("ERROR GetAgencyInfo: " + ex.Message, ex, true);
                result.status = (int)ERROR_CODDE.ERROR_EX;
                result.msg    = ex.Message;
            }
            LogClass.SaveCustomerLog("return GetAgencyInfo: " + JsonConvert.SerializeObject(result));
            return(Request.CreateResponse(result));
        }
Пример #7
0
            public HttpResponseMessage LockAccountGame(PayloadApi p)
            {
                LogClass.SaveCustomerLog("LockAccountGame: " + JsonConvert.SerializeObject(p));
                ResultApi result = new ResultApi();

                try
                {
                    var publisherInfo = publisher.CheckPublickey(p, version);
                    if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                    {
                        ManagerModel managerModel = new ManagerModel();
                        var          data         = JsonConvert.DeserializeObject <LockAccountGameEnity>(publisherInfo.data.ToString());
                        string       msg          = "";
                        result.status = managerModel.GameAcountModel.LOCK_ACCOUNT_GAME(data, ref msg);
                        result.msg    = msg;
                    }
                    else
                    {
                        result = publisherInfo;
                    }
                }
                catch (Exception ex)
                {
                    LogClass.SaveError("ERROR LockAccountGame: " + ex.Message, ex, true);
                    result.status = (int)ERROR_CODDE.ERROR_EX;
                    result.msg    = ex.Message;
                }
                return(Request.CreateResponse(result));
            }
Пример #8
0
            public HttpResponseMessage DeleteFailTransactionCard(PayloadApi p)
            {
                LogClass.SaveCustomerLog("DeleteCashOutCard: " + JsonConvert.SerializeObject(p));
                ResultApi result = new ResultApi();

                try
                {
                    var publisherInfo = publisher.CheckPublickey(p, version);
                    if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                    {
                        ManagerModel managerModel = new ManagerModel();
                        var          data         = JsonConvert.DeserializeObject <DeleteFailTransactionCard>(publisherInfo.data.ToString());
                        string       msg          = "";
                        result.status = managerModel.GameAcountModel.DELETE_FAIL_TRANSACTION_CARD(data, ref msg);
                        result.msg    = msg;
                    }
                    else
                    {
                        result = publisherInfo;
                    }
                }
                catch (Exception ex)
                {
                    LogClass.SaveError("ERROR DeleteFailTransactionCard: " + ex.Message, ex, true);
                    result.status = (int)ERROR_CODDE.ERROR_EX;
                    result.msg    = ex.Message;
                }
                return(Request.CreateResponse(result));
            }
Пример #9
0
        public HttpResponseMessage UpdateDevice(DeviceInfo p)
        {
            string ip = UtilClass.GetIPAddress();

            LogClass.SaveCustomerLog("UpdateDevice: " + JsonConvert.SerializeObject(p) + ",IP " + ip);
            ResultTracking result = new ResultTracking();

            result.msg    = "success";
            result.status = 100;
            //try
            //{
            //    var publisherInfo = publisher.CheckPublickey(p, version);
            //    if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
            //    {
            //        ManagerModel managerModel = new ManagerModel();
            //        var data = JsonConvert.DeserializeObject<AgencyEntity>(publisherInfo.data.ToString());
            //        string msg = "";
            //        result.status = managerModel.AgencyModel.CreateAgency_C2(data, ref msg);
            //        result.msg = msg;
            //    }
            //    else
            //        result = publisherInfo;
            //}
            //catch (Exception ex)
            //{
            //    LogClass.SaveError("ERROR CreateAgency_C2: " + ex.Message, ex, true);
            //    result.status = (int)ERROR_CODDE.ERROR_EX;
            //    result.msg = ex.Message;
            //}
            return(Request.CreateResponse(result));
        }
Пример #10
0
            public HttpResponseMessage InputCard(PayloadApi p)
            {
                LogClass.SaveCustomerLog("InputCard: " + JsonConvert.SerializeObject(p));
                ResultApi  result     = new ResultApi();
                CardObject cardObject = new CardObject();

                try
                {
                    var publisherInfo = publisher.CheckPublickey(p, version);
                    if (publisherInfo.status == (int)ERROR_CODDE.SUCCESS)
                    {
                        ManagerModel managerModel = new ManagerModel();
                        var          data         = JsonConvert.DeserializeObject <InputCard>(publisherInfo.data.ToString());
                        string       msg          = "";

                        if (data.CardType != 1 && data.CardType != 2 && data.CardType != 3)
                        {
                            result.msg = "CardType sai định dạng";
                            return(null);
                        }

                        int   successtransaction = 0;
                        int   errortransaction   = 0;
                        int   errorsavelog       = 0;
                        short debug = 0;
                        try
                        {
                            string serviceCode = string.Empty;

                            if (data.CardType == 1)
                            {
                                serviceCode = "VTT";
                            }
                            else if (data.CardType == 2)
                            {
                                serviceCode = "VMS";
                            }
                            else if (data.CardType == 3)
                            {
                                serviceCode = "VNP";
                            }
                            debug = 1;
                            for (int i = 0; i < data.Qty; i++)
                            {
                                debug = 2;
                                long transactionId = DateTime.Now.Ticks;

                                var    service = new muathe24h.MechantServicesSoapClient();
                                string email   = "*****@*****.**";
                                string pass    = "******";

                                var res = service.BuyCards(new muathe24h.UserCredentials {
                                    userName = email, pass = pass
                                }
                                                           , transactionId.ToString(), serviceCode, data.Amount, 1);
                                debug = 3;
                                LogClass.SaveLog("muathe24h" + JsonConvert.SerializeObject(res));
                                string resultCode = res?.RepCode.ToString();
                                debug = 4;
                                //Khoi tao ket qua ghi log mac dinh

                                cardObject.Amount     = data.Amount;
                                cardObject.Experied   = string.Empty;
                                cardObject.CardType   = data.CardType;
                                cardObject.TelCode    = serviceCode;
                                cardObject.TradeMark  = "muathe24h";
                                cardObject.BuyTime    = DateTime.Now;
                                cardObject.ResultCode = resultCode;

                                debug = 5;
                                if (res != null && res.RepCode == 0)
                                {
                                    successtransaction++;
                                    var seri = JsonConvert.DeserializeObject <List <CardObject_Muathe24h> >(res.Data.ToString());
                                    //Mua thanh cong ghi lai code va seri the
                                    cardObject.CardCode        = seri[0].PinCode;
                                    cardObject.CardSerial      = seri[0].Serial;
                                    cardObject.TransactionCode = transactionId.ToString();
                                    cardObject.Status          = true; //Mua thanh cong
                                    LogClass.SaveLog("cardObject buy success:" + JsonConvert.SerializeObject(cardObject));
                                    result.status = managerModel.GameAcountModel.INPUT_CARD(cardObject, ref msg);
                                    if (result.status != 1)
                                    {
                                        debug = 3;
                                        errorsavelog++;
                                        cardObject.CardCode        = string.Empty;
                                        cardObject.CardSerial      = string.Empty;
                                        cardObject.TransactionCode = string.Empty;
                                        cardObject.Status          = false; // Mua that bai
                                        LogClass.SaveLog("cardObject savelog error:" + JsonConvert.SerializeObject(cardObject));
                                        managerModel.GameAcountModel.INPUT_CARD(cardObject, ref msg);
                                    }
                                }
                                else //Mua the that bai
                                {
                                    debug = 4;
                                    errortransaction++;
                                    cardObject.CardCode        = string.Empty;
                                    cardObject.CardSerial      = string.Empty;
                                    cardObject.TransactionCode = string.Empty;
                                    cardObject.Status          = false; // Mua that bai
                                    LogClass.SaveLog("cardObject buy card error:" + JsonConvert.SerializeObject(cardObject));
                                    managerModel.GameAcountModel.INPUT_CARD(cardObject, ref msg);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            LogClass.SaveError("Mua thẻ thất bại" + ex + "\n,cardObject:" + JsonConvert.SerializeObject(cardObject));
                        }
                        string msgTotalBuyCard = "Mua thành công " + successtransaction + " thẻ";
                        if (errortransaction > 0)
                        {
                            msgTotalBuyCard += " và thất bại " + errortransaction + " thẻ";
                        }
                        if (errorsavelog > 0)
                        {
                            msgTotalBuyCard += ". Ghi log thất bại " + errorsavelog + " thẻ";
                        }

                        result.msg = msgTotalBuyCard;
                    }
                    else
                    {
                        result = publisherInfo;
                    }
                }
                catch (Exception ex)
                {
                    LogClass.SaveError("ERROR InputCard: " + ex.Message + "\n,cardObject:" + JsonConvert.SerializeObject(cardObject), ex, true);
                    result.status = (int)ERROR_CODDE.ERROR_EX;
                    result.msg    = ex.Message;
                }
                return(Request.CreateResponse(result));
            }