Beispiel #1
0
        protected override void Awake()
        {
            if (Instance != null && Instance != this && Instance.gameObject != null)
            {
                DestroyImmediate(Instance.gameObject);
            }
            Instance = this;


            this.Client = PhotonNetwork.NetworkingClient;
            base.Awake();


            if (PhotonNetwork.PhotonServerSettings.EnableSupportLogger)
            {
                this.supportLoggerComponent                 = this.gameObject.AddComponent <SupportLogger>();
                this.supportLoggerComponent.Client          = PhotonNetwork.NetworkingClient;
                this.supportLoggerComponent.LogTrafficStats = true;
            }

            this.UpdateInterval            = 1000 / PhotonNetwork.SendRate;
            this.UpdateIntervalOnSerialize = 1000 / PhotonNetwork.SerializationRate;

            this.StartFallbackSendAckThread();
        }
        protected virtual void OnEnable()
        {
            if (Instance != this)
            {
                Debug.LogError("PhotonHandler is a singleton but there are multiple instances. this != Instance.");
                return;
            }

            this.Client = PhotonNetwork.NetworkingClient;

            if (PhotonNetwork.PhotonServerSettings.EnableSupportLogger)
            {
                SupportLogger supportLogger = this.gameObject.GetComponent <SupportLogger>();
                if (supportLogger == null)
                {
                    supportLogger = this.gameObject.AddComponent <SupportLogger>();
                }
                if (this.supportLoggerComponent != null)
                {
                    if (supportLogger.GetInstanceID() != this.supportLoggerComponent.GetInstanceID())
                    {
                        Debug.LogWarningFormat("Cached SupportLogger component is different from the one attached to PhotonMono GameObject");
                    }
                }
                this.supportLoggerComponent        = supportLogger;
                this.supportLoggerComponent.Client = PhotonNetwork.NetworkingClient;
            }

            this.UpdateInterval            = 1000 / PhotonNetwork.SendRate;
            this.UpdateIntervalOnSerialize = 1000 / PhotonNetwork.SerializationRate;

            PhotonNetwork.AddCallbackTarget(this);
            this.StartFallbackSendAckThread();  // this is not done in the base class
        }
    protected void btnAccept_Click(object sender, EventArgs e)
    {
        string inputText = txtUserEmail.Text.Trim();
        //daPeople = new People();
        if ((!daPeople.USP_People_CheckExistUsername(inputText)) && (!daPeople.USP_People_CheckExistEmail(inputText)))
        {
            lblThongBao.ForeColor = System.Drawing.Color.Yellow;
            lblThongBao.Text = "Không tìm thấy tài khoản nào phù hợp với thông tin này";
        }
        else  //Tồn tại người dùng
        {
            string sEmail, sPassword;

            daPeople.USP_People_GetBySomeConditional(inputText);
            daPeople.U_Fetch_Reader(true);
            sEmail = daPeople.fEmail;

            //Thực hiện gửi link đặt lại mật khẩu
            sPassword= Common.GetRandomString(6);
            string host = HttpContext.Current.Request.Url.Host;
            int iTB = sendEmail.SendMailForTechnical(sEmail, "Đặt lại mật khẩu SEA Guitar", "Tên đăng nhập: " + daPeople.fUserName + "<br/>Mật khẩu của bạn tại <a href='" + host + "' target='_blank'>" + host + "</a> là: " + sPassword, true);
            daPeople.CloseReader();

            if (iTB <= 0)
            {
                lblThongBao.Text = "Lỗi gửi email... Vui lòng thông báo cho chúng tôi biết";
                lblThongBao.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                //Mật khẩu
                string PassEncode;
                PassEncode = Cipher.EncryptText(sPassword, WebConfigurationManager.AppSettings["HomeFolder"]);
                if (daPeople.USP_People_UpdatePasswordByEmail(sEmail, PassEncode) <= 0)
                {
                    lblThongBao.Text = "Lỗi cập nhật mật khẩu mới vào database";
                }
                else
                {
                    lblThongBao.Text = "Chúng tôi đã gửi mật khẩu qua email. Vui lòng check email: " + sEmail;
                    lblThongBao.ForeColor = System.Drawing.Color.Yellow;

                    //Ghi log
                    StringBuilder str = new StringBuilder();

                    str.Append("sEmail:" + sEmail + "; ");
                    str.Append("PassEncode:" + sPassword.Substring(0, 3) + "; ");

                    SupportLogger log = new SupportLogger();
                    log.SP_ExcecutePro("USP_Sys_Log", new string[] { "@flag","@loginPeopleID", "@Module", "@Action", "@IPclient",
            "@Description" }, new object[] { 1, HttpContext.Current.Session["loginPeopleID"], "USP_People_UpdatePasswordByEmail", "Update", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], str.ToString() });
                }
            }
        }
    }
