コード例 #1
0
    public static DataTable VoteRegisterInsert(VoteRegisteredInfo entity)
    {
        DataSet ds = SqlHelper.ExecuteDataset(AppEnv.ConnectionString, "Vote_Registered_Users_Insert"
                                              , entity.User_ID
                                              , entity.Request_ID
                                              , entity.Service_ID
                                              , entity.Command_Code
                                              , entity.Service_Type
                                              , entity.Charging_Count
                                              , entity.FailedChargingTime
                                              , entity.RegisteredTime
                                              , entity.ExpiredTime
                                              , entity.Registration_Channel
                                              , entity.Status
                                              , entity.Operator
                                              , entity.Vote_Count
                                              , entity.Vote_PersonId
                                              , entity.IsDislike

                                              );

        if (ds != null && ds.Tables.Count > 0)
        {
            return(ds.Tables[0]);
        }
        return(null);
    }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["msisdn"] == null)
                {
                    int    is3g   = 0;
                    string msisdn = MobileUtils.GetMSISDN(out is3g);
                    if (!string.IsNullOrEmpty(msisdn) && MobileUtils.CheckOperator(msisdn, "vietnammobile"))
                    {
                        Session["telco"]  = Constant.T_Vietnamobile;
                        Session["msisdn"] = msisdn;
                        ltrXinChao.Text   = "Xin chào <b>" + msisdn + "</b>";
                    }
                    else
                    {
                        Session["msisdn"] = null;
                        Session["telco"]  = Constant.T_Undefined;
                        ltrXinChao.Text   = "Xin chào <b>khách</b>";
                    }
                }
                else
                {
                    ltrXinChao.Text = "Xin chào <b>" + Session["msisdn"] + "</b>";
                }

                #region Xử lý ĐẶT GẠCH

                string message   = string.Empty;
                string serviceId = "8379";
                madichvu = Request.QueryString["t"];
                madichvu = madichvu.ToUpper();

                string regisChannel = "WAP";
                if (madichvu == "GACH1")
                {
                    regisChannel = "VMG1";
                }
                else if (madichvu == "GACH2")
                {
                    regisChannel = "VMG2";
                }
                else if (madichvu == "GACH3")
                {
                    regisChannel = "VMG3";
                }

                madichvu = madichvu.Replace("1", "").Replace("2", "").Replace("3", "");

                if (!string.IsNullOrEmpty(madichvu))
                {
                    madichvu = madichvu.ToUpper().Trim();

                    if (Session["msisdn"] != null)
                    {
                        price = "5000";
                        string messageReturn;

                        var charging = new Library.VNMCharging.VNMChargingGW();
                        messageReturn = charging.NavigatePaymentVnm(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price, "D", "VID", "Vote " + madichvu);

                        if (messageReturn == AppEnv.GetSetting("NotEnoughMoney"))//Not Enough Money
                        {
                            messageReturn = AppEnv.VnmChargingOptimizeNotEnoughMoney(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price, "D", "VID", "Vote " + madichvu, out logPrice);
                            price         = logPrice;
                        }

                        if (messageReturn == "1")//Charged Thanh Cong
                        {
                            #region DK USER

                            var entity = new VoteRegisteredInfo();
                            entity.User_ID              = Session["msisdn"].ToString();
                            entity.Request_ID           = "0";
                            entity.Service_ID           = serviceId;
                            entity.Command_Code         = madichvu;
                            entity.Service_Type         = 1;
                            entity.Charging_Count       = 0;
                            entity.FailedChargingTime   = 0;
                            entity.RegisteredTime       = DateTime.Now;
                            entity.ExpiredTime          = DateTime.Now.AddDays(1);
                            entity.Registration_Channel = regisChannel;
                            entity.Status     = 1;
                            entity.Operator   = "vnmobile";
                            entity.Vote_Count = 1;

                            entity.Vote_PersonId    = 1;
                            entity.IsDislike        = 0;
                            entity.Dislike_Count    = 1;
                            entity.Dislike_PersonId = 0;
                            DataTable dt = WapController.SecretRegisterInsert(entity);

                            if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                            {
                                litThongBao.Text = "Chúc mừng bạn đã đăng ký thành công Gameshow 'BÍ MẬT ĐỘNG TRỜI CỦA MAI THỎ'.<br /> Hãy đặt gạch càng nhiều để có cơ hội hẹn hò và biết bí mật đằng sau của Mai Thỏ là gì.<br /> Chi tiết truy cập http://wap.vietnamobile.com.vn. HT: 19001255";
                            }
                            else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                            {
                                DataTable dtVoteInfo = WapController.SecretGetCountByPersonId(Session["msisdn"].ToString(), 1);
                                litThongBao.Text = "Bạn đã ĐẶT GẠCH thành công cho : " + dtVoteInfo.Rows[0]["Name"] + ".<br /> Số lượt GẠCH của bạn : " + dtVoteInfo.Rows[0]["Count"] + "<br /> Bạn đang thuộc top : " + dtVoteInfo.Rows[0]["Top"] + " những người ĐẶT GẠCH nhiều nhất <br /> ĐẶT GẠCH càng nhiều bạn càng có cơ hội hẹn hò và biết bí mật đằng sau của Mai Thỏ là gì.<br /> Chi tiết truy cập: http://wap.vietnamobile.com.vn. HT: 19001255";
                            }

                            #endregion
                        }
                        else
                        {
                            litThongBao.Text = lang == "1" ? "Đăng ký không thành công. Vui lòng thử loại hoặc tài khoản không đủ tiền" : "Dang ky khong thanh cong. Vui long thu lai hoac tai khoan khong du tien";
                        }

                        #region Log Doanh Thu

                        var eLog = new VoteChargedUserLogInfo();

                        eLog.User_ID              = Session["msisdn"].ToString();
                        eLog.Request_ID           = "0";
                        eLog.Service_ID           = serviceId;
                        eLog.Command_Code         = madichvu;
                        eLog.Service_Type         = 1;
                        eLog.Charging_Count       = 0;
                        eLog.FailedChargingTime   = 0;
                        eLog.RegisteredTime       = DateTime.Now;
                        eLog.ExpiredTime          = DateTime.Now.AddDays(1);
                        eLog.Registration_Channel = regisChannel;
                        eLog.Status   = 1;
                        eLog.Operator = "vnmobile";

                        if (messageReturn == "1")
                        {
                            eLog.Reason = "Succ";
                        }
                        else
                        {
                            eLog.Reason = messageReturn;
                        }

                        eLog.Price         = ConvertUtility.ToInt32(price);
                        eLog.Vote_PersonId = 1;

                        WapController.SecretChargedUserLogInsert(eLog);

                        #endregion
                    }
                    else
                    {
                        if (madichvu == "GACH")
                        {
                            message          = "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS<br /> Hoặc soạn tin: " + madichvu + " gửi " + serviceId;
                            litThongBao.Text = message;
                        }
                        else
                        {
                            message =
                                "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS";
                            litThongBao.Text = message;
                        }
                    }
                }


                #endregion

                DataSet dsMt = WapController.SecretGetTopUserVote(1);

                if (dsMt != null && dsMt.Tables[0].Rows.Count > 0)
                {
                    rptMaiTho.DataSource = dsMt.Tables[0];
                    rptMaiTho.DataBind();
                    lblMtUnLike.Text = dsMt.Tables[1].Rows[0]["Like"].ToString();

                    rptLinhMiu.DataSource = dsMt.Tables[0];
                    rptLinhMiu.DataBind();
                    lblLmUnLike.Text = dsMt.Tables[1].Rows[0]["Like"].ToString();
                }

                #region FACEBOOK Comment

                string url = AppEnv.GetSetting("WapDefault") + Request.RawUrl;

                ltCommentFB.Text = "<div class=\"fb-comments\" data-mobile=\"false\" data-href='" + url + "' data-width=\"320\" data-num-posts=\"5\"></div>";

                string Facebook_raw_data = get_web_content("http://api.facebook.com/restserver.php?method=links.getStats&urls=" + url);

                XmlDocument dom = new XmlDocument();
                dom.LoadXml(Facebook_raw_data);

                #endregion
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lang  = Request.QueryString["lang"];
            width = ConvertUtility.ToInt32(Request.QueryString["w"]);

            madichvu = Request.QueryString["t"];
            madichvu = madichvu.ToUpper().Trim();

            //int votePrice = 2000;
            price = "5000";

            if (!Page.IsPostBack)
            {
                //if (width == 0)
                //    width = (int)Constant.DefaultScreen.Standard;
                //ltrWidth.Text = "<meta content=\"width=" + width + "; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" name=\"viewport\" />";

                if (Session["msisdn"] == null)
                {
                    int    is3g   = 0;
                    string msisdn = MobileUtils.GetMSISDN(out is3g);
                    if (!string.IsNullOrEmpty(msisdn) && MobileUtils.CheckOperator(msisdn, "vietnammobile"))
                    {
                        Session["telco"]  = Constant.T_Vietnamobile;
                        Session["msisdn"] = msisdn;
                        litMsisdn.Text    = "Xin chào <b>" + msisdn + "</b>";
                    }
                    else
                    {
                        Session["msisdn"] = null;
                        Session["telco"]  = Constant.T_Undefined;
                        litMsisdn.Text    = "Xin chào <b>khách</b>";
                    }
                }

                string messageReturn;
                int    votePersonId = 1;

                if (Session["msisdn"] != null)
                {
                    #region Xu Ly Charging

                    var charging = new Library.VNMCharging.VNMChargingGW();



                    //if (AppEnv.GetSetting("TestFlag") == "1")
                    //{
                    //    messageReturn = "1";
                    //}
                    //else
                    //{
                    //messageReturn = charging.NavigatePaymentVnm(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price.ToString(), "D", "VID", "Vote " + madichvu);
                    //}

                    //var charging = new Library.VNMCharging.VNMChargingGW();

                    messageReturn = charging.NavigatePaymentVnm(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price, "D", "VID", "Vote " + madichvu);

                    if (messageReturn == AppEnv.GetSetting("NotEnoughMoney"))//Not Enough Money
                    {
                        messageReturn = AppEnv.VnmChargingOptimizeNotEnoughMoney(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price, "D", "VID", "Vote " + madichvu, out logPrice);
                        price         = logPrice;
                    }

                    //pnlSMS.Visible = false;
                    //pnlThongBao.Visible = false;
                    //pnlNoiDung.Visible = true;

                    if (messageReturn == "1")//Charged Thanh Cong
                    {
                        int    disLike         = 0;
                        int    dislikePersonId = 1;
                        string personName      = "";

                        if (madichvu == "VOTE1")
                        {
                            votePersonId = 1;
                            disLike      = 0;
                            personName   = "Mai Thỏ";
                        }
                        else if (madichvu == "VOTE2")
                        {
                            votePersonId = 2;
                            disLike      = 0;
                            personName   = "Linh Miu";
                        }
                        else if (madichvu == "GACH1")
                        {
                            votePersonId    = 2;
                            dislikePersonId = 1;
                            disLike         = 1;
                            personName      = "Mai Thỏ";
                        }
                        else if (madichvu == "GACH2")
                        {
                            votePersonId    = 1;
                            dislikePersonId = 2;
                            disLike         = 1;
                            personName      = "Linh Miu";
                        }

                        var entity = new VoteRegisteredInfo();
                        entity.User_ID              = Session["msisdn"].ToString();
                        entity.Request_ID           = "0";
                        entity.Service_ID           = "8279";
                        entity.Command_Code         = madichvu;
                        entity.Service_Type         = 1;
                        entity.Charging_Count       = 0;
                        entity.FailedChargingTime   = 0;
                        entity.RegisteredTime       = DateTime.Now;
                        entity.ExpiredTime          = DateTime.Now.AddDays(1);
                        entity.Registration_Channel = "WAP";
                        entity.Status     = 1;
                        entity.Operator   = "vnmobile";
                        entity.Vote_Count = 1;

                        entity.Vote_PersonId    = votePersonId;
                        entity.IsDislike        = disLike;
                        entity.Dislike_Count    = 1;
                        entity.Dislike_PersonId = dislikePersonId;

                        if (madichvu == "VOTE1" || madichvu == "VOTE2")
                        {
                            DataTable dt = WapController.VoteRegisterInsert(entity);
                            if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                            {
                                litThongBao.Text = "Chúc mừng bạn đã đăng ký thành công Gameshow 'Hẹn hò cùng thần tượng'.<br /> Hãy vote cho " + personName + " để trở thành người chiến thắng.<br /> Chi tiết truy cập http://wap.vietnamobile.com.vn. HT: 19001255";
                            }
                            else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                            {
                                //litThongBao.Text = "Bạn đã vote thành công cho " + personName + ".<br /> Vote càng nhiều bạn càng có cơ hội là 1 trong 3 người hẹn hò thần tượng.<br /> Soạn: Vote1 gửi 8279 để gặp Mai Thỏ. Soạn: Vote2 gửi 8279 để gặp Linh Miu<br /> Chi tiết truy cập: http://wap.vietnamobile.com.vn. HT: 19001255";

                                //DataTable dtVoteInfo = WapController.VoteGetCount(Session["msisdn"].ToString(), madichvu);
                                //if (dtVoteInfo.Rows[0]["Count"].ToString() == "0")
                                //{
                                int revotePersonId = 0;
                                if (madichvu == "VOTE2")
                                {
                                    revotePersonId = 2;
                                }
                                else if (madichvu == "VOTE1")
                                {
                                    revotePersonId = 1;
                                }
                                DataTable dtVoteInfo = WapController.VoteGetCountByPersonId(Session["msisdn"].ToString(), revotePersonId);
                                //}

                                litThongBao.Text = "Bạn đã vote thành công cho : " + dtVoteInfo.Rows[0]["Name"] + ".<br /> Số lượt vote của bạn : " + dtVoteInfo.Rows[0]["Count"] + "<br /> Bạn đang thuộc top : " + dtVoteInfo.Rows[0]["Top"] + " những người vote nhiều nhất <br /> Vote càng nhiều bạn càng có cơ hội là 1 trong 4 người hẹn hò thần tượng.<br /> Chi tiết truy cập: http://wap.vietnamobile.com.vn. HT: 19001255";
                            }
                        }
                        else if (madichvu == "GACH1" || madichvu == "GACH2")
                        {
                            DataTable dtDislike = WapController.VoteRegisterDislikeInsert(entity);
                            DataTable dt        = WapController.VoteRegisterInsert(entity);
                            if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                            {
                                litThongBao.Text = "Chúc mừng bạn đã đăng ký thành công Gameshow 'Hẹn hò cùng thần tượng'.<br /> Hãy ném gạch " + personName + " mà bạn không thích để trở thành người chiến thắng.<br /> Chi tiết truy cập: http://wap.vietnamobile.com.vn. HT: 19001255";
                            }
                            else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                            {
                                //litThongBao.Text = "Bạn đã Ném gạch " + personName + " thành công.<br /> Ném gạch càng nhiều bạn có cơ hội là 1 trong 3 người hẹn hò thần tượng.<br /> Soạn: Gach1 gửi 8279 để gặp gỡ Linh Miu. Soạn: Gach2 gửi 8279 để gặp Mai Thỏ .<br /> Chi tiết truy cập:  http://wap.vietnamobile.com.vn. HT: 19001255";

                                DataTable dtGachInfo = WapController.VoteGetCount(Session["msisdn"].ToString(), madichvu);
                                litThongBao.Text = "Bạn đã ném gạch " + dtGachInfo.Rows[0]["Name"] + " thành công .<br />Số Gạch của bạn : " + dtGachInfo.Rows[0]["Count"] + "<br /> Bạn đang thuộc top: " + dtGachInfo.Rows[0]["Top"] + " những người Ném Gạch nhiều nhất <br />Ném Gạch càng nhiều bạn càng có cơ hội là 1 trong 4 người hẹn hò thần tượng.<br /> Chi tiết truy cập : http://wap.vietnamobile.com.vn. HT: 19001255";
                            }
                        }

                        //#region Log Doanh Thu

                        //var eLog = new VoteChargedUserLogInfo();

                        //eLog.User_ID = Session["msisdn"].ToString(); ;
                        //eLog.Request_ID = "0";
                        //eLog.Service_ID = "8279";
                        //eLog.Command_Code = madichvu;
                        //eLog.Service_Type = 1;
                        //eLog.Charging_Count = 0;
                        //eLog.FailedChargingTime = 0;
                        //eLog.RegisteredTime = DateTime.Now;
                        //eLog.ExpiredTime = DateTime.Now.AddDays(1);
                        //eLog.Registration_Channel = "WAP";
                        //eLog.Status = 1;
                        //eLog.Operator = "vnmobile";
                        //eLog.Reason = "Succ";
                        //eLog.Price = 2000;
                        //eLog.Vote_PersonId = votePersonId;

                        //WapController.VoteChargedUserLogInsert(eLog);

                        //#endregion
                    }
                    else
                    {
                        litThongBao.Text = lang == "1" ? "Đăng ký không thành công. Vui lòng thử loại hoặc tài khoản không đủ tiền" : "Dang ky khong thanh cong. Vui long thu lai hoac tai khoan khong du tien";
                    }

                    #region Log Doanh Thu

                    var eLog = new VoteChargedUserLogInfo();

                    eLog.User_ID              = Session["msisdn"].ToString();;
                    eLog.Request_ID           = "0";
                    eLog.Service_ID           = "8279";
                    eLog.Command_Code         = madichvu;
                    eLog.Service_Type         = 1;
                    eLog.Charging_Count       = 0;
                    eLog.FailedChargingTime   = 0;
                    eLog.RegisteredTime       = DateTime.Now;
                    eLog.ExpiredTime          = DateTime.Now.AddDays(1);
                    eLog.Registration_Channel = "WAP";
                    eLog.Status   = 1;
                    eLog.Operator = "vnmobile";

                    if (messageReturn == "1")
                    {
                        eLog.Reason = "Succ";
                    }
                    else
                    {
                        eLog.Reason = messageReturn;
                    }

                    eLog.Price         = ConvertUtility.ToInt32(price);
                    eLog.Vote_PersonId = votePersonId;

                    WapController.VoteChargedUserLogInsert(eLog);

                    #endregion

                    #endregion
                }
                else
                {
                    if (madichvu == "VOTE1" || madichvu == "VOTE2" || madichvu == "GACH1" || madichvu == "GACH2")
                    {
                        litThongBao.Text = "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS<br /> Hoặc soạn tin: " + madichvu + " gửi " + "8279";;
                    }
                    else
                    {
                        litThongBao.Text = "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS";
                    }

                    //litThongBao.Text = "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS <br /> Hoặc soạn tin: " + madichvu + " gửi " + "8279";

                    //pnlSMS.Visible = true;
                    //if (lang == "1")
                    //{
                    //    ltrHuongdan.Text = "Thông Báo";
                    //    ltrSMS.Text = "Hệ thống không xác định được số điện thoại của bạn. Vui lòng truy cập bằng 3G/GPRS hoặc soạn tin: " + madichvu + " gửi " + "8279";
                    //}
                    //else
                    //{
                    //    ltrHuongdan.Text = "Thong Bao";
                    //    ltrSMS.Text =
                    //        "He thong khong xac dinh duoc so dien thoai cua ban. Vui long truy cap bang 3G/GPRS hoac soan tin " + madichvu + " gui " + "8279";
                    //}
                }

                DataSet dsMt = WapController.GetTopUserVote(1);
                DataSet dsLm = WapController.GetTopUserVote(2);

                //DataTable dtMt = WapController.GetTopUserVote(1);
                //DataTable dtLm = WapController.GetTopUserVote(2);

                if (dsMt != null && dsMt.Tables[0].Rows.Count > 0)
                {
                    rptMaiTho.DataSource = dsMt.Tables[0];
                    rptMaiTho.DataBind();

                    lblMtLike.Text   = dsMt.Tables[1].Rows[0]["Like"].ToString();
                    lblMtUnLike.Text = dsMt.Tables[2].Rows[0]["UnLike"].ToString();
                }

                if (dsLm != null && dsLm.Tables[0].Rows.Count > 0)
                {
                    rptLinhMiu.DataSource = dsLm.Tables[0];
                    rptLinhMiu.DataBind();

                    lblLmLike.Text   = dsLm.Tables[1].Rows[0]["Like"].ToString();
                    lblLmUnLike.Text = dsLm.Tables[2].Rows[0]["UnLike"].ToString();
                }

                #region FACEBOOK Comment

                string url = AppEnv.GetSetting("WapDefault") + "/vote.aspx";

                ltCommentFB.Text = "<div class=\"fb-comments\" data-mobile=\"false\" data-href='" + url + "' data-width=\"320\" data-num-posts=\"5\"></div>";

                string Facebook_raw_data = get_web_content("http://api.facebook.com/restserver.php?method=links.getStats&urls=" + url);

                XmlDocument dom = new XmlDocument();
                dom.LoadXml(Facebook_raw_data);

                #endregion
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["msisdn"] == null)
                {
                    int    is3g   = 0;
                    string msisdn = MobileUtils.GetMSISDN(out is3g);
                    if (!string.IsNullOrEmpty(msisdn) && MobileUtils.CheckOperator(msisdn, "vietnammobile"))
                    {
                        Session["telco"]  = Constant.T_Vietnamobile;
                        Session["msisdn"] = msisdn;
                        //ltrXinChao.Text = "Xin chào <b>" + msisdn + "</b>";
                    }
                    else
                    {
                        Session["msisdn"] = null;
                        Session["telco"]  = Constant.T_Undefined;
                        //ltrXinChao.Text = "Xin chào <b>khách</b>";
                    }
                }

                string madichvu  = Request.QueryString["t"];
                string message   = string.Empty;
                string serviceId = "8579";


                if (!string.IsNullOrEmpty(madichvu))
                {
                    if (Session["msisdn"] != null)
                    {
                        price = "5000";
                        string messageReturn;
                        madichvu = madichvu.ToUpper();

                        var charging = new Library.VNMCharging.VNMChargingGW();
                        messageReturn = charging.NavigatePaymentVnm(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price, "D", "VID", "Vote " + madichvu);

                        if (messageReturn == AppEnv.GetSetting("NotEnoughMoney"))//Not Enough Money
                        {
                            messageReturn = AppEnv.VnmChargingOptimizeNotEnoughMoney(Session["msisdn"].ToString(), "VIDEOGIFT", "VIDEO_GIFT", price, "D", "VID", madichvu, out logPrice);
                            price         = logPrice;
                        }

                        if (messageReturn == "1")//Charged Thanh Cong
                        {
                            #region DK USER

                            var entity = new VoteRegisteredInfo();
                            entity.User_ID              = Session["msisdn"].ToString();
                            entity.Request_ID           = "0";
                            entity.Service_ID           = serviceId;
                            entity.Command_Code         = madichvu;
                            entity.Service_Type         = 1;
                            entity.Charging_Count       = 0;
                            entity.FailedChargingTime   = 0;
                            entity.RegisteredTime       = DateTime.Now;
                            entity.ExpiredTime          = DateTime.Now.AddDays(1);
                            entity.Registration_Channel = "WAP";
                            entity.Status     = 1;
                            entity.Operator   = "vnmobile";
                            entity.Vote_Count = 1;

                            entity.Vote_PersonId    = 1;
                            entity.IsDislike        = 0;
                            entity.Dislike_Count    = 1;
                            entity.Dislike_PersonId = 0;
                            DataTable dt = WapController.NewVoteRegisterInsert(entity);

                            if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                            {
                                litThongBao.Text = "Chúc mừng bạn đã đăng ký thành công Gameshow 'Hẹn Hò cùng Hot Girl'.<br /> Hãy vote để Hẹn Hò với 1 trong 5 Hot Girl Xinh Đẹp";
                            }
                            else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                            {
                                DataTable dtVoteInfo = WapController.NewVoteGetUserInfo(Session["msisdn"].ToString());
                                int       voteCount  = ConvertUtility.ToInt32(dtVoteInfo.Rows[0]["Vote_Count"].ToString());
                                string    voteTop    = GetTopVote(voteCount);

                                litThongBao.Text = "Số lượt Vote của bạn : " + voteCount + " .<br />Bạn đang thuộc top : " + voteTop + " những người Vote nhiều nhất. <br />Hãy vote để Hẹn Hò với 1 trong 5 Hot Girl Xinh Đẹp";
                            }

                            #endregion
                        }
                        else
                        {
                            litThongBao.Text = "Đăng ký không thành công. Vui lòng thử loại hoặc tài khoản không đủ tiền";
                        }

                        #region Log Doanh Thu

                        var eLog = new VoteChargedUserLogInfo();

                        eLog.User_ID              = Session["msisdn"].ToString();
                        eLog.Request_ID           = "0";
                        eLog.Service_ID           = serviceId;
                        eLog.Command_Code         = madichvu;
                        eLog.Service_Type         = 1;
                        eLog.Charging_Count       = 0;
                        eLog.FailedChargingTime   = 0;
                        eLog.RegisteredTime       = DateTime.Now;
                        eLog.ExpiredTime          = DateTime.Now.AddDays(1);
                        eLog.Registration_Channel = "WAP";
                        eLog.Status   = 1;
                        eLog.Operator = "vnmobile";

                        if (messageReturn == "1")
                        {
                            eLog.Reason = "Succ";
                        }
                        else
                        {
                            eLog.Reason = messageReturn;
                        }

                        eLog.Price         = ConvertUtility.ToInt32(price);
                        eLog.Vote_PersonId = 1;

                        WapController.NewVoteChargedUserLogInsert(eLog);

                        #endregion
                    }
                    else
                    {
                        if (madichvu == "VOTE1")
                        {
                            message          = "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS<br /> Hoặc soạn tin: " + madichvu + " gửi " + serviceId;
                            litThongBao.Text = message;
                        }
                        else
                        {
                            message =
                                "Hệ thống không xác định được số điện thoại của bạn.<br /> Vui lòng truy cập bằng 3G/GPRS";
                            litThongBao.Text = message;
                        }
                    }
                }

                DataSet dtVote = WapController.NewGetTopUserVote();
                if (dtVote.Tables[0].Rows.Count > 0)
                {
                    rptTop.DataSource = dtVote.Tables[0];
                    rptTop.DataBind();

                    VoteSum = dtVote.Tables[1].Rows[0]["Like"].ToString();
                }

                #region FACEBOOK Comment

                string url = AppEnv.GetSetting("WapDefault") + Request.RawUrl;

                ltCommentFB.Text = "<div class=\"fb-comments\" data-mobile=\"false\" data-href='" + url + "' data-width=\"320\" data-num-posts=\"5\"></div>";

                string Facebook_raw_data = get_web_content("http://api.facebook.com/restserver.php?method=links.getStats&urls=" + url);

                XmlDocument dom = new XmlDocument();
                dom.LoadXml(Facebook_raw_data);

                #endregion
            }
        }
