Exemplo n.º 1
0
        public ResponseDTO InsertActivity(RequestInsertActivity request)
        {
            ResponseDTO resp = new ResponseDTO();

            using (ProjectManagementBLL objProjectManagementBLL = new ProjectManagementBLL())
            {
                try
                {
                    APICredentialsBLL credentialsBLL = new APICredentialsBLL();
                    credentialsBLL.UserName = request.APICredentials.APIUserName;
                    credentialsBLL.Password = request.APICredentials.APIPassword;
                    if (!new CommonMethods().ValidateRequest(credentialsBLL))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidCredentials;
                    }
                    else if (request.UserID == 0 || string.IsNullOrEmpty(request.ActivityName) || request.ProjectID == 0 || request.ActivityTypeID == 0)
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidData;
                    }
                    else
                    {
                        ActivityProperties propActivities = new ActivityProperties();
                        propActivities.UserID         = request.UserID;
                        propActivities.ActivityName   = request.ActivityName;
                        propActivities.Description    = request.Description;
                        propActivities.ProjectID      = request.ProjectID;
                        propActivities.IsInScope      = request.IsInScope;
                        propActivities.ActivityTypeID = request.ActivityTypeID;
                        propActivities.StartDate      = request.StartDate;
                        propActivities.EndDate        = request.EndDate;
                        if (new ActivityBLL().InsertActivity(objProjectManagementBLL, propActivities))
                        {
                            resp.ResponseCode    = ResponseCodes.Success;
                            resp.ResponseMessage = ResponseMessages.Success;
                        }
                        else
                        {
                            resp.ResponseCode    = ResponseCodes.Failed;
                            resp.ResponseMessage = ResponseMessages.Failed;
                        }
                    }
                }
                catch (Exception ex)
                {
                    resp.ResponseCode    = ResponseCodes.Failed;
                    resp.ResponseMessage = ex.Message;
                }
            }
            return(resp);
        }
Exemplo n.º 2
0
        public ResponseDTO GetLogin(LoginRequestDTO request)
        {
            ResponseDTO resp = new ResponseDTO();

            using (ProjectManagementBLL objProjectManagementBLL = new ProjectManagementBLL())
            {
                try {
                    APICredentialsBLL credentialsBLL = new APICredentialsBLL();
                    credentialsBLL.UserName = request.APICredentials.APIUserName;
                    credentialsBLL.Password = request.APICredentials.APIPassword;
                    if (!new CommonMethods().ValidateRequest(credentialsBLL))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidCredentials;
                    }
                    else if (string.IsNullOrWhiteSpace(request.Email) || string.IsNullOrWhiteSpace(request.Password))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidData;
                    }
                    else
                    {
                        APICredentialsBLL credentials = new APICredentialsBLL();
                        credentials.UserName = request.Email;
                        credentials.Password = request.Password;
                        DataTable     dtRecord = new UserMasterBLL().GetLogin(objProjectManagementBLL, credentials);
                        LoginResponse login    = new LoginResponse();
                        if (dtRecord.Rows.Count > 0)
                        {
                            foreach (DataRow row in dtRecord.Rows)
                            {
                                login.UserID   = int.Parse(row["UserID"].ToString());
                                login.RoleID   = int.Parse(row["RoleID"].ToString());
                                login.FullName = row["FullName"].ToString();
                                login.RoleName = row["RoleName"].ToString();
                            }
                        }
                        resp.ResponseCode           = ResponseCodes.Success;
                        resp.ResponseMessage        = ResponseMessages.Success;
                        resp.ResponseData           = new ResponseData();
                        resp.ResponseData.LoginResp = login;
                    }
                }
                catch (Exception ex)
                {
                    resp.ResponseCode    = ResponseCodes.Failed;
                    resp.ResponseMessage = ex.Message;
                }
            }
            return(resp);
        }
Exemplo n.º 3
0
        public ResponseDTO LoadActivityTypes(APICredentials request)
        {
            ResponseDTO resp = new ResponseDTO();

            using (ProjectManagementBLL objProjectManagementBLL = new ProjectManagementBLL())
            {
                try
                {
                    APICredentialsBLL credentialsBLL = new APICredentialsBLL();
                    credentialsBLL.UserName = request.APIUserName;
                    credentialsBLL.Password = request.APIPassword;
                    if (!new CommonMethods().ValidateRequest(credentialsBLL))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidCredentials;
                    }
                    else
                    {
                        DataTable            dtRecord = new ActivityBLL().GetAllActivityTypes(objProjectManagementBLL);
                        List <ActivityTypes> acttypes = new List <ActivityTypes>();
                        if (dtRecord.Rows.Count > 0)
                        {
                            foreach (DataRow row in dtRecord.Rows)
                            {
                                ActivityTypes acttyp = new ActivityTypes();
                                acttyp.ActTypeID    = int.Parse(row["ActTypeID"].ToString());
                                acttyp.ActivityType = row["ActivityType"].ToString();
                                acttypes.Add(acttyp);
                            }
                        }
                        resp.ResponseCode               = ResponseCodes.Success;
                        resp.ResponseMessage            = ResponseMessages.Success;
                        resp.ResponseData               = new ResponseData();
                        resp.ResponseData.activitytypes = acttypes;
                    }
                }
                catch (Exception ex)
                {
                    resp.ResponseCode    = ResponseCodes.Failed;
                    resp.ResponseMessage = ex.Message;
                }
            }
            return(resp);
        }