Beispiel #4
0
 protected override void Awake()
 {
     base.Awake();
     if (this.SpeakerFactory == null)
     {
         this.SpeakerFactory = SimpleSpeakerFactory;
     }
     if (enableSupportLogger)
     {
         this.supportLoggerComponent                 = this.gameObject.AddComponent <SupportLogger>();
         this.supportLoggerComponent.Client          = this.Client;
         this.supportLoggerComponent.LogTrafficStats = true;
     }
     #if !UNITY_ANDROID && !UNITY_IOS
     if (runInBackground)
     {
         Application.runInBackground = runInBackground;
     }
     #endif
 }
Beispiel #5
0
 protected override void Awake()
 {
     base.Awake();
     Logger = new VoiceLogger(this, string.Format("{0}.{1}", name, this.GetType().Name), logLevel);
     if (this.SpeakerFactory == null)
     {
         this.SpeakerFactory = SimpleSpeakerFactory;
     }
     if (enableSupportLogger)
     {
         this.supportLoggerComponent                 = this.gameObject.AddComponent <SupportLogger>();
         this.supportLoggerComponent.Client          = this.Client;
         this.supportLoggerComponent.LogTrafficStats = true;
     }
     #if !UNITY_ANDROID && !UNITY_IOS
     if (runInBackground)
     {
         Application.runInBackground = runInBackground;
     }
     #endif
 }
        protected virtual void OnEnable()
        {
            if (Instance != this)
            {
                Debug.LogError("PhotonHandler is a singleton but there are multiple instances. this != Instance.");
                return;
            }

            this.Client = PhotonNetwork.NetworkingClient;

            if (PhotonNetwork.PhotonServerSettings.EnableSupportLogger)
            {
                this.supportLoggerComponent        = this.gameObject.AddComponent <SupportLogger>();
                this.supportLoggerComponent.Client = PhotonNetwork.NetworkingClient;
            }

            this.UpdateInterval            = 1000 / PhotonNetwork.SendRate;
            this.UpdateIntervalOnSerialize = 1000 / PhotonNetwork.SerializationRate;

            PhotonNetwork.AddCallbackTarget(this);
            this.StartFallbackSendAckThread();  // this is not done in the base class
        }
Beispiel #7
0
 protected override void Awake()
 {
     base.Awake();
     if (this.SpeakerFactory == null)
     {
         this.SpeakerFactory = this.SimpleSpeakerFactory;
     }
     if (this.enableSupportLogger)
     {
         this.supportLoggerComponent                 = this.gameObject.AddComponent <SupportLogger>();
         this.supportLoggerComponent.Client          = this.Client;
         this.supportLoggerComponent.LogTrafficStats = true;
     }
     #if UNITY_EDITOR || !UNITY_ANDROID && !UNITY_IOS
     if (this.runInBackground)
     {
         Application.runInBackground = this.runInBackground;
     }
     #endif
     if (!this.primaryRecorderInitialized)
     {
         this.TryInitializePrimaryRecorder();
     }
 }
