Esempio n. 1
0
        protected void cmdLogin_Click(object sender, EventArgs e)
        {
            try
            {
                //if (!this.Validata())
                //{
                //    LoadCaptcha(imgCaptcha);
                //    return;
                //}

                MemberInfo info = new MemberInfo();
                info.Username = txtUsername.Text.Trim();
                info.Password = CFunctions.MBEncrypt(txtPassword.Text);

                MemberInfo logger = (new CMember(CCommon.LANG)).Login(info);
                if (logger == null)
                {
                    lblError.Text = CCommon.Get_Definephrase(Definephrase.Login_invalid);
                }
                else
                {
                    CCommon.Session_Set(Sessionparam.WEBUSERLOGIN, logger);
                    this.Write_Cookies(logger);

                    if (CFunctions.IsNullOrEmpty(CCommon.PreviousUrl) && CFunctions.IsNullOrEmpty(CConstants.PAGE_WELCOMEDEF))
                    {
                        this.Show_Login(logger);
                        Response.Redirect(Request.Url.AbsolutePath + Request.Url.Query, false);
                    }
                    else
                    {
                        Response.Redirect((!CFunctions.IsNullOrEmpty(CCommon.PreviousUrl) ? CCommon.PreviousUrl : CConstants.PAGE_WELCOMEDEF), false);
                    }

                    return;
                }
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
Esempio n. 2
0
        public MemberInfo Login(MemberInfo info)
        {
            try
            {
                MemberInfo _info = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFO;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += " AND (A.username=@USERNAME) AND (A.password=@PASSWORD)";

                    iSqlParameter[] parms = new iSqlParameter[]{
                                                       new iSqlParameter(PARM_USERNAME, iSqlType.Field_tString),
                                                       new iSqlParameter(PARM_PASSWORD, iSqlType.Field_tString)
                    };
                    parms[0].Value = info.Username;
                    parms[1].Value = info.Password;
                    using (iSqlDataReader dar = HELPER.executeReader(iConn, iCommandType.Text, SQL, parms))
                    {
                        if (dar.Read())
                        {
                            _info = this.getDataReader(dar);
                        }
                    }
                    iConn.Close();
                }
                return _info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public CConstants.State.Existed Exist(MemberInfo info)
        {
            if (info == null) return CConstants.State.Existed.None;
            try
            {
                CConstants.State.Existed vlreturn = CConstants.State.Existed.None;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    if (HELPER.isExist(iConn, TABLENAME, "username", info.Username, info.Id))
                    {
                        vlreturn = CConstants.State.Existed.Name;
                        goto closeConn;
                    }

                closeConn: iConn.Close();
                }
                return vlreturn;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
 public bool ChangePwd(MemberInfo info)
 {
     try
     {
         if (info == null) return false;
         using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
         {
             iSqlParameter[] parms = new iSqlParameter[]{
                 new iSqlParameter(PARM_PASSWORD, iSqlType.Field_tString),
                 new iSqlParameter(PARM_ID, iSqlType.Field_tInterger)
             };
             parms[0].Value = info.Password;
             parms[1].Value = info.Id;
             HELPER.executeNonQuery(iConn, iCommandType.Text, SQL_CHANGE_PWD, parms);
             iConn.Close();
         }
         return true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
 private void setParameter(iSqlParameter[] parms, MemberInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Username);
         parms[++i].Value = CFunctions.SetDBString(info.Password);
         parms[++i].Value = CFunctions.SetDBString(info.Firstname);
         parms[++i].Value = CFunctions.SetDBString(info.Lastname);
         parms[++i].Value = CFunctions.SetDBString(info.Email);
         parms[++i].Value = CFunctions.SetDBString(info.PIN);
         parms[++i].Value = info.Status;
         parms[++i].Value = info.Markas;
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = info.Logincache;
         parms[++i].Value = info.Loginfirst;
         parms[++i].Value = info.Autosave;
         parms[++i].Value = CFunctions.SetDBString(info.Temporarycode);
         parms[++i].Value = info.Grouptype;
         parms[++i].Value = CFunctions.SetDBString(info.Filepreview);
         parms[++i].Value = info.Ranking;
         parms[++i].Value = info.Vote;
         parms[++i].Value = info.Ratingweight;
         parms[++i].Value = CFunctions.install_keyword(info.Fullname) + " " + CFunctions.install_keyword(info.Username);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 6
0
 private bool Saveitem(iSqlTransaction trans, MemberInfo info)
 {
     try
     {
         if (trans == null || info == null) return false;
         string SQL = string.Empty;
         if (info.Id == 0)
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else if (HELPER.isExist(trans, TABLENAME, info.Id))
         {
             SQL = SQL_UPDATE;
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         return true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
        private MemberInfo Take()
        {
            try
            {
                int iid = 0;
                int.TryParse(txtId.Value, out iid);
                MemberInfo info = (new CMember(CCommon.LANG)).Wcmm_Getinfo(iid);
                if (info == null)
                    info = new MemberInfo();
                oldId = info.Id;
                oldPassword = info.Password;
                info.Id = iid;
                info.Username = txtUsername.Text.Trim();
                info.Password = CFunctions.IsNullOrEmpty(txtPassword.Text) ? info.Password : CFunctions.MBEncrypt(txtPassword.Text);
                info.Firstname = txtFirstname.Text.Trim();
                info.Lastname = txtLastname.Text.Trim();
                info.Email = txtEmail.Text.Trim();
                info.Grouptype = ddlGrouptype.SelectedIndex;
                //info.Filepreview = Filepreview.Get();
                info.Status = Displaysetting.Get_Status();
                if (info.Id == 0)
                    info.Timecreate = DateTime.Now;
                info.Timeupdate = DateTime.Now;

                if (info.iProfile == null)
                    info.iProfile = new MeProfileInfo();
                info.iProfile.Phone = txtPhone.Text.Trim();
                info.iProfile.Address = txtAddress.Text.Trim();
                info.iProfile.Districtname = txtDistrict.Text.Trim();
                info.iProfile.Cityname = txtCity.Text.Trim();
                info.iProfile.Zipcode = txtZipcode.Text.Trim();
                //info.iProfile.Nationalid = int.Parse(ddlNational.SelectedValue);
                //info.iProfile.Cityid = int.Parse(ddlCity.SelectedValue);
                info.iProfile.Districtid = int.Parse(ddlDistrict.SelectedValue);
                info.iProfile.Districtname = ddlDistrict.SelectedIndex == 0 ? "" : ddlDistrict.SelectedItem.Text;
                info.iProfile.Birthday = new DateTime(int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), int.Parse(ddlDay.SelectedValue));
                info.iProfile.About = txtAbout.Text.Trim();
                info.iProfile.Blog = radBlogsh.SelectedValue + (txtBlog.Text.Trim() == "http://" ? "" : txtBlog.Text.Trim());
                info.iProfile.Homepage = radHomepagesh.SelectedValue + (txtHomepage.Text.Trim() == "http://" ? "" : txtHomepage.Text.Trim());
                info.iProfile.Facebook = radFacebooksh.SelectedValue + (txtFacebook.Text.Trim() == "http://www.facebook.com/" ? "" : txtFacebook.Text.Trim());
                info.iProfile.Twitter = radTwittersh.SelectedValue + (txtTwitter.Text.Trim() == "http://www.twitter.com/" ? "" : txtTwitter.Text.Trim());
                info.iProfile.Youtube = radYoutubesh.SelectedValue + (txtYoutube.Text.Trim() == "http://www.youtube.com/" ? "" : txtYoutube.Text.Trim());
                info.iProfile.Flickr = radFlickrsh.SelectedValue + (txtFlickr.Text.Trim() == "http://www.flickr.com/" ? "" : txtFlickr.Text.Trim());
                info.iProfile.Skype = radSkypesh.SelectedValue + txtSkype.Text.Trim();
                info.iProfile.Yahoo = radYahoosh.SelectedValue + txtYahoo.Text.Trim();

                return info;
            }
            catch
            {
                return null;
            }
        }
        private bool Registerchanged_MailToUser(MemberInfo member)
        {
            try
            {
                string content = this.Gettemplate("MailToUser.Registerchanged");
                if (content == null) return false;

                string subject = "Thành viên thay đổi thông tin " + member.Username;
                content = content.Replace("$VAR_NAME$", member.Fullname);
                content = content.Replace("$VAR_USERNAME$", member.Username);
                content = content.Replace("$VAR_PASSWORD$", CFunctions.MBDecrypt(member.Password));
                content = content.Replace("$VAR_PIN$", CFunctions.MBDecrypt(member.PIN));
                content = content.Replace("$VAR_EMAIL$", member.Email);
                content = content.Replace("$VAR_ADDRESS$", member.iProfile.Address);
                content = content.Replace("$VAR_PHONE$", member.iProfile.Phone);
                content = content.Replace("$VAR_YAHOO$", member.iProfile.Yahootext);
                content = content.Replace("$VAR_SKYPE$", member.iProfile.Skypetext);
                content = content.Replace("$VAR_WEBSITE$", CConstants.WEBSITE);
                content = content.Replace("$VAR_TEMPORARYCODE$", member.Temporarycode);
                this.SendMailToUser(member.Email, subject, content);
                return true;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 9
0
 private void Write_Cookies(MemberInfo logger)
 {
     if (chkRememberlogin.Checked)
     {
         Response.Cookies[CConstants.WEBSITE][":web:username"] = Server.HtmlDecode(logger.Username);
         Response.Cookies[CConstants.WEBSITE][":web:password"] = Server.HtmlDecode(logger.Password);
         Response.Cookies[CConstants.WEBSITE][":web:remember"] = "1";
         Response.Cookies[CConstants.WEBSITE].Expires.AddDays(7);
     }
     else
     {
         Response.Cookies.Remove(CConstants.WEBSITE);
     }
 }
Esempio n. 10
0
        private MemberInfo Read_Cookies()
        {
            if (Request.Cookies[CConstants.WEBSITE] == null) return null;

            MemberInfo logger = new MemberInfo();
            logger.Username = Server.HtmlEncode(Request.Cookies[CConstants.WEBSITE][":web:username"]);
            logger.Password = Server.HtmlEncode(Request.Cookies[CConstants.WEBSITE][":web:password"]);
            logger.Logincache = Request.Cookies[CConstants.WEBSITE][":web:remember"] == null ? 0 : int.Parse(Server.HtmlEncode(Request.Cookies[CConstants.WEBSITE][":web:remember"]));
            return logger;
        }
Esempio n. 11
0
 private void Show_Login(MemberInfo info)
 {
     this.Visible = info == null;
 }
Esempio n. 12
0
        private MemberInfo Take()
        {
            try
            {
                MemberInfo member = new MemberInfo();
                member.Username = txtUsername.Text.Trim().ToLower();
                member.Password = CFunctions.MBEncrypt(txtPassword.Text);
                member.Email = member.Username;
                member.PIN = CFunctions.MBEncrypt(CFunctions.Randomnum(6));
                member.Status = CConstants.REGISTERCONFIRM;
                member.Timeupdate = DateTime.Now;
                string Fullname = txtName.Text.Trim();
                if (!CFunctions.IsNullOrEmpty(Fullname))
                {
                    int index = Fullname.IndexOf(" ");
                    if (index != -1)
                    {
                        member.Firstname = Fullname.Substring(0, index).Trim();
                        member.Lastname = Fullname.Substring(index).Trim();
                    }
                    else
                    {
                        member.Firstname = Fullname;
                    }
                }

                if (member.iProfile == null)
                    member.iProfile = new MeProfileInfo();
                member.iProfile.Phone = txtPhone.Text.Trim();
                member.iProfile.Address = txtAddress.Text.Trim();
                if (ddlNational.Visible && ddlNational.Items.Count > 0 && ddlNational.SelectedIndex != 0)
                {
                    member.iProfile.Nationalid = int.Parse(ddlNational.SelectedValue);
                    member.iProfile.Nationalname = ddlNational.SelectedItem.Text;
                }
                if (ddlCity.Visible && ddlCity.Items.Count > 0 && ddlCity.SelectedIndex != 0)
                {
                    member.iProfile.Cityid = int.Parse(ddlCity.SelectedValue);
                    member.iProfile.Cityname = ddlCity.SelectedItem.Text;
                }

                return member;
            }
            catch
            {
                return null;
            }
        }
Esempio n. 13
0
        private bool Register_MailToUser(MemberInfo member)
        {
            try
            {
                string content = this.Gettemplate("MailToUser.Register");
                if (content == null) return false;

                string subject = "Chào mừng đến với " + CConstants.WEBSITE;
                content = content.Replace("$VAR_NAME$", member.Fullname);
                content = content.Replace("$VAR_USERNAME$", member.Username);
                content = content.Replace("$VAR_PASSWORD$", member.Password);
                content = content.Replace("$VAR_TEMPORARYCODE$", member.Temporarycode);
                content = content.Replace("$VAR_WEBSITE$", CConstants.WEBSITE);
                this.SendMailToUser(member.Email, subject, content);
                return true;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 14
0
        private bool Register_MailToServer(MemberInfo member)
        {
            try
            {
                string content = this.Gettemplate("MailToServer.Register");
                if (content == null) return false;

                string subject = "New member " + CConstants.WEBSITE;
                content = content.Replace("$VAR_NAME$", member.Fullname);
                content = content.Replace("$VAR_USERNAME$", member.Username);
                content = content.Replace("$VAR_PASSWORD$", member.Password);
                content = content.Replace("$VAR_EMAIL$", member.Email);
                content = content.Replace("$VAR_PHONE$", member.iProfile.Phone);
                content = content.Replace("$VAR_YAHOO$", member.iProfile.Yahootext);
                content = content.Replace("$VAR_SKYPE$", member.iProfile.Skypetext);
                content = content.Replace("$VAR_WEBSITE$", CConstants.WEBSITE);
                this.SendMailToServer(member.Email, subject, content);
                return true;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 15
0
        public bool Save(MemberInfo info)
        {
            try
            {
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    using (iSqlTransaction trans = iConn.BeginTransaction())
                    {
                        try
                        {
                            if (this.Saveitem(trans, info))
                            {
                                if (info.iProfile != null)
                                {
                                    info.iProfile.Id = info.Id;
                                    new CMeProfile(LANG).Save(info.iProfile);
                                }
                            }

                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                    iConn.Close();
                }
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 16
0
        private bool Load_Info(int iid)
        {
            try
            {
                MemberInfo info = null;
                if (iid != 0)
                {
                    info = (new CMember(CCommon.LANG)).Wcmm_Getinfo(iid);
                    if (info != null)
                    {
                        lstError = new List<Errorobject>();
                        lstError = Form_GetError(lstError, Errortype.Notice, Definephrase.Save_notice, "[" + info.Id + "] " + info.Fullname, null);
                        Master.Form_ShowError(lstError);
                    }
                }
                if (info == null)
                    info = new MemberInfo();
                chkSaveoption_golist.Checked = info.Id != 0;

                txtId.Value = info.Id.ToString();
                txtUsername.Text = info.Username;
                txtPassword.Text = CFunctions.MBDecrypt(info.Password);
                txtFirstname.Text = info.Firstname;
                txtLastname.Text = info.Lastname;
                txtEmail.Text = info.Email;
                ddlGrouptype.SelectedIndex = info.Grouptype;
                //Filepreview.Set(info.Filepreview);
                Displaysetting.Set("", info.Status, 0);

                if (info.iProfile == null)
                    info.iProfile = new MeProfileInfo();
                txtPhone.Text = info.iProfile.Phone;
                txtAddress.Text = info.iProfile.Address;
                txtDistrict.Text = info.iProfile.Districtname;
                txtCity.Text = info.iProfile.Cityname;
                txtZipcode.Text = info.iProfile.Zipcode;
                //ddlNational.SelectedValue = info.iProfile.Nationalid.ToString();
                //ddlCity.SelectedValue = info.iProfile.Cityid.ToString();
                ddlDistrict.SelectedValue = info.iProfile.Districtid.ToString();
                ddlYear.SelectedValue = info.iProfile.Birthday.Year.ToString();
                ddlMonth.SelectedValue = info.iProfile.Birthday.Month.ToString();
                ddlDay.SelectedValue = info.iProfile.Birthday.Day.ToString();
                txtAbout.Text = info.iProfile.About;
                txtBlog.Text = CFunctions.IsNullOrEmpty(info.iProfile.Blog) ? "http://" : info.iProfile.Blogtext;
                txtHomepage.Text = CFunctions.IsNullOrEmpty(info.iProfile.Homepage) ? "http://" : info.iProfile.Homepagetext;
                txtFacebook.Text = CFunctions.IsNullOrEmpty(info.iProfile.Facebook) ? "http://www.facebook.com/" : info.iProfile.Facebooktext;
                txtTwitter.Text = CFunctions.IsNullOrEmpty(info.iProfile.Twitter) ? "http://www.twitter.com/" : info.iProfile.Twittertext;
                txtYoutube.Text = CFunctions.IsNullOrEmpty(info.iProfile.Youtube) ? "http://www.youtube.com/" : info.iProfile.Youtubetext;
                txtFlickr.Text = CFunctions.IsNullOrEmpty(info.iProfile.Flickr) ? "http://www.flickr.com/" : info.iProfile.Flickrtext;
                txtSkype.Text = CFunctions.IsNullOrEmpty(info.iProfile.Skype) ? "" : info.iProfile.Skypetext;
                txtYahoo.Text = CFunctions.IsNullOrEmpty(info.iProfile.Yahoo) ? "" : info.iProfile.Yahootext;
                radBlogsh.SelectedValue = info.iProfile.Blogsh;
                radHomepagesh.SelectedValue = info.iProfile.Homepagesh;
                radFacebooksh.SelectedValue = info.iProfile.Facebooksh;
                radTwittersh.SelectedValue = info.iProfile.Twittersh;
                radYoutubesh.SelectedValue = info.iProfile.Youtubesh;
                radFlickrsh.SelectedValue = info.iProfile.Flickrsh;
                radSkypesh.SelectedValue = info.iProfile.Skypesh;
                radYahoosh.SelectedValue = info.iProfile.Yahoosh;

                return true;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 17
0
        private MemberInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                MemberInfo info = new MemberInfo();
                info.Username = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Password = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Firstname = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Lastname = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Email = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.PIN = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Status = dar.IsDBNull(++i) ? (int)CConstants.State.Status.Waitactive : dar.GetInt32(i);
                info.Markas = dar.IsDBNull(++i) ? (int)CConstants.State.MarkAs.None : dar.GetInt32(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Logincache = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Loginfirst = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Autosave = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Temporarycode = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Grouptype = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Filepreview = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Ranking = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Vote = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Ratingweight = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);

                info.iProfile = new CMeProfile(LANG).Getinfo(info.Id);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 18
0
        private bool Passwordchanged_MailToUser(MemberInfo member)
        {
            try
            {
                string content = this.Gettemplate("MailToUser.Passwordchanged");
                if (content == null) return false;

                string subject = "VN-Ibet888: thay đổi mật khẩu " + member.Username;
                content = content.Replace("$VAR_NAME$", member.Fullname);
                content = content.Replace("$VAR_USERNAME$", member.Username);
                content = content.Replace("$VAR_PASSWORD$", CFunctions.MBDecrypt(member.Password));
                content = content.Replace("$VAR_PIN$", CFunctions.MBDecrypt(member.PIN));
                content = content.Replace("$VAR_WEBSITE$", CConstants.WEBSITE);
                content = content.Replace("$VAR_TEMPORARYCODE$", member.Temporarycode);
                this.SendMailToUser(member.Email, subject, content);
                return true;
            }
            catch
            {
                return false;
            }
        }