Пример #1
0
        public static ProjectInfo GetProjectById(int projectId)
        {
            int retValue = -1;
            ProjectInfo project = new ProjectInfo();
            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetProjectById(projectId, out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {

                    project.ProjectId = Convert.ToInt32(dr["project_id"]);
                    project.ProjectName = dr["project_name"].ToString();
                    project.ProjectCode = dr["project_code"].ToString();
                    project.ProjectLeadId = Convert.ToInt32(dr["project_lead_id"]);
                    project.ProjectLeadName = dr["project_lead_name"].ToString();
                    project.IsActive = Convert.ToBoolean(dr["is_active"]);
                    project.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    project.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    project.ChangedByName = dr["changed_by"].ToString();

                }
                //dr.Close();
            }

            return project;
        }
Пример #2
0
        public static int AddNewProject(ProjectInfo project)
        {
            if (project == null)
                throw new ArgumentNullException("project");

            int retValue = -1;
            return ProjManagementAdmin.AddNewProject(project, out retValue);
        }
Пример #3
0
 public static HttpResponseMessage UpdateProject(ProjectInfo project)
 {
     try
     {
         int val = ProjectDal.UpdateProject(project);
         return new HttpResponseMessage(HttpStatusCode.OK);
     }
     catch (Exception ex)
     {
         Console.WriteLine("EXCEPTION: " + ex);
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }
Пример #4
0
        public HttpResponseMessage Post(ProjectInfo project)
        {
            try
            {

                ProjectBl.AddNewProject(project);
                return new HttpResponseMessage(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
        }
Пример #5
0
        public static ProjectInfo[] GetAllProjects()
        {
            ArrayList al = new ArrayList();

            int retValue = -1;

            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllProjects(out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    ProjectInfo project = new ProjectInfo();

                    project.ProjectId = Convert.ToInt32(dr["project_id"]);
                    project.ProjectName = dr["project_name"].ToString();
                    project.ProjectCode = dr["project_code"].ToString();
                    project.ProjectLeadId = Convert.ToInt32(dr["project_lead_id"]);
                    project.ProjectLeadName = dr["project_lead_name"].ToString();
                    project.IsActive = Convert.ToBoolean(dr["is_active"]);
                    project.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    project.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    project.ChangedByName = dr["changed_by"].ToString();
                    if(project.IsActive == true)
                    {
                        project.OpenClose = "Close";
                    }
                    else
                    {
                        project.OpenClose = "Open";
                    }

                    al.Add(project);
                }
                //dr.Close();
            }

            ProjectInfo[] allInfo = new ProjectInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
Пример #6
0
 public static int UpdateProject(ProjectInfo project)
 {
     int retValue = -1;
     return ProjManagementAdmin.UpdateProject(project, out retValue);
 }
 public HttpResponseMessage Post(ProjectInfo project)
 {
     return ProjectBl.UpdateProject(project);
 }
 public ProjectInfo Get(int id)
 {
     ProjectInfo project = new ProjectInfo();
     project = ProjectBl.GetProjectById(id);
     return project;
 }
Пример #9
0
        private static SqlParameter[] GetAddProjectParams(ProjectInfo project)
        {
            SqlParameter[] sqlParms = new SqlParameter[100];
            sqlParms = SQLHelper.GetCachedParameters(PROC_ADDNEWPROJECT);
            if (sqlParms == null)
            {
                sqlParms = new SqlParameter[]
                            {
                                new SqlParameter(PARAM_RETURN, SqlDbType.Int),
                                new SqlParameter(PARAM_PROJECT_NAME, SqlDbType.NVarChar, 100),
                                new SqlParameter(PARAM_PROJECT_CODE, SqlDbType.NVarChar, 100),
                                new SqlParameter(PARAM_PROJECT_LEAD_ID, SqlDbType.Int),
                                new SqlParameter(PARAM_CHANGEDBY, SqlDbType.NVarChar, 50)

                            };

                sqlParms[0].Direction = ParameterDirection.ReturnValue;
                SQLHelper.CacheParameters(PROC_ADDNEWPROJECT, sqlParms);
            }

            //Assigning values to parameter
            sqlParms[0].Value = -1;
            sqlParms[1].Value = project.ProjectName;
            sqlParms[2].Value = project.ProjectCode;
            sqlParms[3].Value = project.ProjectLeadId;
            sqlParms[4].Value = "vysali";

            return sqlParms;
        }
Пример #10
0
 public static int UpdateProject(ProjectInfo project, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetUpdateProjectParams(project);
     return ExecuteNonQuery(PROC_UPDATEPROJECT, parms, out retValue);
 }
Пример #11
0
 public static int AddNewProject(ProjectInfo project, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetAddProjectParams(project);
     return ExecuteNonQuery(PROC_ADDNEWPROJECT, parms, out retValue);
 }
Пример #12
0
 public static int AddNewProject(ProjectInfo project)
 {
     return ProjectDal.AddNewProject(project);
 }