Beispiel #8
0
    public int SP_ExcecutePro(String sp_name, String[] paramse, Object[] values)
    {
        int result = 0;

            mCmd.CommandText = sp_name.Trim();
            mCmd.Parameters.Clear();
            if (paramse != null)
            {
                int len = paramse.Length - 1;
                int i;
                for (i = 0; i <= len; i++)
                {
                    mCmd.Parameters.Add(new SqlParameter(paramse[i], values[i]));
                    str_params_values += paramse[i] + ": " + values[i]+"; ";
                }
            }

            result = Execute();

            mCmd.Dispose();
            mCmd = null;

            if (sp_name.IndexOf("Delete") != -1)
                Action = "Delete";
            else if (sp_name.IndexOf("Insert") != -1)
                Action = "Insert";
            else if (sp_name.IndexOf("Update") != -1)
                Action = "Update";
            else
                Action = "~ Select";

            SupportLogger log = new SupportLogger();
            log.SP_ExcecutePro("USP_Sys_Log", new string[] { "@flag","@loginPeopleID", "@Module", "@Action", "@IPclient",
            "@Description" }, new object[] { 1, HttpContext.Current.Session["loginPeopleID"], sp_name, Action, HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], result.ToString()+ ": "+ str_params_values });
            return result;
    }
    protected void btnLuu_Click(object sender, EventArgs e)
    {
        lblThongBao.Text = "";
        lblThongBao.ForeColor = System.Drawing.Color.Red;

        int result = -1;
        try
        {
            DeleteSpaceCharacter();

            string strValid;
            strValid = isValidFillForm();

            if (strValid != "OK")
            {
                lblThongBao.Text = strValid;
                return;
            }

            ibtnReCalculate_Click(null, null);
            string FirstPart, LastPart;
            FirstPart = ddlLoaiThanhVien.SelectedValue;
            LastPart = rbtKiemNhiem.SelectedValue;

            if (LastPart == "GH" || LastPart == "GU")
                MaTV = LastPart + FirstPart;
            else
                MaTV = FirstPart + LastPart;
            daPeople.fPeopleCode = MaTV;
            daPeople.fUserName = txtTenDangNhap.Text;
            daPeople.fLastName = txtLastName.Text;
            daPeople.fFirstName = txtFirstName.Text;

            //cm upload image
            //string pre_fileName = Session["PeopleImage"]+"";
            if (FileUploadAvatar.HasFile)
            {
                string fileName = FileUploadAvatar.FileName;

                //if (!string.IsNullOrEmpty(pre_fileName))
                //{
                //Trường hợp đã có file trước đây nhưng Upload tiếp -> xóa đi file trước đây
                //common.deleteFile(pre_fileName, PhysicalImgFolder);
                fileName = common.renameFileIfExists(fileName, PhysicalImgFolder);
                //}
                //cm  Get the name of the file to upload.

                FileUploadAvatar.SaveAs(PhysicalImgFolder + fileName);

                //Lấy tên file mới
                Session["PeopleImage"] = fileName;

                daPeople.fPhoto = fileName;
                common.ResizeImage(PhysicalImgFolder, fileName, 100, FileUploadAvatar.PostedFile.InputStream);
            }
            //else //Chưa browser file
            //{
            //    if (!string.IsNullOrEmpty(pre_fileName))
            //    {
            //        daPeople.fPhoto = pre_fileName;
            //    }
            //    //else
            //    //{
            //    //    lblThongBao.Text = "Bạn chưa chọn hình ảnh";
            //    //    return;
            //    //}
            //}

            if (!txtDateNgaySinh.Text.Trim().Equals(string.Empty))
            {
                daPeople.fBirthday = txtDateNgaySinh.Text;
            }

            if (RadioButtonList1.SelectedValue == "1")
            {
                daPeople.fGender = true;
            }
            else
            {
                daPeople.fGender = false;
            }
            daPeople.fCellPhone = txtMobile.Text;
            daPeople.fHomePhone = txtHomePhone.Text;

            //Thường trú
            daPeople.fResident = txtThuongTru.Text;

            string TT_ToaDo = txtTT_ToaDo.Text;
            TT_ToaDo = TT_ToaDo.Replace(",", "_");
            TT_ToaDo = TT_ToaDo.Replace(".", ",");
            TT_ToaDo = TT_ToaDo.Replace("_", ".");

            if (!TT_ToaDo.Equals(""))
            {
                daPeople.fLatitude = TT_ToaDo.Substring(0, TT_ToaDo.IndexOf("."));
                daPeople.fLongitude = TT_ToaDo.Substring(TT_ToaDo.IndexOf(".") + 1);

            }

            //Tạm trú
            daPeople.fStayProvisionally = txtTamTru.Text;
            string Tam_ToaDo = txtTam_ToaDo.Text;
            Tam_ToaDo = Tam_ToaDo.Replace(",", "_");
            Tam_ToaDo = Tam_ToaDo.Replace(".", ",");
            Tam_ToaDo = Tam_ToaDo.Replace("_", ".");

            if (!Tam_ToaDo.Equals(""))
            {
                daPeople.fLongitudeStayProvisionally = Tam_ToaDo.Substring(0, Tam_ToaDo.IndexOf("."));
                daPeople.fLatitudeStayProvisionally = Tam_ToaDo.Substring(Tam_ToaDo.IndexOf(".") + 1);
            }

            daPeople.fEmail = txtEmail.Text;
            daPeople.fYahoo = txtYahoo.Text;
            daPeople.fSkyper = txtSkyper.Text;
            daPeople.fSocialWebiste = txtFaceweb.Text;
            daPeople.fCareer = txtNgheNghiep.Text;
            daPeople.fDescription = txtLoiGioiThieu.Text;

            //Mật khẩu
            string PassEncode;
            PassEncode = Cipher.EncryptText(txtMatKhau.Text, WebConfigurationManager.AppSettings["HomeFolder"]);
            daPeople.fPassword = PassEncode;

            if (loginPeopleCode != "")
            {
                daPeople.fActive = 1;
            }

            daPeople.fisDeleted = false;
            daPeople.fOperatorID = Session["loginPeopleID"];

            //Thực hiện Insert vào Thành viên
            resultInsertPeople = daPeople.USP_People_Insert();

            if (resultInsertPeople <= 0)     //Thực hiện insert Member k thành công
            {
                lblThongBao.Text = "Không thành công";
                lblThongBao.ForeColor = System.Drawing.Color.Red;
            }
            else //insert Member thành công
            {
                ///HỌC VIÊN
                //Nếu là Học viên thì có thông tin riêng.
                if (MaTV == "HV")
                {
                    StudentID = resultInsertPeople;
                    Introduction = txtLoiGioiThieu.Text;
                    FavouriteSong = txtBaiHatUuThich.Text;
                    f_UpdateDataToStudent(StudentID);

                    //Thông tin nhập học của học viên
                    if (ddlTrungTam.SelectedIndex > 0 && ddlLop.SelectedIndex > 0 && ddlTrinhDo.SelectedIndex > 0)
                    {
                        BranchID = ddlTrungTam.SelectedValue;
                        ClassID = ddlLop.SelectedValue;
                        DegreeID = ddlTrinhDo.SelectedValue;

                        if(!txtNgayNhapHoc.Text.Trim().Equals(""))
                        EnterClassDate = Convert.ToDateTime(txtNgayNhapHoc.Text).ToString("MM/dd/yyyy");

                        tv1 = new ThuVien();
                        resultInsertEnterClass = tv1.SP_ExcecutePro("USP_EnterClass_Insert", new string[] { "@flag", "@StudentID", "@BranchID", "@ClassID", "@Dic_SchoolFeeID", "@OperatorID", "@EnterClassDate" },
                            new object[] { 3, StudentID, BranchID, ClassID, DegreeID, Session["loginPeopleID"], EnterClassDate });
                        if (resultInsertEnterClass < 0)
                        {
                            lblThongBao.Text = "Thêm Thông tin Nhập học không thành công";
                            return;
                        }
                    }
                }

                if (loginPeopleCode == "")         //Visitor đăng ký
                {
                    //Tạo Mã active
                    string ActiveCode = "";
                    ActiveCode = Cipher.EncryptText(DateTime.Now.ToString(), "SaltKeyCC");

                    //insert vào bảng tạm
                    TempPeople daTempPeople = new TempPeople();

                    int rsTempPeople = -1;
                    rsTempPeople  = daTempPeople.USP_TempPeople_Insert(resultInsertPeople, ActiveCode);

                    if (rsTempPeople <= 0)
                    {
                        lblThongBao.Text = "Kiểm tra lại dữ liệu nhập";
                        lblThongBao.ForeColor = System.Drawing.Color.Red;

                        //Email báo kỹ thuật
                        return;
                    }
                    else //Insert vô bảng tạm thành công
                    {

                        //Gửi email mã kích hoạt
                        string host = HttpContext.Current.Request.Url.AbsoluteUri;
                        host = host.Substring(0, host.IndexOf("?"));

                        int iTB = sendEmail.SendMailForTechnical(txtEmail.Text, "Kích hoạt thành viên SeaGuitar", "Vui lòng mở link này để kích hoạt tài khoản <a href='" + host + "?s=active&ac=" + ActiveCode + "' target='_blank'>" + host + "?s=active&ac=" + ActiveCode + "</a>", true);
                        if (iTB <= 0)
                        {
                            //Nếu có lỗi gửi email thì xem như đéo cần email
                            int result2 = daPeople.USP_People_Update_Status(resultInsertPeople, true);
                            if (result2 < 0)
                            {
                                lblThongBao.Text = "Lỗi khi xử lý";
                                return;
                            }
                            else
                            {
                                lblThongBao.Text = "Chúc mừng bạn đã là thành viên chính thức! Gửi admin mã kết quả '01' nhé.";
                            }
                        }
                        else
                        {
                            lblThongBao.Text = "Redirect...";
                            lblThongBao.ForeColor = System.Drawing.Color.Green;
                            Session["AscxAnnouncement_NoiDung"] = "Chúc mừng thành viên mới";
                            Session["AscxAnnouncemento_NoiDung"] = "Vui lòng kiểm tra email để kích hoạt tài khoản";
                            Response.Redirect("/?s=tb",false);
                        }
                    }
                }
                else if (loginPeopleCode != "")         //Là Giám hiệu, giáo vụ login
                {
                    //Giám hiệu có thể sẽ có phần đóng học phí
                    if (ddlLoaiThanhVien.SelectedValue == "HV")
                        if (f_AddSchoolFee(resultInsertPeople.ToString()) <= 0)
                            lblThongBao.Text = "Học phí chưa có. ";
                    ///setEmpty();
                    lblThongBao2.ForeColor = System.Drawing.Color.Yellow;
                    lblThongBao2.Text = "Đã đăng ký thành công, bạn có thể tiếp tục nhập Thành viên, click here! ";
                    imgbtn_ThemThanhVien.Visible = true;
                }

                Session["IsCoLichDiHocRieng"] = null;

                Session["listSoBuoiThamGiaDuoc"] = null;
            }

        }
        catch (Exception ex)
        {
            //Gửi email báo lỗi
            lblThongBao.Text = "Có lỗi trong quá trình thực hiện. Vui lòng kiểm tra lại dữ liệu nhập";
            sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi", ex.ToString(), true);
        }
        finally
        {
            str.Append("PeopleID:" + resultInsertPeople + "; ");
            str.Append("fPeopleCode:" + MaTV + "; ");
            str.Append("fUserName:"******"; ");
            str.Append("fLastName:" + txtLastName.Text + "; ");
            str.Append("fFirstName:" + txtFirstName.Text + "; ");
            str.Append("fBirthday:" + txtDateNgaySinh.Text + "; ");
            str.Append("fStayProvisionally:" + txtTamTru.Text + "; ");
            str.Append("fEmail:" + txtEmail.Text + "; ");
            str.Append("fYahoo:" + txtYahoo.Text + "; ");
            str.Append("fSkyper:" + txtSkyper.Text + "; ");
            str.Append("fSocialWebiste:" + txtFaceweb.Text + "; ");
            str.Append("fCareer:" + txtNgheNghiep.Text + "; ");
            str.Append("fDescription:" + txtLoiGioiThieu.Text + "; ");
            str.Append("fisDeleted:" + false + "; ");
            str.Append("fOperatorID:" + Session["loginPeopleID"] + "; ");
            str.Append("StudentID:" + resultInsertPeople + "; ");
            str.Append("Introduction:" + txtLoiGioiThieu.Text + "; ");
            str.Append("FavouriteSong:" + txtBaiHatUuThich.Text + "; ");
            str.Append("ddlTrungTam: " + ddlTrungTam.Text + "; ddlLop: " + ddlLop.Text + "; ddlTrinhDo: " + ddlTrinhDo.Text);
            str.Append("Ngày nhập học:" + txtNgayNhapHoc.Text + "; Trạng thái: " + ddlTrangThai.Text);

            SupportLogger log = new SupportLogger();
            log.SP_ExcecutePro("USP_Sys_Log", new string[] { "@flag","@loginPeopleID", "@Module", "@Action", "@IPclient",
            "@Description" }, new object[] { 1, HttpContext.Current.Session["loginPeopleID"], "USP_People_Insert", "Insert", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], str.ToString() });

        }
    }