public DataObjects.Project LoadProject(int projectID)
        {
            Database.Generics genDB = new Generics();

            DataObjects.Project prj = new DataObjects.Project();

            SqlParameter param = new SqlParameter("@ProjectID", typeof(System.Int32));
            param.Value = projectID;

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            using (DataSet dsProjectDetails = genDB.GetDataFromDB("Select * From SelectProject(@ProjectID)", CommandType.Text, paramList))
            {
                if ((dsProjectDetails != null) && (dsProjectDetails.Tables.Count > 0))
                {
                    DataRow row = dsProjectDetails.Tables[0].Rows[0];
                    prj.ProjectID = Convert.ToInt32(row["ProjectID"]);
                    prj.Name = string.IsNullOrEmpty(row["ProjectName"].ToString()) ? " " : row["ProjectName"].ToString();
                    prj.Description = string.IsNullOrEmpty(row["ProjectDescription"].ToString()) ? " " : row["ProjectDescription"].ToString();
                    prj.StartDate = string.IsNullOrEmpty(row["ProjectStartDate"].ToString()) ? System.DateTime.MinValue : Convert.ToDateTime(row["ProjectStartDate"].ToString());
                    prj.EndDate = string.IsNullOrEmpty(row["ProjectEndDate"].ToString()) ? System.DateTime.MinValue : Convert.ToDateTime(row["ProjectEndDate"].ToString());
                    prj.RevisedDate = string.IsNullOrEmpty(row["ProjectRevisedDate"].ToString()) ? System.DateTime.MinValue : Convert.ToDateTime(row["ProjectRevisedDate"].ToString());
                    prj.Client = Database.Client.GetClient(Convert.ToInt32(row["ClientID"]));
                    prj.Administrator = Database.Person.LoadUser(Convert.ToInt32(row["AdminID"]));
                    prj.AccountManager = Database.Person.LoadUser(Convert.ToInt32(row["AccountManagerID"]));
                    prj.DeliveryManager = Database.Person.LoadUser(Convert.ToInt32(row["DeliverManagerID"]));
                    prj.SogetiPractitioner = Database.Person.LoadUser(Convert.ToInt32(row["SogetiPractitionerID"]));
                    prj.ProjectStatus = Database.ProjectStatus.GetAllStatusOfProject(projectID);
                }
            }

            return prj;
        }
