public IActionResult Decline(string ID) { UsersQueries ex = new UsersQueries(); DataTable varCollab = new DataTable(); varCollab = ex.ExecuteQueryFunction("Select ACL.ID,AC.UserID, ACL.LinkedUserID, AC.FileDirectoryID as Audio,CT.Description as Category,SCT.Description as SubCategory,U.FirstName + ' ' + U.LastName as MasterOwner, AC.ShortDescription,(SELECT FirstName + ' ' + LastName as CollaboName from App_Users Where ID = ACL.LinkedUserID ) CollaboName, ACL.NewUpload as ResponseAudio from [dbo].[App_Collaborations_Linked] ACL" + " LEFT JOIN[dbo].[App_Collaborations] AC ON AC.ID = ACL.CollaboID" + " LEFT JOIN Lk_SubCategoryTypes SCT ON SCT.ID = AC.SubCategoryID" + " Left Join Lk_CategoryTypes CT ON CT.ID = AC.CategoryID" + " LEFT JOIN App_Users U ON U.ID = AC.UserID" + " Where ACL.ID = " + ID); var UserID = varCollab.Rows[0][1].ToString(); var Collaboree = varCollab.Rows[0][2].ToString(); var CollaboID = varCollab.Rows[0][0].ToString(); DataTable varUpdatePoints = new DataTable(); varUpdatePoints = ex.ExecuteQueryFunction(" Update [dbo].[App_Users] " + " Set [Credits] = [Credits] - 1" + " Where [ID] = " + UserID); varUpdatePoints = ex.ExecuteQueryFunction(" Update [dbo].[App_Users] " + " Set [Credits] = [Credits] + 1" + " Where [ID] = " + Collaboree); varUpdatePoints = ex.ExecuteQueryFunction(" Update [dbo].[App_Collaborations_Linked] " + " Set [StatusID] = 1003 " + " Where [ID] = " + CollaboID); return RedirectToAction("Completed"); }
public IActionResult Completed() { var EntityID = Request.Cookies["ID"].ToString(); UsersQueries ex = new UsersQueries(); DataTable varUser = new DataTable(); varUser = ex.ExecuteQueryFunction("Select * from App_Users Where ID = " + EntityID); var CategoryID = varUser.Rows[0][1].ToString(); DataTable varCollab = new DataTable(); varCollab = ex.ExecuteQueryFunction("Select ACL.ID, AC.FileDirectoryID as Audio,CT.Description as Category,SCT.Description as SubCategory,U.FirstName + ' ' + U.LastName as MasterOwner, AC.ShortDescription,(SELECT FirstName + ' ' + LastName as CollaboName from App_Users Where ID = ACL.LinkedUserID ) CollaboName, ACL.NewUpload as ResponseAudio from [dbo].[App_Collaborations_Linked] ACL" + " LEFT JOIN[dbo].[App_Collaborations] AC ON AC.ID = ACL.CollaboID" + " LEFT JOIN Lk_SubCategoryTypes SCT ON SCT.ID = AC.SubCategoryID" + " Left Join Lk_CategoryTypes CT ON CT.ID = AC.CategoryID" + " LEFT JOIN App_Users U ON U.ID = AC.UserID" + " Where AC.APPTypeID = " + CategoryID + " AND AC.UserID = " + EntityID + " AND ACL.StatusID = 3 "); var varMessages = varCollab.Rows.Count; DataTable varCategories = new DataTable(); varCategories = ex.ExecuteQueryFunction("Select Description from Lk_CategoryTypes Where APPID = " + CategoryID); DataTable varPending = new DataTable(); varPending = ex.ExecuteQueryFunction("Select Count(CollaboID) as Pending from [dbo].[App_Collaborations_Linked] Where LinkedUserID = " + EntityID + " AND StatusID = 3"); DataTable varSubCategories = new DataTable(); varSubCategories = ex.ExecuteQueryFunction("Select Description from Lk_SubCategoryTypes Where APPID = " + CategoryID); UserDetails userDetails = new UserDetails(); Collaborations collabs = new Collaborations(); userDetails = (from DataRow row in varUser.Rows select new UserDetails { Name = row["FirstName"].ToString(), LastName = row["LastName"].ToString(), Credits = row["Credits"].ToString(), Pending = varPending.Rows[0][0].ToString(), Messages = varMessages.ToString(), varCollaborations = (from DataRow row2 in varCollab.Rows select new Collaborations { ID = Convert.ToInt32(row2["ID"].ToString()), Category = row2["Category"].ToString(), SubCategory = row2["SubCategory"].ToString(), Name = row2["MasterOwner"].ToString(), Audio = row2["Audio"].ToString(), Description = row2["ShortDescription"].ToString(), ResposeAudio = row2["ResponseAudio"].ToString(), }).ToList(), varCategory = (from DataRow row2 in varCategories.Rows select new Category { Description = row2["Description"].ToString(), }).ToList(), varSubCategory = (from DataRow row2 in varSubCategories.Rows select new SubCategory { Description = row2["Description"].ToString(), }).ToList(), }).FirstOrDefault(); return View(new List<UserDetails> { userDetails }); }
public IActionResult submit(string ID, string ResposeAudio) { UsersQueries ex = new UsersQueries(); DataTable varUser = new DataTable(); varUser = ex.ExecuteQueryFunction("Update [dbo].[App_Collaborations_Linked] SET [NewUpload] = '" + ResposeAudio.Replace("100%", "70%").Replace("300", "100") + "', StatusID = 3 Where ID = " + ID); return RedirectToAction("Index", "Collaboration"); }
public IActionResult Add(string Category, string SubCategory, string Name, string Description, string Audio) { var EntityID = Request.Cookies["ID"].ToString(); UsersQueries ex = new UsersQueries(); DataTable varUser = new DataTable(); varUser = ex.ExecuteQueryFunction("Select * from App_Users Where ID = " + EntityID); var AppCategoryID = varUser.Rows[0][1].ToString(); DataTable Categorydata = new DataTable(); Categorydata = ex.ExecuteQueryFunction("Select * from Lk_CategoryTypes Where Description = '" + Category + "';"); var varCategoryID = Categorydata.Rows[0][0].ToString(); DataTable SubCategorydata = new DataTable(); SubCategorydata = ex.ExecuteQueryFunction("Select * from Lk_SubCategoryTypes Where Description = '" + SubCategory + "';"); var varSubCategoryID = SubCategorydata.Rows[0][0].ToString(); var CreatedDate = DateTime.Now.ToString(); ex.ExecuteQueryFunction("Insert into App_Collaborations (CategoryID,SubCategoryID,ShortDescription,FileDirectoryID,UserID,StatusID,APPTypeID,CreatedBy,CreatedDate,UpdatedBy,UpdatedDate) Values " + $"({varCategoryID},{varSubCategoryID},'{Description}','{Audio.Replace("100%","70%").Replace("300","100")}',{EntityID},1,{AppCategoryID},'{EntityID}','{CreatedDate}','{EntityID}','{CreatedDate}')"); return(RedirectToAction("Index")); }
public IActionResult Login(string Email, string Password) { UsersQueries Test = new UsersQueries(); DataTable dt = new DataTable(); dt = Test.ExecuteQueryFunction("Select * from User Where EmailAddress = '" + Email + "' AND Password = '******'"); var ID = ""; if (dt.Rows.Count > 0) { ID = dt.Rows[0][0].ToString(); //var IDe = Request.Cookies["ID"].ToString(); CookieOptions cookies = new CookieOptions(); cookies.Expires = DateTime.Now.AddDays(1); Response.Cookies.Append("ID", ID, cookies); return(RedirectToAction("Index", "DashBoard")); } else { return(RedirectToAction("Index")); } }
/// <summary> /// Gets the user by company identifier. /// </summary> /// <param name="companyId">The company identifier.</param> /// <returns></returns> /// <exception cref="ApplicationException">Repository GetUserByCompanyID</exception> public IUser GetUserByCompanyID(string companyId) { try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var aRecord = UsersQueries.getUserByEmail(dbContext, companyId); return(aRecord); } } catch (Exception e) { throw new ApplicationException("Repository GetUserByCompanyID", e); } }
/// <summary> /// Gets the activation code. /// </summary> /// <param name="activationCode">The activation code.</param> /// <returns> /// IUsers. /// </returns> /// <exception cref="ApplicationException">Repository GetActivation Code</exception> private IUser GetActivationCode(string activationCode) { try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var activationCodeAlreadyExists = UsersQueries.GetActivationCode(dbContext, activationCode); return(activationCodeAlreadyExists); } } catch (Exception e) { throw new ApplicationException("Repository GetActivation Code", e); } }
public IActionResult Reg(string FirstName, string LastName, string EmailAddress, string PhoneNo, string Password, string RetypePassword, string ApplicationType) { UsersQueries ex = new UsersQueries(); DataTable dt = new DataTable(); dt = ex.ExecuteQueryFunction("Select * from App_Users Where EmailAddress = '" + EmailAddress + "'"); if (dt.Rows.Count > 0) { return(RedirectToAction("registration")); } else { var CreatedDate = DateTime.Now.ToString(); DataTable apptype = ex.ExecuteQueryFunction($"Select ID from Lk_ApplicationTypes Where Description = '{ApplicationType}'"); ex.ExecuteQueryFunction($"Insert into App_Users(ApplicationTypeID,FirstName,LastName,EmailAddress,Password,Tel,Credits,CreatedBy,CreatedDate,UpdatedBy,UpdatedDate) Values ( " + $"'{apptype.Rows[0][0].ToString()}','{ FirstName}','{LastName}','{EmailAddress}','{Password}','{PhoneNo}',{30},'{"APP"}','{CreatedDate}','{"APP"}','{CreatedDate}')"); return(RedirectToAction("Welcome")); } }
public IActionResult Collabo(string ID) { var EntityID = Request.Cookies["ID"].ToString(); UsersQueries ex = new UsersQueries(); DataTable varUser = new DataTable(); varUser = ex.ExecuteQueryFunction("Select * from App_Users Where ID = " + EntityID); var CategoryID = varUser.Rows[0][1].ToString(); DataTable CoLlaboDetails = new DataTable(); var CreatedDate = DateTime.Now.ToString(); ex.ExecuteQueryFunction("Insert into App_Collaborations_Linked (CollaboID,ShortDescription,StatusID,LinkedUserID,CreatedBy,CreatedDate,UpdatedBy,UpdatedDate) Values " + $"({ID},'{""}',{1},'{EntityID}','{EntityID}','{CreatedDate}','{EntityID}','{CreatedDate}')"); return(RedirectToAction("Index")); }
public IActionResult UserCollaborations() { var EntityID = Request.Cookies["ID"].ToString(); UsersQueries ex = new UsersQueries(); DataTable varUser = new DataTable(); varUser = ex.ExecuteQueryFunction("Select * from App_Users Where ID = " + EntityID); var CategoryID = varUser.Rows[0][1].ToString(); DataTable varCollab = new DataTable(); varCollab = ex.ExecuteQueryFunction("Select C.ID, CT.Description as Category,SC.Description as SubCategory,U.FirstName + ' ' + U.LastName as Name, C.FileDirectoryID as Audio,C.ShortDescription as Description from App_Collaborations C " + "Left Join Lk_CategoryTypes CT ON CT.ID = C.CategoryID" + " Left Join Lk_SubCategoryTypes SC ON SC.ID = C.SubCategoryID" + " LEFT JOIN App_Users U ON U.ID = C.UserID" + " Where C.APPTypeID = " + CategoryID + " AND UserID = " + EntityID + ";"); UserDetails userDetails = new UserDetails(); Collaborations collabs = new Collaborations(); userDetails = (from DataRow row in varUser.Rows select new UserDetails { Name = row["FirstName"].ToString(), LastName = row["LastName"].ToString(), Credits = row["Credits"].ToString(), varCollaborations = (from DataRow row2 in varCollab.Rows select new Collaborations { ID = Convert.ToInt32(row2["ID"].ToString()), Category = row2["Category"].ToString(), SubCategory = row2["SubCategory"].ToString(), Name = row2["Name"].ToString(), Audio = row2["Audio"].ToString(), Description = row2["Description"].ToString(), }).ToList(), }).FirstOrDefault(); return(View(new List <UserDetails> { userDetails })); }
public IActionResult Create() { var EntityID = Request.Cookies["ID"].ToString(); UsersQueries ex = new UsersQueries(); DataTable varUser = new DataTable(); varUser = ex.ExecuteQueryFunction("Select * from App_Users Where ID = " + EntityID); var CategoryID = varUser.Rows[0][1].ToString(); DataTable Category = new DataTable(); Category = ex.ExecuteQueryFunction("Select * from Lk_CategoryTypes Where APPID = " + CategoryID + ";"); //var varCategoryID DataTable SubCategory = new DataTable(); SubCategory = ex.ExecuteQueryFunction("Select * from Lk_SubCategoryTypes Where APPID = " + CategoryID + ";"); Upload UploadData = new Upload(); Collaborations collabs = new Collaborations(); UploadData = (from DataRow row in varUser.Rows select new Upload { Name = row["FirstName"].ToString(), LastName = row["LastName"].ToString(), Credits = row["Credits"].ToString(), varCategory = (from DataRow row2 in Category.Rows select new Category { Description = row2["Description"].ToString(), }).ToList(), varSubCategory = (from DataRow row2 in SubCategory.Rows select new SubCategory { Description = row2["Description"].ToString(), }).ToList(), }).FirstOrDefault(); return(View(new List <Upload> { UploadData })); }
/// <summary> /// Gets the user application role by username. /// </summary> /// <param name="userName">Name of the user.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"> /// userName /// or /// GetUserAppRoleByUserAppRoleId /// </exception> public IUserAppRole GetUserAppRoleByUsername(string userName) { if (userName == null) { throw new ArgumentNullException(nameof(userName)); } try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var result = UsersQueries.getUserRoleByUsername(dbContext, userName); return(result); } } catch (Exception e) { throw new ArgumentNullException("GetUserAppRoleByUserAppRoleId", e); } }
public IActionResult open(string ID) { UsersQueries ex = new UsersQueries(); DataTable varCollab = new DataTable(); varCollab = ex.ExecuteQueryFunction("Select ACL.ID, AC.FileDirectoryID as Audio,CT.Description as Category,SCT.Description as SubCategory,U.FirstName + ' ' + U.LastName as MasterOwner, AC.ShortDescription,(SELECT FirstName + ' ' + LastName as CollaboName from App_Users Where ID = ACL.LinkedUserID ) CollaboName, ACL.NewUpload as ResponseAudio from [dbo].[App_Collaborations_Linked] ACL" + " LEFT JOIN[dbo].[App_Collaborations] AC ON AC.ID = ACL.CollaboID" + " LEFT JOIN Lk_SubCategoryTypes SCT ON SCT.ID = AC.SubCategoryID" + " Left Join Lk_CategoryTypes CT ON CT.ID = AC.CategoryID" + " LEFT JOIN App_Users U ON U.ID = AC.UserID" + " Where ACL.ID = " + ID); Collaborations collabs = new Collaborations(); foreach (DataRow row2 in varCollab.Rows) { collabs.ID = Convert.ToInt32(row2["ID"].ToString()); collabs.Category = row2["Category"].ToString(); collabs.SubCategory = row2["SubCategory"].ToString(); collabs.Name = row2["MasterOwner"].ToString(); collabs.Audio = row2["Audio"].ToString(); collabs.Description = row2["ShortDescription"].ToString(); collabs.ResposeAudio = row2["ResponseAudio"].ToString(); } return View(collabs); }