Beispiel #1
0
        private static CVResultModel ToModel(DataRow row)
        {
            CVResultModel cVResult = new CVResultModel();

            cVResult.Path            = (System.String)row["path"];
            cVResult.Teeth_num       = (System.Int32)row["teeth_num"];
            cVResult.Teeth_illnesses = (System.String)row["teeth_illnesses"];
            return(cVResult);
        }
Beispiel #2
0
        public static CVResultModel[] GetAll()
        {
            DataTable table = SqlHelper.ExecuteDataTable("select * from CVResult");

            CVResultModel[] cVResult = new CVResultModel[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                cVResult[i] = ToModel(table.Rows[i]);
            }
            return(cVResult);
        }
Beispiel #3
0
        public static bool Insert(CVResultModel cVResult)
        {
            try
            {
                SqlHelper.ExecuteNonQuery(@"insert into CVResult(path, teeth_num, teeth_illnesses)
				values(@teeth_num, @teeth_illnesses)"                ,
                                          new SqlParameter("@path", cVResult.Path),
                                          new SqlParameter("@teeth_num", cVResult.Teeth_num),
                                          new SqlParameter("@teeth_illnesses", cVResult.Teeth_illnesses)
                                          );
                return(true);
            }
            catch (SqlException)
            {
                return(false);
            }
        }
Beispiel #4
0
        public static bool Update(CVResultModel cVResult)
        {
            try
            {
                SqlHelper.ExecuteNonQuery(@"update CVResult set
				teeth_num = @teeth_num,
				teeth_illnesses = @teeth_illnesses
				where path = @path"                ,
                                          new SqlParameter("@teeth_num", cVResult.Teeth_num),
                                          new SqlParameter("@teeth_illnesses", cVResult.Teeth_illnesses),
                                          new SqlParameter("@path", cVResult.Path)
                                          );
                return(true);
            }
            catch (SqlException)
            {
                return(false);
            }
        }