Example #2
0
        public static List<DataObjects.StatusItem> GetTitles(int categoryID, int statusID)
        {
            SqlParameter param = new SqlParameter("@categoryID", typeof(System.Int32));
            param.Value = categoryID;
            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            List<DataObjects.StatusItem> titles = new List<DataObjects.StatusItem>();
            DataObjects.StatusItem title;

            Database.Generics genDB = new Generics();
            using (DataSet dsTitleDetail = genDB.GetDataFromDB("SELECT * FROM CategoryItem WHERE CategoryID = @categoryID", CommandType.Text, paramList))
            {
                if ((dsTitleDetail != null) && (dsTitleDetail.Tables.Count > 0))
                {
                    foreach (DataRow row in dsTitleDetail.Tables[0].Rows)
                    {
                        title = new DataObjects.StatusItem();
                        title.Id = Convert.ToInt32(row["id"]);
                        title.Title = row["Title"].ToString();
                        title.Status = Database.Status.GetStatus (statusID);

                        titles.Add(title);
                    }
                }
            }

            return titles;
        }
        public List<DataObjects.Project> GetAllProjects()
        {
            Database.Generics gen = new Generics();
            List<DataObjects.Project> prjList = new List<DataObjects.Project>();
            DataObjects.Project prj;
            using (DataSet ds = gen.GetDataFromDB("SELECT * FROM SelectProjects()", CommandType.Text))
            {
                if (ds.Tables.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        prj = new DataObjects.Project();
                        prj.ProjectID = Convert.ToInt32(row["ProjectID"]);
                        prj.Name = row["ProjectName"].ToString();
                        prj.Description = string.IsNullOrEmpty(row["ProjectDescription"].ToString()) ? " " : row["ProjectDescription"].ToString();
                        prj.StartDate = string.IsNullOrEmpty(row["ProjectStartDate"].ToString()) ? DateTime.MinValue : Convert.ToDateTime(row["ProjectStartDate"].ToString());
                        prj.EndDate = string.IsNullOrEmpty(row["ProjectEndDate"].ToString()) ? DateTime.MinValue : Convert.ToDateTime(row["ProjectEndDate"].ToString());
                        prj.RevisedDate = string.IsNullOrEmpty(row["ProjectRevisedDate"].ToString()) ? DateTime.MinValue : Convert.ToDateTime(row["ProjectRevisedDate"].ToString());
                        prj.Client = Database.Client.GetClient(Convert.ToInt32(row["ClientID"]));
                        prj.Administrator = Database.Person.LoadUser(Convert.ToInt32(row["AdminID"]));
                        prj.AccountManager = Database.Person.LoadUser(Convert.ToInt32(row["AccountManagerID"]));
                        prj.DeliveryManager = Database.Person.LoadUser(Convert.ToInt32(row["DeliverManagerID"]));
                        prj.SogetiPractitioner = Database.Person.LoadUser(Convert.ToInt32(row["SogetiPractitionerID"]));
                        prjList.Add(prj);
                    }
                }
            }

            return prjList;
        }
        public static List<DataObjects.ProjectStatus> GetAllStatusOfProject(int projectID)
        {
            SqlParameter param = new SqlParameter("projectID", typeof(System.Int32));
            param.Value = projectID;
            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            List<DataObjects.ProjectStatus> statusList = new List<DataObjects.ProjectStatus>();
            DataObjects.ProjectStatus status;

            Database.Generics genDB = new Generics();
            using (DataSet ds = genDB.GetDataFromDB("SELECT * FROM ProjectStatus WHERE ProjectID = @ProjectID", CommandType.Text, paramList))
            {
                if ((ds != null) && (ds.Tables.Count > 0))
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        status = new DataObjects.ProjectStatus();
                        status.Id = Convert.ToInt32(row["id"]);
                        status.Date = Convert.ToDateTime(row["date"]);
                        status.Category = Database.StatusCategory.GetAllCategories(projectID,
                            Convert.ToInt32(row["titleID"]),
                            Convert.ToInt32(row["StatusTypeID"]));

                        statusList.Add(status);
                    }
                }
            }
            return statusList;
        }
        public static DataObjects.StatusCategory GetCategory(int id)
        {
            SqlParameter param = new SqlParameter("ID", typeof(System.Int32));
            param.Value = id;
            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            DataObjects.StatusCategory category = new DataObjects.StatusCategory();

            Database.Generics genDB = new Generics();
            using (DataSet dsCategory = genDB.GetDataFromDB("SELECT * FROM category WHERE ID = @id", CommandType.Text, paramList))
            {
                if ((dsCategory != null) && (dsCategory.Tables.Count > 0))
                {
                    category.Id = Convert.ToInt32(dsCategory.Tables[0].Rows[0]["ID"]);
                    category.Description = dsCategory.Tables[0].Rows[0]["Description"].ToString();
                }
            }

            return category;
        }
Example #6
0
        public static DataObjects.StatusItem GetTitle(int id, int statusID)
        {
            SqlParameter param = new SqlParameter("ID", typeof(System.Int32));
            param.Value = id;
            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            DataObjects.StatusItem title = new DataObjects.StatusItem();

            Database.Generics genDB = new Generics();
            using (DataSet dsTitleDetail = genDB.GetDataFromDB("SELECT * FROM Category WHERE ID = @ID", CommandType.Text, paramList))
            {
                if ((dsTitleDetail != null) && (dsTitleDetail.Tables.Count > 0))
                {
                    title.Id = Convert.ToInt32(dsTitleDetail.Tables[0].Rows[0]["id"]);
                    title.Title = dsTitleDetail.Tables[0].Rows[0]["Description"].ToString();
                    title.Status = Database.Status.GetStatus(statusID);
                }
            }

            return title;
        }
