public TipCdotData GetCdotData(int projectVersionId)
        {
            TipCdotData cdotData = null;

            SqlCommand cmd = new SqlCommand("[dbo].[GetCDOTData]");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ProjectVersionId", projectVersionId);

            cdotData = new TipCdotData();
            DataTable dt = this.ExecuteDataTable(cmd);
            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];

                cdotData.Region = row["Region"] != DBNull.Value ? (short)row["Region"] : (short)0;
                cdotData.CommDistrict = row["CommDistrict"] != DBNull.Value ? (short)row["CommDistrict"] : (short)0;
                cdotData.RouteSegment = row["RouteSegment"].ToString();
                cdotData.BeginMilePost = row["BeginMilePost"] != DBNull.Value ? (double)row["BeginMilePost"] : 0.0;
                cdotData.EndMilePost = row["EndMilePost"] != DBNull.Value ? (double)row["EndMilePost"] : 0.0;
                cdotData.STIPID = row["STIPID"].ToString();
                cdotData.STIPProjectDivision = row["STIPProjectDivision"].ToString();
                cdotData.CDOTProjectManager = row["CDOTProjectManager"] != DBNull.Value ? (int)row["CDOTProjectManager"] : 0;
                cdotData.TPRAbbr = row["TPRAbbr"].ToString();
                cdotData.TPRID = row["TPRID"] != DBNull.Value ? (short)row["TPRID"] : (short)0;
                cdotData.LRPNumber = row["LRPNumber"] != DBNull.Value ? (int)row["LRPNumber"] : 0;
                cdotData.InvestmentCategory = row["InvestmentCategory"].ToString();
                cdotData.CorridorID = row["CorridorID"].ToString();
                cdotData.CDOTProjectNumber = row["CDOTProjectNumber"].ToString();
                cdotData.SubAccount = row["SubAccount"] != DBNull.Value ? (int)row["SubAccount"] : 0;
                cdotData.ConstructionRE = row["ConstructionRE"] != DBNull.Value ? (int)row["ConstructionRE"] : 0;
                cdotData.CMSNumber = row["CMSNumber"].ToString();
                cdotData.ScheduledADDate = row["ScheduledADDate"] != DBNull.Value ? (DateTime)row["ScheduledADDate"] : DateTime.MinValue;
                cdotData.ProjectStage = row["ProjectStage"] != DBNull.Value ? (int)row["ProjectStage"] : 0;
                cdotData.ProjectStageDate = row["ProjectStageDate"] != DBNull.Value ? (DateTime)row["ProjectStageDate"] : DateTime.MinValue;
                cdotData.ConstructionDate = row["ConstructionDate"] != DBNull.Value ? (DateTime)row["ConstructionDate"] : DateTime.MinValue;
                cdotData.ProjectClosed = row["ProjectClosed"] != DBNull.Value ? (DateTime)row["ProjectClosed"] : DateTime.MinValue;
                cdotData.Notes = row["Notes"].ToString();

            }
            return cdotData;
        }
 /// <summary>
 /// Update ProjectVersion CDOT Data
 /// </summary>
 /// <param name="model"></param>
 public void UpdateCdotData(TipCdotData model, int projectVersionId)
 {
     using (SqlCommand command = new SqlCommand("[dbo].[UpdateCdotData]") { CommandType = CommandType.StoredProcedure })
     {
         //model.Adoption != null ? (object)model.Adoption.Value : (object)DBNull.Value
         command.Parameters.AddWithValue("@ProjectVersionId", projectVersionId);
         command.Parameters.AddWithValue("@StipId", model.STIPID);
         this.ExecuteNonQuery(command);
     }
 }