public OperationStatus UpdateProjectStatus(int ProjectId, string Status)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    if (ProjectId != 0)
                    {
                        var rs = dbcontext.tblProjectMemberAssociations.FirstOrDefault(x => x.ProjectMemberAssociationId == ProjectId);
                        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);
        }
Пример #2
0
        public OperationStatus DeleteSprint(int SprintId)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    if (SprintId != 0)
                    {
                        var rs = dbcontext.tblProjectSprints.FirstOrDefault(x => x.SprintId == SprintId);
                        if (rs != null)
                        {
                            dbcontext.tblProjectSprints.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 AddNewSprintMemberTimeAssociation(SprintMemberTimeAssociationCustomModel model)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    if (model.TimeId == 0)
                    {
                        tblSprintMemberTimeAssociation _addSprintList = new tblSprintMemberTimeAssociation
                        {
                            SprintId    = model.SprintId,
                            MemberId    = model.MemberId,
                            TimeSpend   = model.TimeSpend,
                            DDate       = model.DDate,
                            Description = model.Description,

                            IsActive     = true,
                            IsDeleted    = false,
                            CreatedBy    = model.CreatedBy,
                            CreatedDate  = DateTime.Now,
                            ModifiedBy   = model.ModifiedBy,
                            ModifiedDate = DateTime.Now,
                        };
                        dbcontext.tblSprintMemberTimeAssociations.Add(_addSprintList);
                        dbcontext.SaveChanges();

                        status = OperationStatus.Success;
                    }
                    else
                    {
                        var rs = dbcontext.tblSprintMemberTimeAssociations.FirstOrDefault(x => x.TimeId == model.TimeId);
                        if (rs != null)
                        {
                            rs.MemberId    = model.MemberId;
                            rs.SprintId    = model.SprintId;
                            rs.TimeSpend   = model.TimeSpend;
                            rs.DDate       = model.DDate;
                            rs.Description = model.Description;

                            rs.ModifiedDate = DateTime.Now;
                            rs.ModifiedBy   = model.ModifiedBy;

                            dbcontext.SaveChanges();
                            status = OperationStatus.Success;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
Пример #4
0
        public OperationStatus ForgotPassword(ForgotPasswordCustomModel model)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    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 = "Time 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 OperationStatus AddNewProjectMemberAssociation(ProjectMemberAssociationCustomModel objProjectMemberModel)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    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;
                        }
                    }
                    else
                    {
                        status = OperationStatus.Error;
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
 public void Dispose()
 {
     dbcontext.Dispose();
     GC.SuppressFinalize(this);
     //throw new NotImplementedException();
 }
Пример #7
0
        public OperationStatus AddNewSprint(SprintCustomModel model)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    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;
                        }
                    }
                    else
                    {
                        var rs = dbcontext.tblProjectSprints.FirstOrDefault(x => x.SprintId == model.SprintId);
                        if (rs != null)
                        {
                            rs.Title       = model.Title;
                            rs.Description = model.Description;
                            rs.SprintNo    = model.SprintNo;
                            rs.Status      = model.Status;
                            rs.StartDate   = model.StartDate;
                            rs.EndDate     = model.EndDate;

                            dbcontext.SaveChanges();
                            status = OperationStatus.Success;
                        }
                        else
                        {
                            status = OperationStatus.Duplicate;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
        public OperationStatus AddNewSprintMemberAssociation(SprintMemberAssociationCustomModel objSprintMemberModel)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    if (objSprintMemberModel.SprintMemberAssociationId == 0)
                    {
                        if (objSprintMemberModel.SprintMemberList != null)
                        {
                            List <tblSprintMemberAssociation> entitySprintLIst = objSprintMemberModel.SprintMemberList.Select(m => new tblSprintMemberAssociation
                            {
                                SprintId    = objSprintMemberModel.SprintId,
                                MemberId    = m.SprintMemberId,
                                StartDate   = objSprintMemberModel.StartDate,
                                EndDate     = objSprintMemberModel.EndDate,
                                Description = objSprintMemberModel.Description,
                                Status      = objSprintMemberModel.Status == null ? "1" : objSprintMemberModel.Status,
                                IsActive    = true,
                                IsDeleted   = false,
                            }).ToList();

                            dbcontext.tblSprintMemberAssociations.AddRange(entitySprintLIst);
                            dbcontext.SaveChanges();
                            status = OperationStatus.Success;
                        }

                        //var rs = dbcontext.tblSprintMemberAssociations.FirstOrDefault(x => x.IsDeleted == false && x.SprintId == objSprintMemberModel.SprintId && x.MemberId == objSprintMemberModel.MemberId);
                        //if (rs == null)
                        //{
                        //    tblSprintMemberAssociation _addSprintist = new tblSprintMemberAssociation
                        //    {
                        //        SprintId = objSprintMemberModel.SprintId,
                        //        MemberId = objSprintMemberModel.MemberId,
                        //        StartDate = objSprintMemberModel.StartDate,
                        //        EndDate = objSprintMemberModel.EndDate,
                        //        Description = objSprintMemberModel.Description,
                        //        Status = objSprintMemberModel.Status == null ? "1" : objSprintMemberModel.Status,
                        //        IsActive = true,
                        //        IsDeleted = false,
                        //        CreatedBy = objSprintMemberModel.CreatedBy,
                        //        CreatedDate = System.DateTime.Now,
                        //        ModifiedBy = objSprintMemberModel.ModifiedBy,
                        //        ModifiedDate = System.DateTime.Now,
                        //    };
                        //    dbcontext.tblSprintMemberAssociations.Add(_addSprintist);
                        //    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);
        }
Пример #9
0
        public OperationStatus AddNewProject(ProjectCustomModel objProjectModel)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new TimeManagementEntities())
                {
                    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,
                                StartDate   = objProjectModel.StartDate,
                                EndDate     = objProjectModel.EndDate,
                                AlliasName  = objProjectModel.AlliasName,
                                ProjectType = objProjectModel.ProjectType,

                                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;
                        }
                    }
                    else
                    {
                        var rs = dbcontext.tblProjects.FirstOrDefault(x => x.ProjectId == objProjectModel.ProjectId && x.IsDeleted == false);
                        if (rs != null)
                        {
                            rs.Title        = objProjectModel.Title;
                            rs.Description  = objProjectModel.Description;
                            rs.Documents    = objProjectModel.Documents;
                            rs.Image        = objProjectModel.Image;
                            rs.StartDate    = objProjectModel.StartDate;
                            rs.EndDate      = objProjectModel.EndDate;
                            rs.AlliasName   = objProjectModel.AlliasName;
                            rs.ProjectType  = objProjectModel.ProjectType;
                            rs.ModifiedDate = DateTime.Now;

                            dbcontext.SaveChanges();
                            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 TimeManagementEntities())
                    {
                        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,
                                    Image        = applicationUserModel.Image,
                                    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);
        }