public OperationStatus UpdateSprintStatus(int SprintId, string Status) { OperationStatus status = OperationStatus.Error; try { using (dbcontext = new ResourceManagementEntities()) { if (SprintId != 0) { var rs = dbcontext.tblSprintMemberAssociations.FirstOrDefault(x => x.SprintMemberAssociationId == SprintId); if (rs != null) { rs.Status = Status; dbcontext.SaveChanges(); status = OperationStatus.Success; } } else { status = OperationStatus.Error; } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; throw ex; } return(status); }
public OperationStatus DeleteProjectAssociation(int ProjectId) { OperationStatus status = OperationStatus.Error; try { using (dbcontext = new ResourceManagementEntities()) { if (ProjectId != 0) { var rs = dbcontext.tblProjectMemberAssociations.FirstOrDefault(x => x.ProjectMemberAssociationId == ProjectId); if (rs != null) { dbcontext.tblProjectMemberAssociations.Remove(rs); dbcontext.SaveChanges(); status = OperationStatus.Success; } } else { status = OperationStatus.Error; } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; throw ex; } return(status); }
public OperationStatus AddNewProject(ProjectCustomModel objProjectModel) { OperationStatus status = OperationStatus.Error; try { using (dbcontext = new ResourceManagementEntities()) { if (objProjectModel.ProjectId == 0) { var rs = dbcontext.tblProjects.FirstOrDefault(x => x.Title == objProjectModel.Title && x.IsDeleted == false); if (rs == null) { tblProject _addProject = new tblProject { Title = objProjectModel.Title, Description = objProjectModel.Description, Documents = objProjectModel.Documents, Image = objProjectModel.Image, AlliasName = objProjectModel.AlliasName, ProjectType = objProjectModel.ProjectType, StartDate = objProjectModel.StartDate, EndDate = objProjectModel.EndDate, IsActive = true, IsDeleted = false, CreatedDate = DateTime.Now, CreatedBy = objProjectModel.CreatedBy, ModifiedDate = DateTime.Now, ModifiedBy = objProjectModel.ModifiedBy, }; dbcontext.tblProjects.Add(_addProject); dbcontext.SaveChanges(); status = OperationStatus.Success; } else { status = OperationStatus.Duplicate; } } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; throw ex; } return(status); }
public OperationStatus AddNewSprint(SprintCustomModel model) { OperationStatus status = OperationStatus.Error; try { using (dbcontext = new ResourceManagementEntities()) { if (model.SprintId == 0) { var rs = dbcontext.tblProjectSprints.FirstOrDefault(x => x.Title == model.Title && x.ProjectId == model.ProjectId); if (rs == null) { tblProjectSprint _addSprint = new tblProjectSprint { ProjectId = model.ProjectId, Title = model.Title, Description = model.Description, SprintNo = model.SprintNo, Status = model.Status, StartDate = model.StartDate, EndDate = model.EndDate, IsActive = true, IsDeleted = false, CreatedDate = DateTime.Now, CreatedBy = model.CreatedBy, ModifiedDate = DateTime.Now, ModifiedBy = model.ModifiedBy, }; dbcontext.tblProjectSprints.Add(_addSprint); dbcontext.SaveChanges(); status = OperationStatus.Success; } else { status = OperationStatus.Duplicate; } } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; throw ex; } return(status); }
public object GetMyProjectList(int MemberId) { IList <ProjectMemberAssociationCustomModel> ProjectListModel = new List <ProjectMemberAssociationCustomModel>(); using (response = new Response()) { using (dbcontext = new ResourceManagementEntities()) { try { if (MemberId != 0) { response.success = true; ProjectListModel = dbcontext.tblProjectMemberAssociations.Where(x => x.MemberId == MemberId && x.IsDeleted == false) .Select(x => new ProjectMemberAssociationCustomModel { ProjectId = x.ProjectId, ProjectName = x.tblProject != null ? x.tblProject.Title : "", MemberId = x.MemberId, MemberName = x.tblMember != null ? x.tblMember.FName + " " + x.tblMember.LName : "", Description = x.Description, Status = x.Status, StartDate = x.StartDate, EndDate = x.EndDate, IsActive = x.IsActive, IsDeleted = x.IsDeleted, CreatedBy = x.CreatedBy, CreatedDate = x.CreatedDate, ModifiedBy = x.ModifiedBy, ModifiedDate = x.ModifiedDate, }).OrderByDescending(x => x.ProjectId).ToList(); return(ProjectListModel); } else { response.success = false; return(ProjectListModel); } } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }
public object GetMemberDetail(int MemberId) { using (response = new Response()) { using (dbcontext = new ResourceManagementEntities()) { try { response.success = true; var rs = dbcontext.tblMembers.Where(x => x.IsDeleted == false && x.MemberId == MemberId) .Select(x => new MemberCustomModel { MemberId = x.MemberId, FName = x.FName, LName = x.LName, MemberCode = x.MemberCode, EmailId = x.EmailId, MobileNo = x.MobileNo, MotherName = x.MotherName, FatherName = x.FatherName, Address = x.Address, DateOfBirth = x.DateOfBirth, Gender = x.Gender, Designation = x.Designation, UserTypeId = x.UserTypeId, Image = x.Image, IsActive = x.IsActive, IsDeleted = x.IsDeleted, CreatedBy = x.CreatedBy, CreatedDate = x.CreatedDate, ModifiedBy = x.ModifiedBy, ModifiedDate = x.ModifiedDate, SprintList = x.tblSprintMemberAssociations.Where(s => s.MemberId == x.MemberId).Select(s => new SprintDetail { SprintName = s.tblProjectSprint != null ? s.tblProjectSprint.Title : "" }).ToList(), }).OrderByDescending(x => x.MemberId).ToList(); return(rs); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }
public object GetApplicationMemberList(MemberCustomModel objMemberModel) { IList <MemberCustomModel> MemberListModel = new List <MemberCustomModel>(); using (response = new Response()) { using (dbcontext = new ResourceManagementEntities()) { try { response.success = true; MemberListModel = dbcontext.tblMembers.Where(x => x.IsDeleted == false) .Select(x => new MemberCustomModel { MemberId = x.MemberId, FName = x.FName, LName = x.LName, MemberCode = x.MemberCode, EmailId = x.EmailId, MobileNo = x.MobileNo, MotherName = x.MotherName, FatherName = x.FatherName, Address = x.Address, DateOfBirth = x.DateOfBirth, Designation = x.Designation, UserTypeId = x.UserTypeId, Gender = x.Gender, Image = x.Image, IsActive = x.IsActive, IsDeleted = x.IsDeleted, CreatedBy = x.CreatedBy, CreatedDate = x.CreatedDate, ModifiedBy = x.ModifiedBy, ModifiedDate = x.ModifiedDate, }).OrderByDescending(x => x.MemberId).ToList(); return(MemberListModel); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }
public OperationStatus ForgotPassword(ForgotPasswordCustomModel model) { OperationStatus status = OperationStatus.Error; try { using (dbcontext = new ResourceManagementEntities()) { var rs = dbcontext.tblApplicationUsers.FirstOrDefault(x => x.UserName == model.UserName); if (rs != null) { string from = "*****@*****.**"; //any valid GMail ID string to = Convert.ToString(rs.EmailId); //any valid GMail ID using (MailMessage mail = new MailMessage(from, to)) { mail.Subject = "Resource Management Forgot Password"; mail.Body = "Dear " + rs.FName + " " + rs.LName + " <br><br>Please use this password to login: "******"<br><br>Thanks,<br>Team"; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "shally123");// Enter seders User name and password smtp.EnableSsl = true; smtp.Send(mail); status = OperationStatus.Success; } } else { status = OperationStatus.Duplicate; } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; throw ex; } return(status); }
public object GetProjectListing(ProjectCustomModel objProjectModel) { IList <ProjectCustomModel> ProjectListModel = new List <ProjectCustomModel>(); using (response = new Response()) { using (dbcontext = new ResourceManagementEntities()) { try { response.success = true; ProjectListModel = dbcontext.tblProjects.Where(x => x.IsDeleted == false) .Select(x => new ProjectCustomModel { ProjectId = x.ProjectId, Title = x.Title, Description = x.Description, Documents = x.Documents, Image = x.Image, AlliasName = x.AlliasName, ProjectType = x.ProjectType, StartDate = x.StartDate, EndDate = x.EndDate, IsActive = x.IsActive, IsDeleted = x.IsDeleted, CreatedBy = x.CreatedBy, CreatedDate = x.CreatedDate, ModifiedBy = x.ModifiedBy, ModifiedDate = x.ModifiedDate, }).OrderByDescending(x => x.ProjectId).ToList(); return(ProjectListModel); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }
public object GetProjectSprintListing(int ProjectId) { List <SprintCustomModel> SprintListModel = new List <SprintCustomModel>(); using (response = new Response()) { using (dbcontext = new ResourceManagementEntities()) { try { response.success = true; SprintListModel = dbcontext.tblProjectSprints.Where(x => x.ProjectId == ProjectId) .Select(x => new SprintCustomModel { ProjectId = x.ProjectId, Title = x.Title, Description = x.Description, SprintNo = x.SprintNo, Status = x.Status, SprintId = x.SprintId, StartDate = x.StartDate, EndDate = x.EndDate, IsActive = x.IsActive, IsDeleted = x.IsDeleted, CreatedBy = x.CreatedBy, CreatedDate = x.CreatedDate, ModifiedBy = x.ModifiedBy, ModifiedDate = x.ModifiedDate, }).OrderByDescending(x => x.SprintId).ToList(); return(SprintListModel); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }
/// <summary> /// This method is used to save new members /// </summary> /// <returns></returns> public OperationStatus SaveApplicationUser(ApplicationUserModel applicationUserModel) { OperationStatus status = OperationStatus.Error; using (TransactionScope ts = new TransactionScope()) { try { using (dbcontext = new ResourceManagementEntities()) { if (applicationUserModel.ApplicationUserId == 0) { var rs = dbcontext.tblApplicationUsers.FirstOrDefault(x => x.UserName == applicationUserModel.UserName && x.IsDeleted == false); if (rs == null) { tblMember _addMember = new tblMember { FName = applicationUserModel.FName, LName = applicationUserModel.LName, MemberCode = applicationUserModel.MemberCode, UserTypeId = applicationUserModel.UserTypeId, EmailId = applicationUserModel.EmailId, MobileNo = applicationUserModel.MobileNo, Address = applicationUserModel.Address, Gender = applicationUserModel.Gender, DateOfBirth = applicationUserModel.DateOfBirth, FatherName = applicationUserModel.FatherName, MotherName = applicationUserModel.MotherName, Designation = applicationUserModel.Designation, IsActive = true, IsDeleted = false, CreatedDate = DateTime.Now, CreatedBy = applicationUserModel.CreatedBy, ModifiedDate = DateTime.Now, ModifiedBy = applicationUserModel.ModifiedBy, }; dbcontext.tblMembers.Add(_addMember); dbcontext.SaveChanges(); int userid = _addMember.MemberId; tblApplicationUser _applicationUserinfo = new tblApplicationUser { FName = applicationUserModel.FName, LName = applicationUserModel.LName, MemberCode = applicationUserModel.MemberCode, UserTypeId = applicationUserModel.UserTypeId, EmailId = applicationUserModel.EmailId, MobileNo = applicationUserModel.MobileNo, Address = applicationUserModel.Address, Gender = applicationUserModel.Gender, DateOfBirth = applicationUserModel.DateOfBirth, UserIdentityKey = userid, UserName = applicationUserModel.UserName, Password = applicationUserModel.Password, IsActive = true, IsDeleted = false, CreatedDate = DateTime.Now, CreatedBy = applicationUserModel.CreatedBy, ModifiedDate = DateTime.Now, ModifiedBy = applicationUserModel.ModifiedBy, }; dbcontext.tblApplicationUsers.Add(_applicationUserinfo); dbcontext.SaveChanges(); status = OperationStatus.Success; ts.Complete(); } else { status = OperationStatus.Duplicate; //ts.Dispose(); } } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; ts.Dispose(); throw ex; } } return(status); }
/// <summary> /// method is used for validate application users /// </summary> /// <param name="Logininfo"></param> /// <returns></returns> public object GetLoginUser(LoginUserModel Logininfo) { APIResponse _response = new APIResponse(); LoggedInUserModel lgAppUserDetails = new LoggedInUserModel(); object objLgAppUserDetails; try { using (dbcontext = new ResourceManagementEntities()) { Logininfo.UserName = Logininfo.UserName.ToLower(); tblApplicationUser lgDetail = dbcontext.tblApplicationUsers.FirstOrDefault(x => x.UserName.ToLower() == Logininfo.UserName && x.IsDeleted == false); if (lgDetail != null) { if (lgDetail.Password == Logininfo.Password) { lgAppUserDetails.ApplicationUserId = lgDetail.ApplicationUserId; lgAppUserDetails.UserIdentityKey = lgDetail.UserIdentityKey; lgAppUserDetails.success = true; lgAppUserDetails.ErrorMessage = "User Authenticated!!"; lgAppUserDetails.FName = lgDetail.FName == null ? "" : lgDetail.FName; lgAppUserDetails.LName = lgDetail.LName == null ? "" : lgDetail.LName; lgAppUserDetails.MemberCode = lgDetail.MemberCode == null ? "" : lgDetail.MemberCode; lgAppUserDetails.UserTypeId = lgDetail.UserTypeId == null ? 0 : lgDetail.UserTypeId; lgAppUserDetails.UserType = lgDetail.tblUserTypeMaster != null ? lgDetail.tblUserTypeMaster.Title : ""; lgAppUserDetails.EmailId = lgDetail.EmailId; lgAppUserDetails.MobileNo = lgDetail.MobileNo; lgAppUserDetails.Address = lgDetail.Address; lgAppUserDetails.Gender = lgDetail.Gender; lgAppUserDetails.DateOfBirth = lgDetail.DateOfBirth; lgAppUserDetails.FatherName = lgDetail.tblMember == null ? "" : lgDetail.tblMember.FatherName; lgAppUserDetails.MotherName = lgDetail.tblMember == null ? "" : lgDetail.tblMember.MotherName; lgAppUserDetails.UserTypeId = lgDetail.UserTypeId; lgAppUserDetails.UserName = lgDetail.UserName; lgAppUserDetails.Designation = lgDetail.tblMember != null ? lgDetail.tblMember.Designation : ""; _response.Message = "User Authenticated!!"; _response.IsSucess = true; } else { lgAppUserDetails.ErrorMessage = "Invalid password!!"; _response.Message = "Invalid password!!"; _response.IsSucess = false; } } else { lgAppUserDetails.ErrorMessage = "Invalid username!!"; _response.Message = "Invalid username!!"; _response.IsSucess = false; } } } catch (Exception ex) { lgAppUserDetails = null; objLgAppUserDetails = null; dbcontext = null; lgAppUserDetails.ErrorMessage = ex.Message.ToString(); } objLgAppUserDetails = lgAppUserDetails; return(objLgAppUserDetails); }
public OperationStatus AddNewProjectMemberAssociation(ProjectMemberAssociationCustomModel objProjectMemberModel) { OperationStatus status = OperationStatus.Error; try { using (dbcontext = new ResourceManagementEntities()) { if (objProjectMemberModel.ProjectMemberAssociationId == 0) { if (objProjectMemberModel.ProjectMemberList != null) { List <tblProjectMemberAssociation> entityKisanLIst = objProjectMemberModel.ProjectMemberList.Select(m => new tblProjectMemberAssociation { ProjectId = objProjectMemberModel.ProjectId, MemberId = m.ProjectMemberId, StartDate = objProjectMemberModel.StartDate, EndDate = objProjectMemberModel.EndDate, Description = objProjectMemberModel.Description, Status = objProjectMemberModel.Status == null ? "1" : objProjectMemberModel.Status, IsActive = true, IsDeleted = false, }).ToList(); dbcontext.tblProjectMemberAssociations.AddRange(entityKisanLIst); dbcontext.SaveChanges(); status = OperationStatus.Success; } //var rs = dbcontext.tblProjectMemberAssociations.FirstOrDefault(x => x.IsDeleted == false && x.ProjectId == objProjectMemberModel.ProjectId && x.MemberId == objProjectMemberModel.MemberId); //if (rs == null) //{ // tblProjectMemberAssociation _addProjectList = new tblProjectMemberAssociation // { // ProjectId = objProjectMemberModel.ProjectId, // MemberId = objProjectMemberModel.MemberId, // StartDate = objProjectMemberModel.StartDate, // EndDate = objProjectMemberModel.EndDate, // Description = objProjectMemberModel.Description, // Status = objProjectMemberModel.Status == null ? "1" : objProjectMemberModel.Status, // IsActive = true, // IsDeleted = false, // CreatedBy = objProjectMemberModel.CreatedBy, // CreatedDate = System.DateTime.Now, // ModifiedBy = objProjectMemberModel.ModifiedBy, // ModifiedDate = System.DateTime.Now, // }; // dbcontext.tblProjectMemberAssociations.Add(_addProjectList); // dbcontext.SaveChanges(); // status = OperationStatus.Success; //} //else //{ // status = OperationStatus.Duplicate; //} } else { status = OperationStatus.Error; } } } catch (Exception ex) { dbcontext.Dispose(); status = OperationStatus.Exception; throw ex; } return(status); }