예제 #1
0
 public static HttpResponseMessage AddProjectToLocation(ProjectLocationInfo ProjLoc)
 {
     try
     {
         int val = ProjectLocationDal.AddProjectAtLocation(ProjLoc);
         return new HttpResponseMessage(HttpStatusCode.OK);
     }
     catch (Exception ex)
     {
         Console.WriteLine("EXCEPTION: " + ex);
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }
예제 #2
0
 public static int AddProjectAtLocation(ProjectLocationInfo ProjLoc)
 {
     int retValue = -1;
     return ProjManagementAdmin.AddProjectAtLocation(ProjLoc, out retValue);
 }
예제 #3
0
        public static ProjectLocationInfo[] GetProjectsAtLocation(int LocationId)
        {
            ArrayList al = new ArrayList();
            int retValue = -1;
            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetProjectsAtLocation(LocationId,out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    ProjectLocationInfo proj_loc = new ProjectLocationInfo();

                    proj_loc.ProjectLocationId = Convert.ToInt32(dr["project_location_id"]);
                    proj_loc.ProjectId = Convert.ToInt32(dr["project_id"]);
                    proj_loc.ProjectName = dr["project_name"].ToString();
                    proj_loc.ProjectCode = dr["project_code"].ToString();
                    proj_loc.ProjectLeadId = Convert.ToInt32(dr["project_lead_id"]);
                    proj_loc.ProjectLeadName = dr["project_lead_name"].ToString();

                    proj_loc.LocationId = Convert.ToInt32(dr["location_id"]);
                    proj_loc.LocationName = dr["location_name"].ToString();

                    proj_loc.IsActive = Convert.ToBoolean(dr["is_active"]);
                    proj_loc.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    proj_loc.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    proj_loc.ChangedByName = dr["changed_by"].ToString();

                    if (proj_loc.IsActive == true)
                    {
                        proj_loc.OpenClose = "Close";
                    }
                    else
                    {
                        proj_loc.OpenClose = "Open";
                    }
                    al.Add(proj_loc);
                }
                //dr.Close();
            }

            ProjectLocationInfo[] allInfo = new ProjectLocationInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
예제 #4
0
        private static SqlParameter[] GetAddProjectAtLocationParams(ProjectLocationInfo ProjLoc)
        {
            SqlParameter[] sqlParms = new SqlParameter[100];
            sqlParms = SQLHelper.GetCachedParameters(PROC_ADDPROJECTATLOC);
            if (sqlParms == null)
            {
                sqlParms = new SqlParameter[]
                            {
                                new SqlParameter(PARAM_RETURN, SqlDbType.Int),
                                new SqlParameter(PARAM_PROJECT_ID, SqlDbType.Int),
                                new SqlParameter(PARAM_LOCATION_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 = ProjLoc.ProjectId;
            sqlParms[2].Value = ProjLoc.LocationId;
            sqlParms[3].Value = "vysali";
            return sqlParms;
        }
예제 #5
0
 public static int AddProjectAtLocation(ProjectLocationInfo ProjLoc, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetAddProjectAtLocationParams(ProjLoc);
     return ExecuteNonQuery(PROC_ADDPROJECTATLOC, parms, out retValue);
 }
예제 #6
0
 public HttpResponseMessage Post(ProjectLocationInfo ProjLoc)
 {
     return ProjectLocationBl.AddProjectToLocation(ProjLoc);
 }