Exemplo n.º 4
0
        public ResponseDTO UserExist(EmailExistRequestDTO request)
        {
            ResponseDTO resp = new ResponseDTO();

            using (ProjectManagementBLL objProjectManagementBLL = new ProjectManagementBLL())
            {
                try
                {
                    APICredentialsBLL credentialsBLL = new APICredentialsBLL();
                    credentialsBLL.UserName = request.APICredentials.APIUserName;
                    credentialsBLL.Password = request.APICredentials.APIPassword;
                    if (!new CommonMethods().ValidateRequest(credentialsBLL))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidCredentials;
                    }
                    else if (string.IsNullOrWhiteSpace(request.Email))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidData;
                    }
                    else
                    {
                        DataTable dtRecord = new UserMasterBLL().AuthenticateEmail(objProjectManagementBLL, request.Email);
                        if (dtRecord.Rows.Count > 0)
                        {
                            resp.ResponseCode    = ResponseCodes.Success;
                            resp.ResponseMessage = ResponseMessages.Success;
                        }
                        else
                        {
                            resp.ResponseCode    = ResponseCodes.Success;
                            resp.ResponseMessage = ResponseMessages.NoData;
                        }
                    }
                }
                catch (Exception ex)
                {
                    resp.ResponseCode    = ResponseCodes.Failed;
                    resp.ResponseMessage = ex.Message;
                }
            }
            return(resp);
        }
        public ResponseDTO LoadProjects(APICredentials request)
        {
            ResponseDTO resp = new ResponseDTO();

            using (ProjectManagementBLL objProjectManagementBLL = new ProjectManagementBLL())
            {
                try {
                    APICredentialsBLL credentialsBLL = new APICredentialsBLL();
                    credentialsBLL.UserName = request.APIUserName;
                    credentialsBLL.Password = request.APIPassword;
                    if (!new CommonMethods().ValidateRequest(credentialsBLL))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidCredentials;
                    }
                    else
                    {
                        DataTable       dtRecord = new ProjectsBLL().GetAllProjects(objProjectManagementBLL);
                        List <Projects> projects = new List <Projects>();
                        if (dtRecord.Rows.Count > 0)
                        {
                            foreach (DataRow row in dtRecord.Rows)
                            {
                                Projects proj = new Projects();
                                proj.ProjectID   = int.Parse(row["ProjectID"].ToString());
                                proj.ProjectName = row["ProjectName"].ToString();
                                projects.Add(proj);
                            }
                        }
                        resp.ResponseCode          = ResponseCodes.Success;
                        resp.ResponseMessage       = ResponseMessages.Success;
                        resp.ResponseData          = new ResponseData();
                        resp.ResponseData.projects = projects;
                    }
                }
                catch (Exception ex)
                {
                    resp.ResponseCode    = ResponseCodes.Failed;
                    resp.ResponseMessage = ex.Message;
                }
            }
            return(resp);
        }
Exemplo n.º 6
0
        public ResponseDTO NextDayActiviity(RequestNextDayActivity request)
        {
            ResponseDTO resp = new ResponseDTO();

            using (ProjectManagementBLL objProjectManagementBLL = new ProjectManagementBLL())
            {
                try
                {
                    APICredentialsBLL credentialsBLL = new APICredentialsBLL();
                    credentialsBLL.UserName = request.APICredentials.APIUserName;
                    credentialsBLL.Password = request.APICredentials.APIPassword;
                    if (!new CommonMethods().ValidateRequest(credentialsBLL))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidCredentials;
                    }
                    else if (request.UserID == 0 || string.IsNullOrEmpty(request.NextDayActivity))
                    {
                        resp.ResponseCode    = ResponseCodes.Failed;
                        resp.ResponseMessage = ResponseMessages.InvalidData;
                    }
                    else
                    {
                        if (new ActivityBLL().UpdateNextDayActivity(objProjectManagementBLL, request.UserID, request.NextDayActivity))
                        {
                            resp.ResponseCode    = ResponseCodes.Success;
                            resp.ResponseMessage = ResponseMessages.Success;
                        }
                        else
                        {
                            resp.ResponseCode    = ResponseCodes.Failed;
                            resp.ResponseMessage = ResponseMessages.Failed;
                        }
                    }
                }
                catch (Exception ex)
                {
                    resp.ResponseCode    = ResponseCodes.Failed;
                    resp.ResponseMessage = ex.Message;
                }
            }
            return(resp);
        }