public void PostValid_Test() { MailController mailController = new MailController(mockSMPTPLib.Object, loggerFactory, smptOptions, cfOptions); MailModel mailModel = new MailModel() { FromAddress = "abc", ToAddress = new List <string>() { "abc" }, Bcc = new List <string>() { "abc" }, Cc = new List <string>() { "abc" }, Subject = "Test Subject" }; var actionResult = (mailController.Post(mailModel)) as OkObjectResult; Assert.NotNull(actionResult); Assert.NotNull(actionResult.Value); var apiResponse = actionResult.Value as APIResponse; Assert.Equal(HttpStatusCode.OK, apiResponse.StatusCode); }
protected void Send_Click(object sender, EventArgs e) { MailController mailController = new MailController(); if (mailController.Post(TextEmail.Text)) { _cookieEmail.Values.Clear(); _cookieMessage.Values.Clear(); Response.Redirect("Success.aspx"); } else { IsValidMail.BackColor = System.Drawing.Color.Red; if (String.IsNullOrWhiteSpace(TextEmail.Text)) { IsValidMail.Visible = true; IsValidMail.Text = "please input email"; } else { IsValidMail.Visible = true; IsValidMail.Text = "email isn't valid (Example: [email protected])"; } } }
public async void RendersDailyViewWithViewModel() { var items = new List <Item>() { new Item { } }.AsEnumerable(); var mockContentService = new Mock <IContentService>(); mockContentService.Setup(x => x.GetDailyItemsAsync(It.IsAny <DateTime>())).ReturnsAsync(items); var mockViewRenderer = new Mock <IViewRenderer>(); var mailConfig = new MailConfig { DailySubject = "" }; var mailController = new MailController(new FakeMailChimpManager().Object, Mock.Of <IMailService>(), mockContentService.Object, mockViewRenderer.Object, new FakeBankHolidayService(), Mock.Of <ILogger <MailController> >(), mailConfig, TestAppSettings.MailChimp.Default); //Act await mailController.PutDailyMailAsync(); //Assert // TODO: Assert on the actual view model mockViewRenderer.Verify(mock => mock.RenderViewAsync(mailController, "~/Views/Mail/Daily.cshtml", It.IsAny <DailyEmailViewModel>(), false), Times.Once()); }
public void PostInvalid_Test() { MailController mailController = new MailController(mockSMPTPLib.Object, loggerFactory, smptOptions, cfOptions); MailModel mailModel = new MailModel() { FromAddress = "abc", ToAddress = new List <string>() { "abc" }, Bcc = new List <string>() { "abc" }, Cc = new List <string>() { "abc" }, Subject = "Test Subject" }; mailController.ModelState.AddModelError("From", "Invalid from address email"); var actionResult = (mailController.Post(mailModel)) as BadRequestObjectResult; Assert.NotNull(actionResult); Assert.NotNull(actionResult.Value); var apiResponse = actionResult.Value as APIResponse; Assert.True(apiResponse.ModelState.Count > 0); }
public async void SendsDateAndBodyToMailService() { var items = new List <Item>() { new Item { Specialities = new List <Speciality>() } }.AsEnumerable(); var mockContentService = new Mock <IContentService>(); mockContentService .Setup(x => x.GetDailyItemsAsync(It.IsAny <DateTime>())) .ReturnsAsync(items); var body = "<p>body</p>"; var mockViewRenderer = new Mock <IViewRenderer>(); mockViewRenderer .Setup(x => x.RenderViewAsync(It.IsAny <MailController>(), It.IsAny <string>(), It.IsAny <DailyEmailViewModel>(), false)) .ReturnsAsync(body); var mockMailService = new Mock <IMailService>(); var mailController = new MailController(new FakeMailChimpManager().Object, mockMailService.Object, mockContentService.Object, mockViewRenderer.Object, Mock.Of <IBankHolidayService>(), Mock.Of <ILogger <MailController> >(), Mock.Of <MailConfig>(), TestAppSettings.MailChimp.Default); var sendDate = new DateTime(1856, 7, 10); //Act await mailController.PutDailyMailAsync(sendDate); //Assert mockMailService.Verify(mock => mock.CreateAndSendDailyAsync(sendDate, It.IsAny <string>(), body, It.IsAny <List <string> >(), It.IsAny <IEnumerable <Interest> >(), It.IsAny <string>()), Times.Once()); }
/// <summary> /// Tao moi nguoi su dung /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveNewUser_Click(object sender, EventArgs e) { if (Page.IsValid) { //xu ly cat bo khoang trang trong ten dang nhap va loc SQL Injection txtUsername2.Text = AccountUtilities.ProcessUsername(txtUsername2.Text); string sUsername = txtUsername2.Text; //kiem tra tinh hop le cua ten dang nhap if (AccountUtilities.IsValidUsername(txtUsername2.Text)) { UserAccount user = db.UserAccounts.SingleOrDefault <UserAccount>(u => u.AccountName == sUsername); //neu chua co nguoi dung nao su dung ten dang nhap nay thi co the dang ky duoc if (user == null) { SysUser sUser = new SysUser(); sUser.FirstSurName = txtHoLot2.Text; sUser.LastName = txtTen2.Text; sUser.Address = txtDiaChi2.Text; sUser.Cell = txtDT2.Text; sUser.Email = txtEmail2.Text; sUser.CreatedTime = DateTime.Now; sUser.CreatedBy = UserInfo.UserAccount.AccountName; user = new UserAccount(); user.CreatedTime = DateTime.Now; user.AccountName = sUsername; user.Password = Hash.GetHashMD5Value(txtPassword2.Text);//ma hoa mat khau dang md5 user.IsDisabled = false; user.SysGroupId = (int)KHCNCT.Globals.Enums.Role.UserRole.InternalUser; sUser.UserAccount = user; db.SysUsers.InsertOnSubmit(sUser); db.SubmitChanges(); if (ckbSendAlertCreateUserEmail.Checked) { MailController.SendAlertStoreAccountCreated2(txtEmail2.Text, txtUsername2.Text, txtPassword2.Text, "", txtHoLot2 + " " + txtTen2.Text); } Response.Redirect(Common.GenerateAdminUrl("user")); } else { //ten truy cap da ton tai Page.ClientScript.RegisterStartupScript(this.GetType(), "", "$('#username_status').html('" + Resources.AccountMessage.UsernameUnAvailable.Replace("'", "\\'") + "');" + "setfocusonerrortextbox('" + txtUsername2.ClientID + "');", true); } } else { //ten dang nhap khong hop le Page.ClientScript.RegisterStartupScript(this.GetType(), "", "$('#username_status').html('<span class=\"validator_error_message\">" + Resources.AccountMessage.InvalidUsername + "</span>');" + "setfocusonerrortextbox('" + txtUsername2.ClientID + "');", true); } } }
/// <summary> /// 点击事件进行发送邮件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSendMail_Click(object sender, RoutedEventArgs e) { if (Username.Text == "#author#@domain.com") { MessageBox.Show("请修改默认发件人"); } else { ConfigInfo configInfo = _configController.ConfigQuery("config/preferences", "../../../common/res/CIConfig.xml"); _projectInfo.WorkDirectory = Workspace.Text; _projectInfo = _svnController.GetLocalInfo(_projectInfo); _projectInfo.Nameproperty = projectName.Text; _projectInfo.Log = (configInfo.StandarOutput == "true") ? ((log + err).Replace("\n", "<br/>")) : (err.Replace("\n", "<br/>")); _projectInfo.Result = lastRe.Text; _projectInfo.Duration = duration; _projectInfo.Revision = revision; _projectInfo.MailTo = Mailto.Text; _projectInfo.MailHost = Host.Text; _projectInfo.UserName = Username.Text; _projectInfo.Password = Password.Text; MailController mailController = new MailController(); Dictionary <string, Dictionary <string, string> > allStatics = _projectController.GetStatData("config/Member", "../../../common/res/InfoStatics.xml"); MailInfo mailInfo = mailController.EditBody(_projectInfo, allStatics, "../../../common/SendMail.html"); sendRe.Text = mailController.SendMail(mailInfo); } }
public ActionResult PasswordReset(LoginModel model, string returnUrl) { //we come here but wouls be a lot cooler if if (WebSecurity.UserExists(model.UserName)) { var ptoken = string.Empty; try { ptoken = WebSecurity.GeneratePasswordResetToken(model.UserName, 190); } catch { ViewData["msg"] = "You created your account with a social media login. You don't have a password."; return(View(model)); } //var token = WebSecurity.GeneratePasswordResetToken(UserName); //var resetLink = "<a href='" + Url.Action("ResetPassword", "Account", new { un = model.UserName, rt = ptoken }, "http") + "'>Reset Password</a>"; //change to be as secure as you choose string tmpPass = Membership.GeneratePassword(10, 4); WebSecurity.ResetPassword(ptoken, tmpPass); HttpResponseMessage result = new MailController().SendPasswordReset(model.UserName, tmpPass); //add your own email logic here ViewData["msg"] = "A new password has been sent."; return(View(model)); //return @Html.Partial("_SetPasswordPartial") //generate password token //create url with above token //var emailid = (from i in db.UserProfiles // where i.UserName == UserName // select i.UserName).FirstOrDefault(); ////send mail //string subject = "Password Reset Token"; //string body = "<b>Please find the Password Reset Token</b><br/>" + resetLink; //edit it //try //{ // //SendEMail(emailid, subject, body); // TempData["Message"] = "Mail Sent."; //} //catch (Exception ex) //{ // TempData["Message"] = "Error occured while sending email." + ex.Message; //} ////only for testing //TempData["Message"] = resetLink; } else { ModelState.AddModelError("", "The user name wasn't found."); } return(View(model)); }
//[System.Web.Mvc.ValidateAntiForgeryToken] public HttpResponseMessage SendTeamPaymentConfirmMail(Int32 id) { HttpResponseMessage result = new MailController().SendTeamPaymentConfirmMail(id); var resp = new HttpResponseMessage(HttpStatusCode.OK); return(resp); }
public HttpResponseMessage SendSoccerTryoutInviteMail(Int32 id) { HttpResponseMessage result = new MailController().SendSoccerTryoutInviteMail(id); var resp = new HttpResponseMessage(HttpStatusCode.OK); return(resp); }
public void sendMailApproval(DataTable dtReceiver, string htmlstringtable, string loi_status, string executorname, int requestid, string ApproverRole) { try { StringBuilder sbResult = new StringBuilder(); string emailsubject = string.Empty; string fullname = dtReceiver.Rows[0]["Name"].ToString(); string email = dtReceiver.Rows[0]["Email"].ToString(); string paramapproveinemail = string.Concat("true;", requestid.ToString(), ";", ApproverRole, ";", dtReceiver.Rows[0]["USR_ID"].ToString()); string paramrejectinemail = string.Concat("false;", requestid.ToString(), ";", ApproverRole, ";", dtReceiver.Rows[0]["USR_ID"].ToString()); paramapproveinemail = EnDecController.EncryptLinkUrlApproval(paramapproveinemail); paramrejectinemail = EnDecController.EncryptLinkUrlApproval(paramrejectinemail); DataTable dtEmail = loi_get_email_data(loi_status, requestid); DataTable dtDocumentAvailibility = loi_supportingdoc_getall(requestid); string HtmlTableSupportingDocAvailibility = CreateHtmlTableSupportingDocAvailibility(dtDocumentAvailibility); if (dtEmail.Rows.Count > 0) { emailsubject = dtEmail.Select("config_key like '%subject%'")[0].ItemArray[1].ToString(); string emailbody = dtEmail.Select("config_key like '%body%'")[0].ItemArray[1].ToString(); emailbody = emailbody.Replace("[name]", fullname).Replace("[sourcename]", executorname); emailbody = emailbody.Replace("[tabledetail]", htmlstringtable); emailbody = emailbody.Replace("[param approve]", paramapproveinemail); emailbody = emailbody.Replace("[param reject]", paramrejectinemail); emailbody = emailbody.Replace("[document_avilibility]", HtmlTableSupportingDocAvailibility); sbResult.Append(emailbody); MailController.SendMail(email, emailsubject, sbResult.ToString(), GeneralConfig.MailConfigType()); } } catch (Exception ex) { EBOQ_Lib_New.DAL.DAL_AppLog.ErrLogInsert("LOIController:SendEmail", ex.Message, "NON-SP"); } }
public void MyTestInitialize() { msg = ""; _mng = new Manager(new Repository(new LocalSqlServer())); var jsonRequest = "{\"page\":1,\"pageSize\":5,\"filter\":{\"text\":\"\"},\"sort\":\",\",\"direction\":\",\",\"mode\":{\"type\":\"\",\"visibleCols\":[]}}"; var bytes = System.Text.Encoding.UTF8.GetBytes(jsonRequest.ToCharArray()); var stream = new MemoryStream(bytes); var mock = new Mock <IManager>(); var fakeHttpContext = new Mock <HttpContextBase>(); fakeHttpContext.Setup(m => m.Request.InputStream).Returns(stream); var controllerContext = new Mock <ControllerContext>(); controllerContext.Setup(t => t.HttpContext).Returns(fakeHttpContext.Object); mailsController = new MailController(_mng); mailsController.ControllerContext = controllerContext.Object; System.Web.HttpContext.Current = new HttpContext(new HttpRequest("", "http://localhost", ""), new HttpResponse(new StringWriter())); System.Web.HttpContext.Current.User = new GenericPrincipal( new GenericIdentity("*****@*****.**"), new string[0] ); //var userMock = new Mock<aspnet_Users>(); //userMock.Setup(u => u.aspnet_Roles).Returns(new HashSet<aspnet_Roles>()); }
public async void Run(IBackgroundTaskInstance taskInstance) { // Get the deferral object from the task instance, and take a reference to the taskInstance; _deferral = taskInstance.GetDeferral(); // Get notified when this task is being terminated by the OS taskInstance.Canceled += TaskInstance_Canceled; // Create a Goe Controller var geolocator = new GeoController(); // Make the request for the current position _geoCoordinate = await geolocator.GetGeoCoordinateAsync(); // Create a Velux Controller _veluxController = new VeluxController(GpioController.GetDefault()); // Create a Mail Controller _mailController = new MailController() { SubjectPrefix = "[HomeAutomation]" }; // Create a Settings Controller _settingsController = new SettingsController(); // Setup a simple timer for testing/demo purposes _timer = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick, TimeSpan.FromMinutes(10)); // IDEA: Use UWP to register a timed event //BackgroundTaskRegistration task = RegisterBackgroundTask(entryPoint, taskName, hourlyTrigger, userCondition); }
public MusteriDetay() { _mustController = new MusteriController(); _adrescontroller = new AdresController(); _telefonController = new TelefonController(); _mailController = new MailController(); }
/// <summary> /// 创建信件 /// </summary> /// <param name="mailData"></param> /// <param name="cSMailAccessories"></param> /// <returns></returns> public static async void CreateMail(MailData mailData, List <CSMailAccessory> cSMailAccessories = null) { GameObject obj = await UIComponent.CreateUIAsync(UIType.Mail); MailController mailController = obj.GetComponent <MailController>(); mailController.ShowMail(mailData, cSMailAccessories); }
public void GetPostOffice() { var controller = new MailController(new MailService()); var result = controller.GetPostOffice("*****@*****.**"); Assert.IsNotNull(result); }
static void TestMail() { var mailController = new MailController(); var result = Task.Run(async() => await mailController.SendMail("*****@*****.**", "Test", "Hello World")); result.Wait(); }
public void AddPostOffice() { var controller = new MailController(new MailService()); var result = controller.AddPostOffice("*****@*****.**"); Assert.IsNotNull(result); Assert.AreEqual(((JSend.WebApi.Results.JSendCreatedResult <int>)result).StatusCode.ToString(), "Created"); }
public void MailControllerMoq_get() { var mock = new Mock <IMailRepository <Mail> >(); mock.Setup(a => a.getAllMail()).Returns(new List <Mail>()); var test = new MailController(mock.Object); Assert.IsNotNull(test.Get()); }
public void MailControllerMoq_deleteMailByUser() { var mock = new Mock <IMailRepository <Mail> >(); mock.Setup(a => a.deleteMailByUser(1)).Returns(new Mail()); var test = new MailController(mock.Object); Assert.IsNotNull(test.Delete(1)); }
public static MailController GetMailControllerService(string dbConnectionString = null) { if (_mailController == null) { _mailController = new MailController(() => new LiteDbMailHeaderEntityStorage(dbConnectionString ?? _dbFilepath), () => new LiteDbMailContentEntityStorage(dbConnectionString ?? _dbFilepath)); } return(_mailController); }
public async Task SendMailException_ReturnsCorrectResponse() { logger = new LoggerManager(); var controller = new MailController(logger); Action act = () => controller.SendMail(new Recepients { }); Assert.Throws <NullReferenceException>(act); }
public void MailController_deleteMailByUser() { DbContextOptionsBuilder <ApplicationContext> options = new DbContextOptionsBuilder <ApplicationContext>(); options.UseSqlServer(dbUrl); ApplicationContext context = new ApplicationContext(options.Options); var test = new MailController(new MailRepository <Mail>(context)).Delete(21); Assert.IsNotNull(test); }
public ActionResult CheckoutPaymentPage(ContentModel model) { var currentCart = CurrentCart.Create(SnuffoSettings.STORE_NAME); var order = currentCart.GetOrder(); if (order.HasOrderProductDetails() && !order.ShippingMethodId.HasValue) { return(Redirect(string.Concat("/", CurrentUser.LanguageCode, "/cart/checkout-shipping"))); } var cpm = new CheckoutPaymentModel(model.Content); cpm.PaymentMethods = UvendiaContext.PaymentMethods.All().Where(p => p.Enabled).ToList(); cpm.SelectedPaymentMethodId = order.PaymentMethodId; cpm.iDealIssuerId = order.MetaData; try { var ideal = cpm.PaymentMethods.Single(x => x.Name.Equals("ideal", StringComparison.InvariantCultureIgnoreCase)); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Connector connector = new Connector(); connector.MerchantId = ideal["MerchantID"]; connector.SubId = ideal["SubID"]; connector.ExpirationPeriod = ideal["ExpirationPeriod"]; connector.MerchantReturnUrl = new Uri(string.Format(ideal["MerchantReturnURL"], CurrentUser.LanguageCode)); ING.iDealAdvanced.Data.Issuers issuers = connector.GetIssuerList(); foreach (var country in issuers.Countries) { foreach (var issuer in country.Issuers) { cpm.iDealIssuerList.Add(new SelectListItem() { Text = issuer.Name, Value = issuer.Id.ToString() }); } } } catch (ING.iDealAdvanced.Data.IDealException iex) { // request consumerMessage MailController.Instance(Request, model.Content, CurrentUser.LanguageCode).MailError(new HandleErrorInfo(iex, "CheckoutPaymentPage", "LoadIssueList")).SendAsync(); } catch (Exception ex) { MailController.Instance(Request, model.Content, CurrentUser.LanguageCode).MailError(new HandleErrorInfo(ex, "CheckoutPaymentPage", "LoadIssueList")).SendAsync(); //throw; } return(CurrentTemplate(cpm)); }
public void Post([FromBody] List <Models.ReportIncident> incidents) { var incidentTypes = this._db.IncidentTypes.Where(t => t.incidentReportTypeId == 1).ToList(); foreach (Models.ReportIncident incident in incidents) { this._db.ReportIncidents.Add(incident); this._db.SaveChanges(); var incidentType = incidentTypes.Where(t => t.incidentTypeId == incident.incidentTypeId).SingleOrDefault(); if (incidentType != null) { if (incidentType.incidentCategoryId == 1 || incidentType.incidentCategoryId == 2) // REPORTABLE TO JC { ReportsController reportsController = new ReportsController(); Models.Presentation.ReportsViewModel report = reportsController.GetReportHeader(incident.incidentId); reportsController.Dispose(); Controllers.MailController mailer = new MailController(); List <string> sendTos = new List <string>(); StringBuilder msg = new StringBuilder(); sendTos.Add("*****@*****.**"); Models.Notification notification = new Models.Notification(); notification.incidentId = incident.incidentId; notification.notifyPartyId = 37; notification.notifyDateTime = DateTime.Now; notification.notifyContact = "CFS Compliance"; notification.notifyMethod = "E-Mail"; notification.notifyStaffId = 0; notification.notifyComments = "Automatic E-Mail sent to compliance by incident report system."; notification.isAcknowledged = 1; notification.acknowledgeUserId = 0; this._db.Notifications.Add(notification); this._db.SaveChanges(); msg.Append("<h1>Incident Report: Compliance Notification</h1>"); msg.Append("<p>A new incident report for client " + report.clientName + " by " + report.staffName + " has been created and is being forwarded to compliance.</p>"); msg.Append("<p><a href=\"http://cfs-incidents/Admin/Review/" + report.incidentId.ToString() + "\">Click here to view the report.</a></p>"); //sendTos.Add(notifier.emailAddress); //sendTos.Add("*****@*****.**"); //MTS - commented out March '18 mailer.SendMail(sendTos, "*****@*****.**", "Incident Report Compliance Notification: " + report.clientName, System.Net.Mail.MailPriority.High, msg); } } } }
public async Task Index_WhenCalled_ReturnsAContentResultWithAWelcomeMessage() { // Arrange var controller = new MailController(null); // Act var result = await controller.Index(); // Assert result.Should().BeOfType <ContentResult>().Which.Content.Should().Be("Welcome to the backend mail API"); }
public void GivenValidPostRequest_SendsEmail() { var model = new ForgotPassword { Email = User.Email }; Controller.ForgotPassword(model); MailController.Verify(x => x.ForgotPassword(It.Is <ViewModels.Mail.ForgotPassword>(m => m.To == User.Email)), Times.Once()); }
void makeMail(string mailId) { GameObject mailObject; if (mailPool.TryGetNextObject(Vector3.zero, Quaternion.identity, out mailObject)) { MailController mailController = mailObject.GetComponent <MailController>(); mailController.Init(mailDb.getMailByID(mailId)); usedMails.Add(mailController); } }
public void MailController_getAllMailByUserId() { DbContextOptionsBuilder <ApplicationContext> options = new DbContextOptionsBuilder <ApplicationContext>(); options.UseSqlServer(dbUrl); ApplicationContext context = new ApplicationContext(options.Options); var testMails = new MailController(new MailRepository <Mail>(context)).Get(1); var listMails = new MailRepository <Mail>(context).getAllMailByUserId(1); Assert.AreEqual(testMails[0], listMails[0]); }
public MainViewModel() { _mailController = DummyTrivialSingleton.GetMailControllerService(); ThemeColorToggleBaseCommand = new AnotherCommandImplementation(o => SetAppColor((bool)o)); SetAppColor(true); // ToDo: Move menu creation to better place or add it in xaml or generate base on some other data. _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Inbox ", NumberOfEmails = 3, Content = new MailBoxView("Inbox"), IconContent = new PackIcon { Kind = PackIconKind.Inbox } }); _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Drafts", IconContent = new PackIcon { Kind = PackIconKind.Draft } }); _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Sent", IconContent = new PackIcon { Kind = PackIconKind.Send } }); _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Archived", IconContent = new PackIcon { Kind = PackIconKind.Archive } }); _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Important", IconContent = new PackIcon { Kind = PackIconKind.ImportantDevices } }); _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Spam ", NumberOfEmails = 99, IconContent = new PackIcon { Kind = PackIconKind.Adb } }); _testBurgerMenuItems.Add(new MailMenuItem() { Name = "Trash", IconContent = new PackIcon { Kind = PackIconKind.Trash } }); // Subscribe for controller state updates. _mailController.ControllerStateStream.ObserveOnDispatcher().Subscribe(state => ConnectionState = state); }
public void AreasAreDetectedProperly() { var rd = new RouteData(); rd.Values.Add("area", "TestArea"); var mailer = new MailController(); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new TextViewEngine()); mailer.HttpContextBase = MvcHelper.GetHttpContext("/app/", null, null); mailer.TestEmail(); Assert.NotNull(mailer.ControllerContext.RouteData.DataTokens["area"]); Assert.Equal("TestArea", mailer.ControllerContext.RouteData.DataTokens["area"]); }
public MailController() { Instance = this; }