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 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 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 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); }
/// <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); }
public void Dispose() { dbcontext.Dispose(); GC.SuppressFinalize(this); //throw new NotImplementedException(); }
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); }