private void ChnagePass(string Newpass, string oldPass) { try { clsMySQLCoreApp ObjDAL = new clsMySQLCoreApp(); DataTable dataTable = ObjDAL.ExecuteSelectStatement("SELECT ID,CAST(AES_DECRYPT(Password, 'UserNameEmailID') AS CHAR(255)) Pass FROM ztech.tblUserDetails;"); if (dataTable != null && dataTable.Rows.Count > 0) { string strOldPass = dataTable.Rows[0]["Pass"].ToString(); int pID = Convert.ToInt32(dataTable.Rows[0]["ID"]); if (oldPass == strOldPass) { ObjDAL.ExecuteNonQuery("UPDATE ztech.tblUserDetails SET Password=AES_ENCRYPT('" + Newpass + "', 'UserNameEmailID'),UpdatedOn=NOW(),UpdatedBy=" + pID + " WHERE 1=1;"); NavigationURL.Value = "MyProfile.aspx"; ShowMessageBox("Password has been update successfully."); } else { NavigationURL.Value = "MyProfile.aspx"; ShowMessageBox("Old password doesn't match with existing old password.", false); } } } catch (Exception ex) { NavigationURL.Value = "MyProfile.aspx"; ShowMessageBox(ex.Message, false); } }
private void ChagngeEmail(string mail) { int pID = 0; if (Session["User"] != null) { pID = Convert.ToInt32(Session["User"]); clsMySQLCoreApp ObjDAL = new clsMySQLCoreApp(); ObjDAL.ExecuteNonQuery("UPDATE ztech.tblUserDetails SET EmailID='" + mail + "',UpdatedOn=NOW(),UpdatedBy=" + pID + " WHERE 1=1;"); ShowMessageBox("Email has been update successfully."); } else { ShowMessageBox("Unable to Update Email Address."); } NavigationURL.Value = "MyProfile.aspx"; }
private void DeleteImage(string imgID, string ImageName) { try { clsMySQLCoreApp ObjDAL = new clsMySQLCoreApp(); ObjDAL.ExecuteNonQuery("DELETE FROM ztech.tblImages WHERE ImageID=" + imgID); if (File.Exists(Server.MapPath("~/Uploads/" + ImageName))) { File.Delete(Server.MapPath("~/Uploads/" + ImageName)); } NavigationURL.Value = "UpdateProductImage.aspx"; ShowMessageBox("Image has been deleted successfully."); } catch (Exception ex) { NavigationURL.Value = "UpdateProductImage.aspx"; ShowMessageBox(ex.Message, false); } }