protected void cmdSave_Click(object sender, EventArgs e) { try { CMember DAL = new CMember(CCommon.LANG); if (pnlStatus.Visible && pnlStatus.Enabled) { DAL.Updatenum(IID, Queryparam.Sqlcolumn.Status, radStatus.SelectedValue); } MODALPOPUPEXTENDER1.Hide(); Control parent = this; do { parent = (Control)parent.Parent; } while (!(parent is BasePage)); BasePage control = (BasePage)parent; control.Bind_grdView(); } catch (Exception ex) { throw ex; } }
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); } }
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); } }
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 cmdUpdate_Click(object sender, EventArgs e) { try { lstError = new List<Errorobject>(); MemberInfo member = this.Takeinfo(); if (member == null) { lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Takeinfo_error, "", null); CCommon.Form_ShowError(lstError, lblError); return; } string passwordold = CFunctions.MBEncrypt(txtPassword.Text); if (passwordold != member.Password) { lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Invalid_password, "", txtPassword); CCommon.Form_ShowError(lstError, lblError); return; } CMember DAL = new CMember(CCommon.LANG); CConstants.State.Existed exist = DAL.Exist(member); if ((exist == CConstants.State.Existed.Phone && !CFunctions.IsNullOrEmpty(txtPhone.Text)) || (exist == CConstants.State.Existed.Mail && !CFunctions.IsNullOrEmpty(txtEmail.Text))) { switch (exist) { case CConstants.State.Existed.Phone: lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Exist_phone, "", txtPhone); break; case CConstants.State.Existed.Mail: lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Exist_email, "", txtEmail); break; } CCommon.Form_ShowError(lstError, lblError); return; } if (DAL.Save(member)) { new CMeProfile(CCommon.LANG).Save(member.iProfile); CCommon.Session_Set(Sessionparam.WEBUSERLOGIN, member); if (oldEmail != member.Email || oldPhone != member.iProfile.Phone) { member.Filepreview = member.Username + " thay đổi " + (oldEmail != member.Email ? "email, " : "") + (oldPhone != member.iProfile.Phone ? "phone, " : ""); member.Filepreview = member.Filepreview.Remove(member.Filepreview.LastIndexOf(", ")); CCommon.Session_Set(Sessionparam.WEBUSERREGISTER, member); } ScriptManager.RegisterStartupScript(this, this.GetType(), "Register", "Registerchanged();", true); pnlForm.Visible = false; lstError = CCommon.Form_GetError(lstError, Errortype.Notice, Definephrase.Account_Update_done, "", null); CCommon.Form_ShowError(lstError, lblError); return; } else { pnlForm.Visible = false; lstError = CCommon.Form_GetError(lstError, Errortype.Notice, Definephrase.Save_error, "", null); CCommon.Form_ShowError(lstError, lblError); } } catch (Exception ex) { CCommon.CatchEx(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; } } }