Example #7
0
        public static DataObjects.Person LoadUser(int userID)
        {
            DataObjects.Person person = new DataObjects.Person();
            SqlParameter param = new SqlParameter("@PersonID", typeof(System.Int32));
            param.Value = userID;

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            Database.Generics gen = new Generics();
            using (DataSet dsPersonDetails = gen.GetDataFromDB("SELECT * FROM SelectPersonDetails(@PersonID)", CommandType.Text, paramList))
            {
                if ((dsPersonDetails != null) && (dsPersonDetails.Tables.Count > 0))
                {
                    person.PersonID = Convert.ToInt32(dsPersonDetails.Tables[0].Rows[0]["PersonID"]);
                    person.FirstName = dsPersonDetails.Tables[0].Rows[0]["FirstName"].ToString();
                    person.LastName = dsPersonDetails.Tables[0].Rows[0]["LastName"].ToString();
                }
            }

            return person;
        }
Example #8
0
        public static DataObjects.Status GetStatus(int id)
        {
            Database.Generics genDB = new Generics();

            SqlParameter param = new SqlParameter("ID", typeof(System.Int32));
            param.Value = id;

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(param);

            DataObjects.Status status = new DataObjects.Status();

            using (DataSet dsStatusDetail = genDB.GetDataFromDB("SELECT * FROM StatusType WHERE ID = @ID", CommandType.Text, paramList))
            {
                if ((dsStatusDetail != null) && (dsStatusDetail.Tables.Count > 0))
                {
                    status.Id = Convert.ToInt32(dsStatusDetail.Tables[0].Rows[0]["ID"]);
                    status.Description = dsStatusDetail.Tables[0].Rows[0]["Description"].ToString();
                }
            }

            return status;
        }
        public static List<DataObjects.StatusCategory> GetAllCategories(int ProjectID, int titleID, int statusID)
        {
            List<DataObjects.StatusCategory> categoryList = new List<DataObjects.StatusCategory>();
            DataObjects.StatusCategory category;

            Database.Generics genDB = new Generics();
            using (DataSet dsCategory = genDB.GetDataFromDB("SELECT * FROM statusCategory", CommandType.Text))
            {
                if ((dsCategory != null) && (dsCategory.Tables.Count > 0))
                {
                    foreach (DataRow row in dsCategory.Tables[0].Rows)
                    {
                        category = new DataObjects.StatusCategory();
                        category.Id = Convert.ToInt32(row["id"]);
                        category.Description = row["Description"].ToString();
                        category.Title = Database.Title.GetTitles(category.Id, statusID);
                        categoryList.Add(category);
                    }
                }
            }

            return categoryList;
        }
Example #10
0
        public static DataObjects.Client GetClient(int clientID)
        {
            DataObjects.Client client = new DataObjects.Client();
            Database.Generics gen = new Generics();
            SqlParameter parm = new SqlParameter("@clientID", typeof(System.Int32));
            parm.Value = clientID;
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(parm);

            using (DataSet dsClientDetails = gen.GetDataFromDB("SELECT * FROM SelectClientDetails(@ClientID)", CommandType.Text, param))
            {
                if ((dsClientDetails.Tables.Count > 0) && (dsClientDetails.Tables[0].Rows.Count > 0))
                {
                    client = new DataObjects.Client(Convert.ToInt32(dsClientDetails.Tables[0].Rows[0]["ClientID"]),
                                                  dsClientDetails.Tables[0].Rows[0]["ClientName"].ToString(),
                                                  dsClientDetails.Tables[0].Rows[0]["ClientAddress"].ToString(),
                                                  dsClientDetails.Tables[0].Rows[0]["ClientContactNumber"].ToString(),
                                                  dsClientDetails.Tables[0].Rows[0]["ShortName"].ToString());
                }
            }

            return client;
        }
Example #11
0
        public static List<DataObjects.Status> GetAllStatus()
        {
            Database.Generics genDB = new Generics();

            List<DataObjects.Status> statusList = new List<DataObjects.Status>();
            DataObjects.Status status;

            using (DataSet dsStatusDetails = genDB.GetDataFromDB("SELECT * FROM StatusType", CommandType.Text))
            {
                if ((dsStatusDetails != null) && (dsStatusDetails.Tables.Count > 0))
                {
                    foreach (DataRow row in dsStatusDetails.Tables[0].Rows)
                    {
                        status = new DataObjects.Status();
                        status.Id = Convert.ToInt32(row["id"]);
                        status.Description = row["Description"].ToString();

                        statusList.Add(status);
                    }
                }
            }

            return statusList;
        }