private democode.mvc.Models.ProjectModels convertToProjectModels(ProjectMgmt.Project data) { democode.mvc.Models.ProjectModels p = new democode.mvc.Models.ProjectModels(); try { p.PID = data.PID; p.Icon = data.Icon; p.Code = data.Code; p.Name = data.Name; p.Description = data.Description; p.EstimatedStartDate = data.EstimatedStartDate; p.EstimatedEndDate = data.EstimatedEndDate; p.ActualStartDate = data.ActualStartDate; p.ActualEndDate = data.ActualEndDate; p.Folder = data.Folder; p.Caption = data.Caption; p.URL = data.URL; p.Organization = data.Organization; return p; } catch (Exception ex) { return null; } }
private democode.mvc.Models.ProjectModels convertToProjectModels(DataRow dr) { democode.mvc.Models.ProjectModels p = new democode.mvc.Models.ProjectModels(); try { if (dr["pid"] != System.DBNull.Value) { p.PID = new Guid(dr["pid"].ToString()); } if (dr["ProjIcon"] != System.DBNull.Value) { p.Icon = (String)dr["ProjIcon"]; } if (dr["ProjCode"] != System.DBNull.Value) { p.Code = (String)dr["ProjCode"]; } if (dr["ProjName"] != System.DBNull.Value) { p.Name = (String)dr["ProjName"]; } if (dr["ProjDesc"] != System.DBNull.Value) { p.Description = (String)dr["ProjDesc"]; } if (dr["ProjEstStartDate"] != System.DBNull.Value) { p.EstimatedStartDate = (DateTime)dr["ProjEstStartDate"]; } if (dr["ProjEstEndDate"] != System.DBNull.Value) { p.EstimatedEndDate = (DateTime)dr["ProjEstEndDate"]; } if (dr["ProjActStartDate"] != System.DBNull.Value) { p.EstimatedStartDate = (DateTime)dr["ProjActStartDate"]; } if (dr["ProjActEndDate"] != System.DBNull.Value) { p.ActualEndDate = (DateTime)dr["ProjActEndDate"]; } if (dr["ProjFolder"] != System.DBNull.Value) { p.Folder = (String)dr["ProjFolder"]; } if (dr["ProjCaption"] != System.DBNull.Value) { p.Caption = (String)dr["ProjCaption"]; } if (dr["ProjURL"] != System.DBNull.Value) { p.URL = (String)dr["ProjURL"]; } if (dr["ProjOrg"] != System.DBNull.Value) { p.Organization = (String)dr["ProjOrg"]; } return p; } catch (Exception ex) { return null; } }