/*protected override async Task OnMembersRemovedAsync(IList<ChannelAccount> membersRemoved, * ITurnContext<IConversationUpdateActivity> turnContext, * CancellationToken cancellationToken) * { * foreach(var member in membersRemoved) * { * DBOperations.RemoveUser(member.Id); * } * }*/ protected override async Task OnMembersAddedAsync (IList <ChannelAccount> membersAdded, ITurnContext <IConversationUpdateActivity> turnContext, CancellationToken cancellationToken) { var channelId = turnContext.Activity.Recipient.Id; var welcomeText = "Hello and welcome! Welcome to Subreddit Postman"; if (!DBOperations.CheckUser(channelId)) { DBOperations.AddUser(channelId); } await turnContext.SendActivityAsync(MessageFactory.Text(welcomeText, welcomeText), cancellationToken); //Start(); //PostExtractor.Begin(); }
public IHttpActionResult AddEmployee(Employee newEmp) { if (DBOperations.AddEmployee(newEmp, out string msg)) { if (DBOperations.AddUser(newEmp)) { if (newEmp.IsManager == "1") { var resultOfAddManagers = StoredProcsCall.AddManagers(newEmp.EmployeeId); if (!resultOfAddManagers) { return(Ok("Unable to add employee to managers table")); } } var resultOfLeaveAllocation = StoredProcsCall.AllocateLeave(newEmp.EmployeeId, newEmp.DOJ.Month); if (!resultOfLeaveAllocation) { return(Ok("Unable to set up leave allocation")); } if (!DBOperations.AddReportingAuthorities(newEmp.EmployeeId, newEmp.managerName)) { return(Ok("Unable to set Reporting Authority!")); } CompleteRegistration(newEmp); return(Ok("Associate has been added successfully!")); } else { return(Ok("Failed to add user")); } } else { return(Ok(msg)); } }