Skip to content

Commit

Permalink
Socioboard 3.0
Browse files Browse the repository at this point in the history
1.Changes for graph in admin panel
2.changes for deleted account
3.changes in instagram report for daywise filter
4.changes in news letter for start date
5.admin-> logout redirecting to company page instead of homepage
6.add undo or edit feature in deleted user tab, so that admin can
undo deleted user whever needed
7.add inactive users tab where only disable account must list
and also add edit feature for all inactive account so that admin
can enable account if needed
8.select package option is not necessary in admin panel, as admin
editing individual packages
9.automatic refresh is needed in all updates, so that we can save
one more click after every updates
10.accounts payment status  showing paid in admin side,
it should be unpaid if user signup as free account
11.implement training form with paypal
12.facebook group post ui issue
13.changes in liknedin group post
14.training mail implement
15.changes in profilesetting for DOB
16.fanpage email id
  • Loading branch information
socioboard committed Jan 31, 2017
1 parent efb1d12 commit 0b94647
Show file tree
Hide file tree
Showing 115 changed files with 1,606 additions and 609 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
106 changes: 106 additions & 0 deletions src/Api.Socioboard/Controllers/TrainingController..cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using Domain.Socioboard.Interfaces.Services;



// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Api.Socioboard.Controllers
{
[EnableCors("AllowAll")]
[Route("api/[controller]")]
public class TrainingController : Controller
{
public TrainingController(ILogger<TrainingController> logger, IEmailSender emailSender, Microsoft.Extensions.Options.IOptions<Helper.AppSettings> settings, IHostingEnvironment env)
{
_logger = logger;
_emailSender = emailSender;
_appSettings = settings.Value;
_redisCache = new Helper.Cache(_appSettings.RedisConfiguration);
_env = env;

}
private readonly ILogger _logger;
private Helper.AppSettings _appSettings;
private readonly IEmailSender _emailSender;
private Helper.Cache _redisCache;
private readonly IHostingEnvironment _env;

//[HttpPost("getTrainingDetails")]
//public IActionResult getTrainingDetails(string firstName, string lastName, string company, string emailId, string phoneNumber, string message, string demoPlanType, string amount)
//{
// Domain.Socioboard.Models.Training _trainingDetails = new Domain.Socioboard.Models.Training();
// _trainingDetails.FirstName = firstName;
// _trainingDetails.LastName = lastName;
// _trainingDetails.Company = company;
// _trainingDetails.EmailId = emailId;
// _trainingDetails.PhoneNo = phoneNumber;
// _trainingDetails.Message = message;
// //_trainingDetails.PaymentAmount = double.Parse(amount);
// //HttpContext.Session.SetObjectAsJson();
// //return Content(Helpers.Payment.AgencyPayment(amount, demoPlanType, firstName + " " + lastName, phoneNumber, emailId, "USD", _appSettings.paypalemail, _appSettings.callBackUrl, _appSettings.failUrl, _appSettings.AgencycallBackUrl, _appSettings.cancelurl, "", "", _appSettings.PaypalURL));
// return Ok("true");
//}


[HttpPost("updateTrainingDetails")]
public IActionResult updateTrainingDetails(Domain.Socioboard.Models.Training _training)
{
Model.DatabaseRepository dbr = new Model.DatabaseRepository(_logger, _env);
_training.CreatedDate = DateTime.UtcNow;

int SavedStatus = dbr.Add<Domain.Socioboard.Models.Training>(_training);

if (SavedStatus == 1 && _training != null)
{

try
{
string path = _env.WebRootPath + "\\views\\mailtemplates\\plan.html";
string html = System.IO.File.ReadAllText(path);
html = html.Replace("[FirstName]", _training.FirstName);
html = html.Replace("[AccountType]", "Training");
_emailSender.SendMailSendGrid(_appSettings.frommail, "", _training.EmailId, "", "", "hello", html, _appSettings.SendgridUserName, _appSettings.SendGridPassword);
Mailforsocioboard(_training);
return Ok("Demo Requested Added");
}
catch (Exception ex)
{
return Ok("Issue while sending mail.");
}
}
else
{
return Ok("problem while saving,pls try after some time");
}
}


[HttpPost("demoReq")]
public ActionResult Mailforsocioboard(Domain.Socioboard.Models.Training _training)
{
string path = _env.WebRootPath + "\\views\\mailtemplates\\registrationmail.html";
string html = System.IO.File.ReadAllText(path);
html = html.Replace("[FirstName]", _training.FirstName);
html = html.Replace("[AccountType]", "Training");
// _emailSender.SendMail("", "", "[email protected]", "", "", "Customer requested for demo enterprise plan ", html, _appSettings.ZohoMailUserName, _appSettings.ZohoMailPassword);
_emailSender.SendMailSendGrid("", "", "[email protected]", "", _appSettings.ccmail, "Customer requested for demo enterprise plan ", html, _appSettings.SendgridUserName, _appSettings.SendGridPassword);
return Ok("Mail Sent Successfully.");

}


}



}

