Example #1
0
        protected void cmdRegister_Click(object sender, EventArgs e)
        {
            try
            {
                //if (!this.Validata()) return;

                lstError = new List<Errorobject>();
                MemberInfo member = this.Take();
                if (member == null)
                {
                    lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Takeinfo_error, "", null);
                    CCommon.Form_ShowError(lstError, lblError);
                    return;
                }

                CMember DAL = new CMember();
                MemberInfo existmember = DAL.Getinfo(txtUsername.Text.Trim());
                if (existmember != null && existmember.Autosave == 0)
                {
                    lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Exist_username, "", txtUsername);
                    CCommon.Form_ShowError(lstError, lblError);
                    goto gotoExit;
                }
                else if (existmember != null && existmember.Autosave == 1)
                {
                    member.Id = existmember.Id;
                    member.Autosave = 0;
                }

                if (DAL.Save(member))
                {
                    member.iProfile.Id = member.Id;
                    new CMeProfile(CCommon.LANG).Save(member.iProfile);

                    pnlForm.Visible = false;
                    pnlNotice.Visible = true;

                    member.Password = txtPassword.Text;
                    CCommon.Session_Set(Sessionparam.WEBUSERREGISTER, member);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "register", "Register();", true);
                }
                else
                {
                    pnlForm.Visible = false;
                    lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Createaccount_error, "", null);
                    CCommon.Form_ShowError(lstError, lblError);
                }
                return;

            gotoExit:
                {
                    CCommon.LoadCaptcha(imgCaptcha);
                    txtCaptcha.Text = "";
                }
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
Example #2
0
 protected void cmdGetpassword_Click(object sender, EventArgs e)
 {
     try
     {
         CMember DAL = new CMember(CCommon.LANG);
         MemberInfo member = DAL.Getinfo(gp_txtUsername.Text.Trim());
         if (member == null)
         {
             gp_lblError.Text = CCommon.Get_Definephrase(Definephrase.Invalid_username_notexist);
             pnlGetlogin.Attributes.Add("style", "display:none");
             pnlGetpassword.Attributes.Add("style", "display:block");
         }
         else
         {
             if (member.Email != gp_txtEmail.Text.Trim())
             {
                 gp_lblError.Text = CCommon.Get_Definephrase(Definephrase.Invalid_username_email);
                 pnlGetlogin.Attributes.Add("style", "display:none");
                 pnlGetpassword.Attributes.Add("style", "display:block");
             }
             else
             {
                 string temporarycode = DateTime.Now.Ticks.ToString();
                 if (DAL.Updatestr(member.Id.ToString(), "temporarycode", temporarycode))
                 {
                     member.Temporarycode = temporarycode;
                     CCommon.Session_Set(Sessionparam.WEBUSERGETPASSWORD, member);
                     gp_lblError.Text = CCommon.Get_Definephrase(Definephrase.Getpassword_verify);
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "getpassword", "Getpassword();", true);
                 }
                 else
                 {
                     gp_lblError.Text = CCommon.Get_Definephrase(Definephrase.Getpassword_error);
                 }
                 pnlGetlogin.Attributes.Add("style", "display:none");
                 pnlGetpassword.Attributes.Add("style", "display:block");
                 formGetpassword.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         CCommon.CatchEx(ex);
     }
 }
Example #3
0
        public List<MeCreditcardHistoryInfo> Wcmm_Search(int memberid, string keywords, ListOptions options, out int numResults)
        {
            try
            {
                List<MeCreditcardHistoryInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += memberid == 0 ? "" : " AND A.memberid=" + memberid;
                    string Searchquery = CGeneral.Get_Searchquery(keywords);
                    SQL += string.IsNullOrEmpty(Searchquery) ? "" : " AND (" + Searchquery + ")";
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        CMember DALMem = new CMember(LANG);
                        while (dar.Read())
                        {
                            MeCreditcardHistoryInfo info = this.getDataReader(dar);
                            info.iMember = DALMem.Getinfo(info.Memberid);
                            if (arr == null)
                                arr = new List<MeCreditcardHistoryInfo>();
                            arr.Add(info);
                        }
                    }
                    numResults = this.Wcmm_Searchcount(iConn, memberid, keywords, options);
                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string problem = CFunctions.MBDecrypt(CCommon.Get_QueryString(Queryparam.Problem));
                string username = CFunctions.MBDecrypt(CCommon.Get_QueryString(Queryparam.User));
                string temporarycode = CFunctions.MBDecrypt(CCommon.Get_QueryString(Queryparam.Code));

                switch (problem)
                {
                    case "resetpassword":
                        CMember DALRS = new CMember(CCommon.LANG);
                        MemberInfo memberRS = DALRS.Getinfo(username);
                        if (memberRS == null)
                            lblError.Text = CCommon.Get_Definephrase(Definephrase.Invalid_username_notexist);
                        else
                        {
                            if (memberRS.Temporarycode == temporarycode && memberRS.Status == (int)CConstants.State.Status.Actived)
                            {
                                string passwordnew = CFunctions.Randomstr(6);
                                if (DALRS.Updatestr(memberRS.Id.ToString(), "password", CFunctions.MBEncrypt(passwordnew)))
                                {
                                    memberRS.Password = passwordnew;
                                    CCommon.Session_Set(Sessionparam.WEBUSERGETPASSWORD, memberRS);
                                    lblError.Text = CCommon.Get_Definephrase(Definephrase.Getpassword_done);

                                    DALRS.Updatestr(memberRS.Id.ToString(), "temporarycode", "");
                                    ScriptManager.RegisterStartupScript(this, this.GetType(), "resetpassword", "Resetpassword();", true);
                                }
                            }
                            else
                                lblError.Text = CCommon.Get_Definephrase(Definephrase.Confirm_error);
                        }
                        break;
                    case "regconfirm":
                        CMember DALRG = new CMember(CCommon.LANG);
                        MemberInfo memberRG = DALRG.Wcmm_Getinfo(username);
                        if (memberRG == null)
                            lblError.Text = CCommon.Get_Definephrase(Definephrase.Invalid_username_notexist);
                        else
                        {
                            if (memberRG.Temporarycode == temporarycode && memberRG.Status == (int)CConstants.State.Status.Waitactive)
                            {
                                if (DALRG.Updatenum(memberRG.Id.ToString(), Queryparam.Sqlcolumn.Status, (int)CConstants.State.Status.Actived))
                                {
                                    CCommon.Session_Set(Sessionparam.WEBUSERREGISTER, memberRG);
                                    lblError.Text = CCommon.Get_Definephrase(Definephrase.Confirm_register_done);

                                    DALRG.Updatestr(memberRG.Id.ToString(), "temporarycode", "");
                                    ScriptManager.RegisterStartupScript(this, this.GetType(), "regconfirm", "Regconfirm();", true);
                                }
                            }
                            else
                                lblError.Text = CCommon.Get_Definephrase(Definephrase.Confirm_error);
                        }
                        break;
                    case "restricted":
                        lblError.Text = CCommon.Get_Definephrase(Definephrase.Problem_restricted);
                        break;
                    case "notfound":
                        lblError.Text = CCommon.Get_Definephrase(Definephrase.Problem_notfound);
                        break;
                }
            }
        }