コード例 #5
0
    public void ProcessRequest(HttpContext context)
    {
        //context.Response.ContentType = "text/plain";
        //context.Response.Write("Hello World");

        string serviceCode = context.Request.QueryString["serviceCode"];

        if (!string.IsNullOrEmpty(serviceCode))
        {
            serviceCode = serviceCode.ToUpper();
        }

        string msisdn = context.Request.QueryString["msisdn"];
        string type   = context.Request.QueryString["Type"];

        string serviceId = "8979";

        const string reType    = "text";
        string       reContent = string.Empty;

        log4net.ILog log = log4net.LogManager.GetLogger("File");
        log.Debug(" ");
        log.Debug(" ");
        log.Debug("--------------------VOTE MOBI FROM Mr.T-------------------------");
        log.Debug("User_ID: " + msisdn);
        log.Debug("Command_Code: " + serviceCode);
        log.Debug("Type: " + type);
        log.Debug(" ");
        log.Debug(" ");


        if (serviceCode == "V1" || serviceCode == "V2" || serviceCode == "G1" || serviceCode == "G2")//DV VOTE1 & VOTE2
        {
            int    votePersonId = 1;
            string personName   = "Mai Tho";
            string commandCode  = "VOTE1";

            int dislikePersonId = 0;

            if (serviceCode == "V2")
            {
                votePersonId = 2;
                personName   = "Linh Miu";
                commandCode  = "VOTE2";
            }
            else if (serviceCode == "G1")
            {
                votePersonId    = 2;
                dislikePersonId = 1;
                personName      = "Mai Tho";
                commandCode     = "GACH1";
            }
            else if (serviceCode == "G2")
            {
                votePersonId    = 1;
                dislikePersonId = 2;
                personName      = "Linh Miu";
                commandCode     = "GACH2";
            }

            if (type == "1")//DK DV LAN DAU
            {
                var entity = new VoteRegisteredInfo();
                entity.User_ID              = msisdn;
                entity.Request_ID           = "0";
                entity.Service_ID           = serviceId;
                entity.Command_Code         = commandCode;
                entity.Service_Type         = 1;
                entity.Charging_Count       = 0;
                entity.FailedChargingTime   = 0;
                entity.RegisteredTime       = DateTime.Now;
                entity.ExpiredTime          = DateTime.Now.AddDays(1);
                entity.Registration_Channel = "SMS";
                entity.Status     = 1;
                entity.Operator   = "vms";
                entity.Vote_Count = 1;

                entity.Vote_PersonId = votePersonId;
                entity.IsDislike     = dislikePersonId;

                if (serviceCode == "V1" || serviceCode == "V2")
                {
                    DataTable dt = VoteRegisterController.NewVoteRegisterInsert(entity);

                    if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//CHUA DK USER
                    {
                        reContent = AppEnv.GetSetting("Vote_Sms_RegisterSucess_Mt2_Like_Mobi").Replace("VoteCount", "1").Replace("VoteTop", "100");
                    }
                    else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                    {
                        int    voteCount = ConvertUtility.ToInt32(dt.Rows[0]["VOTE_SUM"]);
                        string voteTop   = GetTopVote(voteCount);
                        reContent = AppEnv.GetSetting("Vote_Sms_RegisterSucess_Mt2_Like_Mobi").Replace("VoteCount", voteCount.ToString()).Replace("VoteTop", voteTop);
                    }

                    #region LOG DOANH THU

                    NewVoteLogDoanhThu(msisdn, "0", serviceId, "VOTE1");

                    #endregion
                }
                //else
                //{
                //    DataTable dt = VoteRegisterController.VoteRegisterInsert(entity);
                //    DataTable dtDislike = VoteRegisterController.VoteRegisterDislikeInsert(entity);

                //    if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                //    {
                //        reContent = AppEnv.GetSetting("Vote_Sms_RegisterSucess_Mt2_Like_Mobi").Replace("PersonName", personName);
                //    }
                //    else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                //    {
                //        reContent = AppEnv.GetSetting("Vote_Sms_AlreadyRegister_Mobi");
                //    }
                //}
            }
            else if (type == "2")//UPDATE LUOT VOTE (SUB HANG NGAY)
            {
                DataTable info = VoteRegisterController.NewVoteGetUserInfo(msisdn);
                if (info != null && info.Rows.Count > 0)
                {
                    var logInfo = new ViSport_S2_Charged_Users_LogInfo();

                    logInfo.ID                   = ConvertUtility.ToInt32(info.Rows[0]["ID"].ToString());
                    logInfo.User_ID              = msisdn;
                    logInfo.Request_ID           = info.Rows[0]["Request_ID"].ToString();
                    logInfo.Service_ID           = info.Rows[0]["Service_ID"].ToString();
                    logInfo.Command_Code         = info.Rows[0]["Command_Code"].ToString();
                    logInfo.Service_Type         = 0;//Charged Sub Service_Type
                    logInfo.Charging_Count       = ConvertUtility.ToInt32(info.Rows[0]["Charging_Count"].ToString());
                    logInfo.FailedChargingTimes  = ConvertUtility.ToInt32(info.Rows[0]["FailedChargingTimes"].ToString());
                    logInfo.RegisteredTime       = DateTime.Now;
                    logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
                    logInfo.Registration_Channel = info.Rows[0]["Registration_Channel"].ToString();
                    logInfo.Status               = ConvertUtility.ToInt32(info.Rows[0]["Status"].ToString());
                    logInfo.Operator             = info.Rows[0]["Operator"].ToString();
                    logInfo.Price                = 2000;
                    logInfo.Vote_PersonId        = ConvertUtility.ToInt32(info.Rows[0]["Vote_PersonId"].ToString());
                    logInfo.Reason               = "Succ";

                    if (serviceCode == "V1" || serviceCode == "V2")
                    {
                        VoteRegisterController.NewInsertLogLike(logInfo);

                        DataTable dt        = VoteRegisterController.NewVoteGetUserInfo(msisdn);
                        int       voteCount = ConvertUtility.ToInt32(dt.Rows[0]["Vote_Count"]);
                        string    voteTop   = GetTopVote(voteCount);

                        reContent = AppEnv.GetSetting("Vote_Sms_RegisterSucess_Mt2_Like_Mobi").Replace("VoteCount", voteCount.ToString()).Replace("VoteTop", voteTop);

                        //DataTable dt = VoteRegisterController.GetVoteAccountInfo(msisdn, info.Rows[0]["Command_Code"].ToString());
                        //reContent = AppEnv.GetSetting("Vote_Sms_ChargedSubSucess_Like").Replace("PersonName", dt.Rows[0]["Name"].ToString());
                        //reContent = reContent.Replace("VoteCount", dt.Rows[0]["Count"].ToString());
                        //reContent = reContent.Replace("VoteTop", dt.Rows[0]["Top"].ToString());
                    }
                    //else if(serviceCode == "G1" || serviceCode == "G2")
                    //{
                    //    if (info.Rows[0]["Vote_PersonId"].ToString() == "1")
                    //    {
                    //        logInfo.Vote_PersonId = 2;
                    //    }
                    //    else if (info.Rows[0]["Vote_PersonId"].ToString() == "2")
                    //    {
                    //        logInfo.Vote_PersonId = 1;
                    //    }
                    //    VoteRegisterController.InsertLogDisLike(logInfo);
                    //    DataTable dt = VoteRegisterController.GetVoteAccountInfo(msisdn, info.Rows[0]["Command_Code"].ToString());

                    //    reContent = AppEnv.GetSetting("Vote_Sms_ChargedSubSucess_UnLike").Replace("PersonName", dt.Rows[0]["Name"].ToString());
                    //    reContent = reContent.Replace("DislikeCount", dt.Rows[0]["Count"].ToString());
                    //    reContent = reContent.Replace("DislikeTop", dt.Rows[0]["Top"].ToString());
                    //}
                }
            }
            else if (type == "3")//HUY DICH VU
            {
                DataTable dt = VoteRegisterController.NewVoteRegisterUserLock(msisdn);

                if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//CHUA DK USER
                {
                    reContent = AppEnv.GetSetting("Vote_Sms_LockUserError_Mobi");
                }
                else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                {
                    reContent = AppEnv.GetSetting("Vote_Sms_LockUserSuccess_Mobi");
                }
                //DataTable dt = VoteRegisterController.VoteRegisterUserLock(msisdn, 1);

                //if (dt.Rows[0]["RETURN_ID"].ToString() == "0")//CHUA DK USER
                //{
                //    reContent = AppEnv.GetSetting("Vote_Sms_LockUserError_Mobi");
                //}
                //else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                //{
                //    reContent = AppEnv.GetSetting("Vote_Sms_LockUserSuccess_Mobi");
                //}
            }
        }

        if (serviceCode == "T1") //DV GAME THANH_NU
        {
            if (type == "1")     //DK DV LAN DAU
            {
                var entity = new ThanhNuRegisteredUsers();
                entity.UserId              = msisdn;
                entity.RequestId           = "0";
                entity.ServiceId           = "2288";
                entity.CommandCode         = "DK";
                entity.ServiceType         = 1;
                entity.ChargingCount       = 0;
                entity.FailedChargingTimes = 0;
                entity.RegisteredTime      = DateTime.Now;
                entity.ExpiredTime         = DateTime.Now.AddDays(1);
                entity.RegistrationChannel = "SMS";
                entity.Status              = 1;
                entity.Operator            = GetTelco(msisdn);

                #region GOI HAM DK BEN DOI TAC

                string partnerResult = AppEnv.ThanhNuDangKy(msisdn);

                log.Debug(" ");
                log.Debug("**********");
                log.Debug("Partner_Thanh_Nu_smsKichHoat : " + partnerResult);
                log.Debug("**********");
                log.Debug(" ");

                string[] arrValue = partnerResult.Split('|');
                if (arrValue[0].Trim() == "1")
                {
                    ViSport_S2_Registered_UsersController.ThanhNuRegisterUserStatusUpdate(msisdn, 1);
                    reContent = "Ban da la thanh vien cua Game Thanh Nu. Click vao link sau de dang nhap Game " + arrValue[1];
                }
                else if (arrValue[0].Trim() == "0")
                {
                    DataTable value = ViSport_S2_Registered_UsersController.ThanhNuRegisterUserInsert(entity);
                    if (value.Rows[0]["RETURN_ID"].ToString() == "0")
                    {
                        reContent = "Chuc mung Quy Khach da dang ky thanh cong Game Thanh Nu Gia cuoc 1000d-ngay, Goi dich vu se duoc tu dong gia han hang ngay.Kich hoat tai khoan " + arrValue[1] + " .De huy dang ky, Quy Khach soan HUY TN gui 2288.";
                    }
                    else if (value.Rows[0]["RETURN_ID"].ToString() == "1")
                    {
                        ViSport_S2_Registered_UsersController.ThanhNuRegisterUserStatusUpdate(msisdn, 1);
                        reContent = "Ban da la thanh vien cua Game Thanh Nu. Click vao link sau de dang nhap Game " + arrValue[1];
                    }
                }

                #endregion
            }
            else if (type == "2")//CHARGED SUB
            {
                var partnerService = new vn.thanhnu.Service();

                DataTable dtUser = ViSport_S2_Registered_UsersController.ThanhNuGetUserInfo(msisdn);
                if (dtUser != null && dtUser.Rows.Count > 0)
                {
                    string partnerResult = partnerService.smsGiaHan(msisdn, "1");
                    if (partnerResult.Trim() == "1")
                    {
                        reContent = "Goi dich vu Game Thanh Nu  cua Quy Khach da duoc gia han thanh cong. Quy khach duoc cong 110 G_Coin vao tk. Cam on Quy Khach da su dung goi dich vu .";
                    }

                    #region LOG DOANH THU

                    //LOG DOANH THU
                    var e = new ThanhNuChargedUserLogInfo();

                    e.ID                   = ConvertUtility.ToInt32(dtUser.Rows[0]["ID"].ToString());
                    e.User_ID              = msisdn;
                    e.Request_ID           = "0";
                    e.Service_ID           = serviceId;
                    e.Command_Code         = "DK";
                    e.Service_Type         = 0;
                    e.Charging_Count       = 0;
                    e.FailedChargingTime   = 0;
                    e.RegisteredTime       = DateTime.Now;
                    e.ExpiredTime          = DateTime.Now.AddDays(1);
                    e.Registration_Channel = "SMS";
                    e.Status               = 1;
                    e.Operator             = GetTelco(msisdn);

                    e.Reason = "Succ";

                    e.Price         = 1000;
                    e.PartnerResult = partnerResult;

                    ViSport_S2_Registered_UsersController.ThanhNuChargedUserLog(e);

                    #endregion
                }
            }
            else if (type == "3")//HUY DICH VU
            {
                #region GOI HAM HUY BEN DOI TAC

                string partnerResult = AppEnv.ThanhNuHuy(msisdn);
                if (partnerResult.Trim() == "1")
                {
                    DataTable value = ViSport_S2_Registered_UsersController.ThanhNuRegisterUserStatusUpdate(msisdn, 0);
                    if (value.Rows[0]["RETURN_ID"].ToString() == "1")
                    {
                        reContent = "Toan bo tai khoan Game Thanh Nu cua Quy khach se bi huy.De dang ki lai Qk vui long soan tin DK TN gui 2288";
                    }
                }

                #endregion
            }
        }



        var aSerializer = new JavaScriptSerializer();

        var obj = new MT();
        var ct1 = new ContentInfo();
        obj.List = new ContentInfo[1];

        ct1.Type    = reType;
        ct1.Content = reContent;
        obj.List[0] = ct1;

        string strReturn = aSerializer.Serialize(obj);

        log.Debug(" ");
        log.Debug(" ");
        log.Debug("strReturn: " + strReturn);
        log.Debug(" ");
        log.Debug(" ");

        context.Response.ContentType = "text/html";
        context.Response.Write(strReturn);
    }