112 changes: 89 additions & 23 deletions src/Api.Socioboard/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public IActionResult Register(User user)
user.UserName = "Socioboard";
user.UserType = "User";
user.PayPalAccountStatus = Domain.Socioboard.Enum.PayPalAccountStatus.notadded;
if(user.AccountType== Domain.Socioboard.Enum.SBAccountType.Free)
{
user.PaymentStatus = Domain.Socioboard.Enum.SBPaymentStatus.UnPaid;
}
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
Expand Down Expand Up @@ -293,7 +297,7 @@ public IActionResult GetUnPaidUserAdmin()
}

[HttpPost("AdminAddNewsLetter")]
public IActionResult AdminAddNewsLetter(string Advertisement, string img_url, DateTime date, IFormFile files)
public IActionResult AdminAddNewsLetter(string Advertisement, string img_url,DateTime startdate, DateTime date, IFormFile files)
{

var filename = "";
Expand Down Expand Up @@ -321,8 +325,8 @@ public IActionResult AdminAddNewsLetter(string Advertisement, string img_url, Da
.Trim('"');
var tempName = Domain.Socioboard.Helpers.SBHelper.RandomString(10) + '.' + fileName.Split('.')[1];
filename = _appEnv.WebRootPath + "\\upload" + $@"\{tempName}";
newsletter.NewsLetterBody = filename;
uploads = _appSettings.ApiDomain + "/api/Media/get?id=" + $@"{tempName}";
newsletter.NewsLetterBody = uploads;
try
{
using (FileStream fs = System.IO.File.Create(filename))
Expand All @@ -349,8 +353,10 @@ public IActionResult AdminAddNewsLetter(string Advertisement, string img_url, Da
return Ok("Please select file ");
}
newsletter.Subject = Advertisement;
newsletter.startdate = startdate;
newsletter.ExpiryDate = date;


int res = dbr.Add<NewsLetter>(newsletter);
if (res == 1)
{
Expand Down Expand Up @@ -475,14 +481,14 @@ public IActionResult GetNewsLetter()


[HttpPost("UpdatePackageAdmin")]
public IActionResult UpdatePackageAdmin(string packagename, string amount, long id)
public IActionResult UpdatePackageAdmin(string amount, long id)
{

DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
Package package = dbr.Single<Package>(t => t.id == id);
if (package != null)
{
package.packagename = packagename;

package.amount = amount;

int res = dbr.Update<Package>(package);
Expand All @@ -503,27 +509,54 @@ public IActionResult UpdatePackageAdmin(string packagename, string amount, long
}

[HttpPost("UpdateNewsLetterAdmin")]
public IActionResult UpdateNewsLetterAdmin(string NewsLetterBody, string Subject, DateTime ExpiryDate, long Id)
public IActionResult UpdateNewsLetterAdmin(string NewsLetterBody, string Subject,DateTime startDate, DateTime ExpiryDate, long Id, IFormFile files)
{

var filename = "";
//var uploads = _appEnv.WebRootPath + "\\wwwwroot\\upload\\" + Advertisement;
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
NewsLetter newsletter = dbr.Single<NewsLetter>(t => t.Id == Id);

if (newsletter != null)
{
newsletter.NewsLetterBody = NewsLetterBody;
newsletter.Subject = Subject;
newsletter.ExpiryDate = ExpiryDate;
//newsletter.NewsLetterBody = NewsLetterBody;

int res = dbr.Update<NewsLetter>(newsletter);
if (res == 1)
{
//_redisCache.Delete(package.EmailId);
return Ok("News Letter detail updated");
}
else
{
return Ok("issue while updating");
}
var fileName = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue.Parse(files.ContentDisposition).FileName.Trim('"');
filename = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue
.Parse(files.ContentDisposition)
.FileName
.Trim('"');
var tempName = Domain.Socioboard.Helpers.SBHelper.RandomString(10) + '.' + fileName.Split('.')[1];
filename = _appEnv.WebRootPath + "\\upload" + $@"\{tempName}";
var uploads = _appSettings.ApiDomain + "/api/Media/get?id=" + $@"{tempName}";
try
{
using (FileStream fs = System.IO.File.Create(filename))
{
files.CopyTo(fs);
fs.Flush();
}
}
catch (Exception ex)
{

}
filename = uploads;

newsletter.NewsLetterBody = uploads;
newsletter.Subject = Subject;
newsletter.startdate = startDate;
newsletter.ExpiryDate = ExpiryDate;

int res = dbr.Update<NewsLetter>(newsletter);
if (res == 1)
{
//_redisCache.Delete(package.EmailId);
return Ok("News Letter detail updated");
}
else
{
return Ok("issue while updating");
}
}
else
{
Expand All @@ -548,6 +581,24 @@ public IActionResult GetDeletedUserAdmin()

}


[HttpGet("GetDisabledUserAdmin")]
public IActionResult GetDisabledUserAdmin()
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
List<User> user = dbr.Find<User>(t => t.ActivationStatus == Domain.Socioboard.Enum.SBUserActivationStatus.Disable).ToList();
//User user = dbr.Single<User>(t => t.Id == Id);
if (user != null)
{
return Ok(user);
}
else
{
return NotFound();
}

}

[HttpGet("GetCouponsUserAdmin")]
public IActionResult GetCouponsUserAdmin()
{
Expand Down Expand Up @@ -649,6 +700,17 @@ public IActionResult DeleteUserAdmin(long Id)

}

[HttpGet("UndoUserAdmin")]
public IActionResult UndoUserAdmin(long Id)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
Domain.Socioboard.Models.User _use = dbr.Single<Domain.Socioboard.Models.User>(t => t.Id == Id);
_use.ActivationStatus = Domain.Socioboard.Enum.SBUserActivationStatus.Active;
dbr.Update<Domain.Socioboard.Models.User>(_use);
return Ok();

}

[HttpPost("UpdateUserAdmin")]
public IActionResult UpdateUserAdmin(string firstName, string lastName, string user_email, Domain.Socioboard.Enum.SBAccountType AccountType, Domain.Socioboard.Enum.SBPaymentStatus PaymentStatus, Domain.Socioboard.Enum.SBUserActivationStatus AccountStatus, long userid)
{
Expand Down Expand Up @@ -1153,13 +1215,17 @@ public IActionResult ForgotPasswordSendMail(string emailId)
}
if (user != null)
{
if (user.EmailValidateToken.Equals("Facebook"))
if (user.ActivationStatus == Domain.Socioboard.Enum.SBUserActivationStatus.InActive || user.ActivationStatus == Domain.Socioboard.Enum.SBUserActivationStatus.Disable)
{
return Ok("Your account deleted permanently please contact socioboard support team ");
}
else if (user.EmailValidateToken.Equals("Facebook"))
{
return Ok("you can login with facebook.");
return Ok("Password reset is not permitted as you have loggedin through Facebook, please login with Facebook.");
}
else if (user.EmailValidateToken.Equals("Google"))
{
return Ok("you can login with Google.");
return Ok("Password reset is not permitted as you have loggedin through Google, please login with Google.");
}
user.forgotPasswordKeyToken = SBHelper.RandomString(20);
user.forgotPasswordExpireDate = DateTime.UtcNow.AddDays(1);
Expand Down Expand Up @@ -1381,7 +1447,7 @@ public ActionResult Mailforsocioboard(DemoRequest demoReq)
string html = System.IO.File.ReadAllText(path);
html = html.Replace("[FirstName]", demoReq.firstName);
html = html.Replace("[AccountType]", demoReq.demoPlanType.ToString());
_emailSender.SendMail("", "", "[email protected]", "", "", "Customer requested for demo enterprise plan ", html, _appSettings.ZohoMailUserName, _appSettings.ZohoMailPassword);
_emailSender.SendMailSendGrid("", "", "[email protected]", "", _appSettings.ccmail, "Customer requested for demo enterprise plan ", html, _appSettings.SendgridUserName, _appSettings.SendGridPassword);
return Ok("Mail Sent Successfully.");

}
Expand Down
Binary file modified src/Api.Socioboard/bin/Debug/net451/Api.Socioboard.exe
Binary file not shown.
Binary file modified src/Api.Socioboard/bin/Debug/net451/Api.Socioboard.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/Api.Socioboard/bin/Debug/net451/win7-x86/Domain.Socioboard.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 0b94647

Please sign in to comment.